Support item tabs based on item group string
This commit is contained in:
parent
0e09b6f46c
commit
a17cd23a4e
29 changed files with 527 additions and 181 deletions
|
|
@ -106,8 +106,11 @@ ActorSettingsDialog::~ActorSettingsDialog()
|
|||
|
||||
void ActorSettingsDialog::editAsItem()
|
||||
{
|
||||
ItemSettingsDialog itemSettingsDiag(actor_, this);
|
||||
setModal(false);
|
||||
ItemSettingsDialog itemSettingsDiag(actor_, false, this);
|
||||
itemSettingsDiag.setModal(false);
|
||||
itemSettingsDiag.exec();
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
void ActorSettingsDialog::setEnabled()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
#include "itemscrollbox.h"
|
||||
#include "ui_relayscrollbox.h"
|
||||
#include "../items/auxitem.h"
|
||||
#include "../items/messageitem.h"
|
||||
#include <QScrollArea>
|
||||
#include <QFrame>
|
||||
|
||||
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);
|
||||
|
||||
ensureTabExists("All");
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
ItemScrollBox::~ItemScrollBox()
|
||||
|
|
@ -23,24 +24,166 @@ void ItemScrollBox::addItem(std::weak_ptr<Item> item)
|
|||
{
|
||||
if(workItem->isHidden())
|
||||
return;
|
||||
widgets_.push_back(new ItemWidget(item));
|
||||
ui->relayWidgetVbox->addWidget(widgets_.back());
|
||||
connect(widgets_.back(), &ItemWidget::deleteRequest, this, &ItemScrollBox::deleteRequest);
|
||||
connect(widgets_.back(), &ItemWidget::deleteRequest, this, &ItemScrollBox::removeItem);
|
||||
|
||||
// Add to "All" tab
|
||||
widgets_["All"].push_back(new ItemWidget(item, false));
|
||||
QWidget* allScrollContent = tabs_["All"].content;
|
||||
QLayout* layout = allScrollContent->layout();
|
||||
layout->removeItem(tabs_["All"].spacer);
|
||||
layout->addWidget(widgets_["All"].back());
|
||||
layout->addItem(tabs_["All"].spacer);
|
||||
connect(widgets_["All"].back(), &ItemWidget::deleteRequest, this, &ItemScrollBox::deleteRequest);
|
||||
connect(widgets_["All"].back(), &ItemWidget::deleteRequest, this, &ItemScrollBox::removeItem);
|
||||
|
||||
addItemToTabs(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemScrollBox::addItemToTabs(std::weak_ptr<Item> item)
|
||||
{
|
||||
if(auto workItem = item.lock())
|
||||
{
|
||||
if(workItem->isHidden())
|
||||
return;
|
||||
|
||||
QString groupName = workItem->getGroupName();
|
||||
if(groupName.isEmpty() || groupName != "All")
|
||||
{
|
||||
ensureTabExists(groupName);
|
||||
ItemWidget* groupWidget = new ItemWidget(item, true);
|
||||
widgets_[groupName].push_back(groupWidget);
|
||||
|
||||
QWidget* scrollContent = tabs_[groupName].content;
|
||||
QLayout* groupLayout = scrollContent->layout();
|
||||
groupLayout->removeItem(tabs_[groupName].spacer);
|
||||
groupLayout->addWidget(groupWidget);
|
||||
groupLayout->addItem(tabs_[groupName].spacer);
|
||||
|
||||
connect(groupWidget, &ItemWidget::deleteRequest, this, &ItemScrollBox::deleteRequest);
|
||||
connect(groupWidget, &ItemWidget::deleteRequest, this, &ItemScrollBox::removeItem);
|
||||
|
||||
connect(widgets_[groupName].back(), &ItemWidget::deleteRequest, this, &ItemScrollBox::deleteRequest);
|
||||
connect(widgets_[groupName].back(), &ItemWidget::deleteRequest, this, &ItemScrollBox::removeItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ItemScrollBox::removeItem(const ItemData& item)
|
||||
{
|
||||
for(unsigned i = 0; i < widgets_.size(); i++)
|
||||
QString key = "All";
|
||||
std::vector<ItemWidget*>& widgets = widgets_[key];
|
||||
for(unsigned i = 0; i < widgets.size(); i++)
|
||||
{
|
||||
if(widgets_[i]->controles(item))
|
||||
if(widgets[i]->controles(item))
|
||||
{
|
||||
ui->relayWidgetVbox->removeWidget(widgets_[i]);
|
||||
delete widgets_[i];
|
||||
widgets_.erase(widgets_.begin()+i);
|
||||
QWidget* tabContent = tabs_[key].content;
|
||||
if(tabContent)
|
||||
{
|
||||
QLayout* layout = tabContent->layout();
|
||||
if(layout)
|
||||
layout->removeWidget(widgets[i]);
|
||||
}
|
||||
delete widgets[i];
|
||||
widgets.erase(widgets.begin()+i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
removeItemFromTabs(item);
|
||||
cleanupEmptyTabs();
|
||||
}
|
||||
|
||||
void ItemScrollBox::removeItemFromTabs(const ItemData& item)
|
||||
{
|
||||
for(const QString& key : widgets_.keys())
|
||||
{
|
||||
if(key == "All")
|
||||
continue;
|
||||
std::vector<ItemWidget*>& widgets = widgets_[key];
|
||||
for(unsigned i = 0; i < widgets.size(); i++)
|
||||
{
|
||||
if(widgets[i]->controles(item))
|
||||
{
|
||||
QWidget* tabContent = tabs_[key].content;
|
||||
if(tabContent)
|
||||
{
|
||||
QLayout* layout = tabContent->layout();
|
||||
if(layout)
|
||||
layout->removeWidget(widgets[i]);
|
||||
}
|
||||
delete widgets[i];
|
||||
widgets.erase(widgets.begin()+i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanupEmptyTabs();
|
||||
}
|
||||
|
||||
|
||||
void ItemScrollBox::onItemUpdate(const ItemUpdateRequest& update)
|
||||
{
|
||||
if(!update.changes.groupName)
|
||||
return;
|
||||
|
||||
for(ItemWidget* widget : widgets_["All"])
|
||||
{
|
||||
if(widget->controles(update.payload))
|
||||
{
|
||||
qDebug()<<"ItemUpdate with group change";
|
||||
std::weak_ptr<Item> item = widget->getItem();
|
||||
removeItemFromTabs(update.payload);
|
||||
addItemToTabs(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ItemScrollBox::ensureTabExists(const QString& groupName)
|
||||
{
|
||||
if(!tabs_.contains(groupName))
|
||||
{
|
||||
Tab tab;
|
||||
tab.scroller = new QScrollArea(ui->tabWidget);
|
||||
tab.scroller->setWidgetResizable(true);
|
||||
tab.scroller->setFrameShape(QFrame::NoFrame);
|
||||
tab.scroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
tab.content = new QWidget(tab.scroller);
|
||||
QVBoxLayout* scrollLayout = new QVBoxLayout(tab.content);
|
||||
scrollLayout->setContentsMargins(0, 0, 0, 0);
|
||||
tab.content->setLayout(scrollLayout);
|
||||
tab.content->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
tab.scroller->setWidget(tab.content);
|
||||
|
||||
tab.spacer = new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||
scrollLayout->addSpacerItem(tab.spacer);
|
||||
|
||||
ui->tabWidget->addTab(tab.scroller, groupName);
|
||||
tabs_[groupName] = tab;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemScrollBox::cleanupEmptyTabs()
|
||||
{
|
||||
for(auto it = tabs_.begin(); it != tabs_.end(); ++it)
|
||||
{
|
||||
QString groupName = it.key();
|
||||
if(groupName == "All")
|
||||
continue;
|
||||
|
||||
qDebug()<<__func__<<it.value().content->layout()->count();
|
||||
|
||||
if(it.value().content->layout()->count() <= 1)
|
||||
{
|
||||
int index = ui->tabWidget->indexOf(tabs_[groupName].scroller);
|
||||
if(index >= 0)
|
||||
ui->tabWidget->removeTab(index);
|
||||
Tab tab = tabs_.take(groupName);
|
||||
delete tab.content;
|
||||
delete tab.scroller;
|
||||
cleanupEmptyTabs();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
#include <QWidget>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <QScroller>
|
||||
#include <QScrollArea>
|
||||
#include <QSpacerItem>
|
||||
#include "itemwidget.h"
|
||||
#include "../items/relay.h"
|
||||
#include "../items/item.h"
|
||||
#include "../items/itemstore.h"
|
||||
|
||||
|
|
@ -20,7 +20,16 @@ class ItemScrollBox : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
std::vector< ItemWidget* > widgets_;
|
||||
struct Tab
|
||||
{
|
||||
QScrollArea* scroller;
|
||||
QWidget* content;
|
||||
QSpacerItem* spacer;
|
||||
};
|
||||
|
||||
QMap<QString, Tab> tabs_;
|
||||
QMap<QString, std::vector<ItemWidget*>> widgets_;
|
||||
Ui::RelayScrollBox *ui;
|
||||
|
||||
signals:
|
||||
void deleteRequest(const ItemData& item);
|
||||
|
|
@ -36,9 +45,15 @@ public slots:
|
|||
|
||||
void addItem(std::weak_ptr<Item> item);
|
||||
void removeItem(const ItemData& item);
|
||||
void onItemUpdate(const ItemUpdateRequest& update);
|
||||
|
||||
private:
|
||||
Ui::RelayScrollBox *ui;
|
||||
void ensureTabExists(const QString& groupName);
|
||||
void cleanupEmptyTabs();
|
||||
|
||||
private:
|
||||
void addItemToTabs(std::weak_ptr<Item> item);
|
||||
void removeItemFromTabs(const ItemData& item);
|
||||
};
|
||||
|
||||
#endif // RELAYSCROLLBOX_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "itemsettingsdialog.h"
|
||||
#include "ui_itemsettingsdialog.h"
|
||||
#include "../items/itemstore.h"
|
||||
#include "actorsettingsdialog.h"
|
||||
#include "../actors/alarmtime.h"
|
||||
#include "../actors/sensoractor.h"
|
||||
|
|
@ -13,7 +14,7 @@
|
|||
#include "itemsettingswidgets/relayitemsettingswidget.h"
|
||||
#include<memory>
|
||||
|
||||
ItemSettingsDialog::ItemSettingsDialog(std::shared_ptr<Item> item, QWidget *parent) :
|
||||
ItemSettingsDialog::ItemSettingsDialog(std::shared_ptr<Item> item, bool noGroup, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
item_(item),
|
||||
ui(new Ui::ItemSettingsDialog)
|
||||
|
|
@ -22,9 +23,17 @@ ItemSettingsDialog::ItemSettingsDialog(std::shared_ptr<Item> item, QWidget *pare
|
|||
|
||||
setModal(false);
|
||||
|
||||
if(noGroup)
|
||||
ui->comboBox_Group->setEnabled(false);
|
||||
|
||||
ui->label_name->setText(item_->getName());
|
||||
ui->checkBox_Override->setChecked(item_->getOverride());
|
||||
|
||||
|
||||
// Setup group combobox with editable mode for creating new groups
|
||||
ui->comboBox_Group->setEditable(true);
|
||||
ui->comboBox_Group->addItem("All");
|
||||
ui->comboBox_Group->addItems(getExistingGroups());
|
||||
ui->comboBox_Group->setCurrentText(item_->getGroupName());
|
||||
|
||||
if(std::shared_ptr<Relay> relay = std::dynamic_pointer_cast<Relay>(item_))
|
||||
{
|
||||
|
|
@ -48,6 +57,7 @@ ItemSettingsDialog::ItemSettingsDialog(std::shared_ptr<Item> item, QWidget *pare
|
|||
connect(ui->pushButton_remove, &QPushButton::clicked, this, &ItemSettingsDialog::removeActor);
|
||||
connect(ui->pushButton_edit, &QPushButton::clicked, this, &ItemSettingsDialog::editActor);
|
||||
connect(ui->checkBox_Override, &QPushButton::clicked, this, &ItemSettingsDialog::changeOverride);
|
||||
connect(ui->comboBox_Group, &QComboBox::currentTextChanged, this, &ItemSettingsDialog::changeGroup);
|
||||
|
||||
|
||||
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Actor"));
|
||||
|
|
@ -61,10 +71,23 @@ ItemSettingsDialog::ItemSettingsDialog(std::shared_ptr<Item> item, QWidget *pare
|
|||
|
||||
ItemSettingsDialog::~ItemSettingsDialog()
|
||||
{
|
||||
if(itemSpecificWidget_) delete itemSpecificWidget_;
|
||||
if(itemSpecificWidget_)
|
||||
delete itemSpecificWidget_;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ItemSettingsDialog::changeGroup()
|
||||
{
|
||||
QString newGroup = ui->comboBox_Group->currentText();
|
||||
if(newGroup != item_->getGroupName())
|
||||
{
|
||||
ItemUpdateRequest update = item_->createValueUpdateRequest(ITEM_UPDATE_USER);
|
||||
update.payload.setGroupName(newGroup);
|
||||
update.changes.groupName = true;
|
||||
item_->requestUpdate(update);
|
||||
}
|
||||
}
|
||||
|
||||
void ItemSettingsDialog::changeOverride()
|
||||
{
|
||||
item_->setOverride(ui->checkBox_Override->isChecked());
|
||||
|
|
@ -166,14 +189,21 @@ void ItemSettingsDialog::editActor()
|
|||
|
||||
ActorSettingsDialog* dialog;
|
||||
|
||||
if(alarmTime) dialog = new ActorSettingsDialog(alarmTime, this);
|
||||
else if(regulator) dialog = new ActorSettingsDialog(regulator, this);
|
||||
else if(sensorActor) dialog = new ActorSettingsDialog(sensorActor, this);
|
||||
else if(timerActor) dialog = new ActorSettingsDialog(timerActor, this);
|
||||
else if(polynomalActor) dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
else if(factorActor) dialog = new ActorSettingsDialog(factorActor, this);
|
||||
else dialog = new ActorSettingsDialog(actor, this);
|
||||
dialog->setParent(this);
|
||||
if(alarmTime)
|
||||
dialog = new ActorSettingsDialog(alarmTime, this);
|
||||
else if(regulator)
|
||||
dialog = new ActorSettingsDialog(regulator, this);
|
||||
else if(sensorActor)
|
||||
dialog = new ActorSettingsDialog(sensorActor, this);
|
||||
else if(timerActor)
|
||||
dialog = new ActorSettingsDialog(timerActor, this);
|
||||
else if(polynomalActor)
|
||||
dialog = new ActorSettingsDialog(polynomalActor, this);
|
||||
else if(factorActor)
|
||||
dialog = new ActorSettingsDialog(factorActor, this);
|
||||
else
|
||||
dialog = new ActorSettingsDialog(actor, this);
|
||||
|
||||
dialog->show();
|
||||
dialog->exec();
|
||||
|
||||
|
|
@ -183,5 +213,19 @@ void ItemSettingsDialog::editActor()
|
|||
ui->tableWidget->item(i, 1)->setText(item_->getActors()[i]->actionName());
|
||||
ui->tableWidget->item(i, 2)->setText(item_->getActors()[i]->isActive() ? "Y" : "N");
|
||||
}
|
||||
delete dialog;
|
||||
}
|
||||
}
|
||||
|
||||
QStringList ItemSettingsDialog::getExistingGroups()
|
||||
{
|
||||
QSet<QString> uniqueGroups;
|
||||
for(const auto& item : *globalItems.getItems())
|
||||
{
|
||||
if(!item->getGroupName().isEmpty() && item->getGroupName() != "All")
|
||||
{
|
||||
uniqueGroups.insert(item->getGroupName());
|
||||
}
|
||||
}
|
||||
return uniqueGroups.values();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ class ItemSettingsDialog : public QDialog
|
|||
|
||||
private:
|
||||
void loadActorList();
|
||||
QStringList getExistingGroups();
|
||||
|
||||
public:
|
||||
explicit ItemSettingsDialog(std::shared_ptr<Item> item, QWidget *parent = nullptr);
|
||||
explicit ItemSettingsDialog(std::shared_ptr<Item> item, bool noGroup = false, QWidget *parent = nullptr);
|
||||
~ItemSettingsDialog();
|
||||
|
||||
private slots:
|
||||
|
|
@ -30,6 +31,7 @@ private slots:
|
|||
void addActor();
|
||||
void editActor();
|
||||
void changeOverride();
|
||||
void changeGroup();
|
||||
|
||||
private:
|
||||
Ui::ItemSettingsDialog *ui;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,20 @@
|
|||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_group">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Group">
|
||||
<property name="text">
|
||||
<string>Group:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_Group"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_Override">
|
||||
<property name="text">
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@
|
|||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QSlider>
|
||||
#include "itemsettingsdialog.h"
|
||||
|
||||
ItemWidget::ItemWidget(std::weak_ptr<Item> item, QWidget *parent) :
|
||||
ItemWidget::ItemWidget(std::weak_ptr<Item> item, bool noGroupEdit, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
item_(item),
|
||||
noGroupEdit_(noGroupEdit),
|
||||
ui(new Ui::ItemWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
|
@ -40,12 +42,13 @@ ItemWidget::ItemWidget(std::weak_ptr<Item> item, QWidget *parent) :
|
|||
connect(ui->pushButton, &QPushButton::clicked, this, &ItemWidget::showSettingsDialog);
|
||||
connect(workingItem.get(), &Item::updated, this, &ItemWidget::onItemUpdated);
|
||||
connect(ui->pushButton_Remove, &QPushButton::clicked, this, &ItemWidget::deleteItem);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
disable();
|
||||
}
|
||||
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
void ItemWidget::deleteItem()
|
||||
|
|
@ -60,7 +63,9 @@ void ItemWidget::moveToValue(int value)
|
|||
{
|
||||
if(auto workingItem = item_.lock())
|
||||
{
|
||||
ItemUpdateRequest request = workingItem->createValueUpdateRequest(value, ITEM_UPDATE_USER);
|
||||
ItemUpdateRequest request = workingItem->createValueUpdateRequest(ITEM_UPDATE_USER);
|
||||
request.payload.setValueData(value);
|
||||
request.changes.value = true;
|
||||
workingItem->requestUpdate(request);
|
||||
}
|
||||
else
|
||||
|
|
@ -71,15 +76,7 @@ void ItemWidget::moveToValue(int value)
|
|||
|
||||
void ItemWidget::moveToState(bool state)
|
||||
{
|
||||
if(auto workingItem = item_.lock())
|
||||
{
|
||||
ItemUpdateRequest request = workingItem->createValueUpdateRequest(state, ITEM_UPDATE_USER);
|
||||
workingItem->requestUpdate(request);
|
||||
}
|
||||
else
|
||||
{
|
||||
disable();
|
||||
}
|
||||
moveToValue(state);
|
||||
}
|
||||
|
||||
void ItemWidget::disable()
|
||||
|
|
@ -104,8 +101,9 @@ void ItemWidget::showSettingsDialog()
|
|||
{
|
||||
if(auto workingItem = item_.lock())
|
||||
{
|
||||
ItemSettingsDialog dialog(workingItem, this);
|
||||
ItemSettingsDialog dialog(workingItem, noGroupEdit_, this);
|
||||
dialog.exec();
|
||||
|
||||
}
|
||||
else disable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
#include "itemsettingsdialog.h"
|
||||
#include "../items/item.h"
|
||||
|
||||
namespace Ui
|
||||
|
|
@ -16,6 +15,7 @@ class ItemWidget : public QWidget
|
|||
Q_OBJECT
|
||||
private:
|
||||
std::weak_ptr<Item> item_;
|
||||
bool noGroupEdit_;
|
||||
|
||||
void disable();
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ private slots:
|
|||
void deleteItem();
|
||||
|
||||
public:
|
||||
explicit ItemWidget(std::weak_ptr<Item> item, QWidget *parent = nullptr);
|
||||
explicit ItemWidget(std::weak_ptr<Item> item, bool noGroupEdit = false, QWidget *parent = nullptr);
|
||||
std::weak_ptr<Item> getItem();
|
||||
bool controles(const ItemData& relay);
|
||||
~ItemWidget();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ MainWindow::MainWindow(MainObject * const mainObject, QWidget *parent) :
|
|||
connect(ui->pushButton_refesh, &QPushButton::clicked, mainObject, &MainObject::refresh);
|
||||
connect(&globalItems, &ItemStore::itemAdded, ui->relayList, &ItemScrollBox::addItem);
|
||||
connect(&globalItems, &ItemStore::itemDeleted, ui->relayList, &ItemScrollBox::removeItem);
|
||||
connect(&globalItems, &ItemStore::itemUpdated, ui->relayList, &ItemScrollBox::onItemUpdate);
|
||||
|
||||
for(size_t i = 0; i < globalItems.getItems()->size(); ++i)
|
||||
ui->relayList->addItem(globalItems.getItems()->at(i));
|
||||
|
|
@ -65,7 +66,7 @@ void MainWindow::showPowerItemDialog()
|
|||
}
|
||||
if(powerItem)
|
||||
{
|
||||
ItemSettingsDialog diag(std::shared_ptr<Item>(powerItem), this);
|
||||
ItemSettingsDialog diag(std::shared_ptr<Item>(powerItem), false, this);
|
||||
diag.show();
|
||||
diag.exec();
|
||||
}
|
||||
|
|
@ -79,7 +80,13 @@ void MainWindow::showItemCreationDialog()
|
|||
ItemCreationDialog diag(this);
|
||||
diag.show();
|
||||
if(diag.exec())
|
||||
createdItem(diag.item);
|
||||
{
|
||||
ItemAddRequest request;
|
||||
request.type = ITEM_UPDATE_USER;
|
||||
request.changes = ItemFieldChanges(true);
|
||||
request.payload = diag.item;
|
||||
createdItem(request);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::changeHeaderLableText(QString string)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ private:
|
|||
signals:
|
||||
|
||||
void sigSave();
|
||||
void createdItem(std::shared_ptr<Item> item);
|
||||
void createdItem(ItemAddRequest request);
|
||||
void sigSetRgb(const QColor color);
|
||||
|
||||
private slots:
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<width>350</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -13,52 +13,15 @@
|
|||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="tabsClosable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>388</width>
|
||||
<height>288</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="relayWidgetVbox"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue