switched from qsettings to json added editng of actors
This commit is contained in:
parent
b04fbfb5bc
commit
df27b622a0
141 changed files with 4402 additions and 5068 deletions
48
src/ui/itemscrollbox.cpp
Normal file
48
src/ui/itemscrollbox.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "itemscrollbox.h"
|
||||
#include "ui_relayscrollbox.h"
|
||||
#include "../items/auxitem.h"
|
||||
|
||||
ItemScrollBox::ItemScrollBox(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::RelayScrollBox)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QScroller::grabGesture(ui->scrollArea, QScroller::TouchGesture);
|
||||
QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
|
||||
}
|
||||
|
||||
ItemScrollBox::~ItemScrollBox()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ItemScrollBox::addItem(std::weak_ptr<Item> item)
|
||||
{
|
||||
if(auto workItem = item.lock())
|
||||
{
|
||||
if(dynamic_cast<AuxItem*>(workItem.get()))
|
||||
{
|
||||
widgets_.push_back(new ItemWidget(item, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
widgets_.push_back(new ItemWidget(item));
|
||||
}
|
||||
ui->relayWidgetVbox->addWidget(widgets_.back());
|
||||
}
|
||||
}
|
||||
|
||||
void ItemScrollBox::removeItem(const ItemData& item)
|
||||
{
|
||||
for(unsigned i = 0; i < widgets_.size(); i++)
|
||||
{
|
||||
if(widgets_[i]->controles(item))
|
||||
{
|
||||
ui->relayWidgetVbox->removeWidget(widgets_[i]);
|
||||
delete widgets_[i];
|
||||
widgets_.erase(widgets_.begin()+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue