Added roles for BeetRound purpose.
This commit is contained in:
@ -6,6 +6,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QStringListModel>
|
||||||
#include "formats/jsonparser.h"
|
#include "formats/jsonparser.h"
|
||||||
#include "model/metadata.h"
|
#include "model/metadata.h"
|
||||||
|
|
||||||
@ -24,39 +25,82 @@ void NewItemDialog::createContent() {
|
|||||||
// REFACTOR use a data structure for input widgets which can be iterated through
|
// REFACTOR use a data structure for input widgets which can be iterated through
|
||||||
// using a factory which iterates through the roles from metadata.h
|
// using a factory which iterates through the roles from metadata.h
|
||||||
// and create the input widgets based on the data type of this role
|
// and create the input widgets based on the data type of this role
|
||||||
m_nameLabel = new QLabel("&Name");
|
m_numberLabel = new QLabel(GET_HEADER_FOR_COLUMN(0));
|
||||||
m_nameEdit = new QLineEdit();
|
m_numberBox = new QSpinBox();
|
||||||
m_nameLabel->setBuddy(m_nameEdit);
|
m_numberBox->setMaximum(1000);
|
||||||
|
|
||||||
m_descriptionLabel = new QLabel("&Description");
|
m_lastNameLabel = new QLabel(GET_HEADER_FOR_COLUMN(1));
|
||||||
m_descriptionEdit = new QLineEdit();
|
m_lastNameEdit = new QLineEdit();
|
||||||
m_descriptionLabel->setBuddy(m_descriptionEdit);
|
m_lastNameLabel->setBuddy(m_lastNameEdit);
|
||||||
|
|
||||||
m_infoLabel = new QLabel("&Info");
|
m_firstNameLabel = new QLabel(GET_HEADER_FOR_COLUMN(2));
|
||||||
m_infoEdit = new QLineEdit();
|
m_firstNameEdit = new QLineEdit();
|
||||||
m_infoLabel->setBuddy(m_infoEdit);
|
m_firstNameLabel->setBuddy(m_firstNameEdit);
|
||||||
|
|
||||||
m_amountLabel = new QLabel("&Amount");
|
m_shareTypeLabel = new QLabel(GET_HEADER_FOR_COLUMN(3));
|
||||||
m_amountBox = new QSpinBox();
|
m_shareTypeBox = new QComboBox();
|
||||||
m_amountBox->setMaximum(1000);
|
m_shareTypeLabel->setBuddy(m_shareTypeBox);
|
||||||
m_amountLabel->setBuddy(m_amountBox);
|
m_shareTypeModel = new QStringListModel(SHARE_TYPES, this);
|
||||||
|
m_shareTypeBox->setModel(m_shareTypeModel);
|
||||||
|
|
||||||
m_factorLabel = new QLabel("&Factor");
|
m_amountLabel = new QLabel(GET_HEADER_FOR_COLUMN(4));
|
||||||
m_factorBox = new QDoubleSpinBox();
|
m_amountSpinBox = new QDoubleSpinBox();
|
||||||
m_factorBox->setMaximum(1000);
|
m_amountLabel->setBuddy(m_amountSpinBox);
|
||||||
m_factorLabel->setBuddy(m_factorBox);
|
|
||||||
|
|
||||||
|
m_biddingTypeLabel = new QLabel(GET_HEADER_FOR_COLUMN(5));
|
||||||
|
m_biddingTypeBox = new QComboBox();
|
||||||
|
m_biddingTypeLabel->setBuddy(m_biddingTypeBox);
|
||||||
|
m_biddingTypeModel = new QStringListModel(BIDDING_TYPES, this);
|
||||||
|
m_biddingTypeBox->setModel(m_biddingTypeModel);
|
||||||
|
|
||||||
|
m_bidding1Label = new QLabel(GET_HEADER_FOR_COLUMN(6));
|
||||||
|
m_bidding1SpinBox = new QSpinBox();
|
||||||
|
m_bidding1SpinBox->setMaximum(500);
|
||||||
|
m_bidding2Label = new QLabel(GET_HEADER_FOR_COLUMN(7));
|
||||||
|
m_bidding2SpinBox = new QSpinBox();
|
||||||
|
m_bidding2SpinBox->setMaximum(500);
|
||||||
|
m_bidding3Label = new QLabel(GET_HEADER_FOR_COLUMN(8));
|
||||||
|
m_bidding3SpinBox = new QSpinBox();
|
||||||
|
m_bidding3SpinBox->setMaximum(500);
|
||||||
|
|
||||||
|
m_depotWish1Label = new QLabel(GET_HEADER_FOR_COLUMN(9));
|
||||||
|
m_depotWish1Edit = new QLineEdit();
|
||||||
|
m_depotWish1Label->setBuddy(m_depotWish1Edit);
|
||||||
|
m_depotWish2Label = new QLabel(GET_HEADER_FOR_COLUMN(10));
|
||||||
|
m_depotWish2Edit = new QLineEdit();
|
||||||
|
m_depotWish2Label->setBuddy(m_depotWish2Edit);
|
||||||
|
|
||||||
|
m_mailLabel = new QLabel(GET_HEADER_FOR_COLUMN(11));
|
||||||
|
m_mailEdit = new QLineEdit();
|
||||||
|
m_mailEdit->setMinimumWidth(200);
|
||||||
|
m_mailLabel->setBuddy(m_mailEdit);
|
||||||
|
|
||||||
|
/// layouting
|
||||||
QGridLayout* layout = new QGridLayout();
|
QGridLayout* layout = new QGridLayout();
|
||||||
layout->addWidget(m_nameLabel, 0, 0, 1, 1);
|
layout->addWidget(m_numberLabel, 0, 0, 1, 1);
|
||||||
layout->addWidget(m_nameEdit, 0, 1, 1, 1);
|
layout->addWidget(m_numberBox, 0, 1, 1, 1);
|
||||||
layout->addWidget(m_descriptionLabel, 1, 0, 1, 1);
|
layout->addWidget(m_lastNameLabel, 1, 0, 1, 1);
|
||||||
layout->addWidget(m_descriptionEdit, 1, 1, 1, 1);
|
layout->addWidget(m_lastNameEdit, 1, 1, 1, 1);
|
||||||
layout->addWidget(m_infoLabel, 2, 0, 1, 1);
|
layout->addWidget(m_firstNameLabel, 2, 0, 1, 1);
|
||||||
layout->addWidget(m_infoEdit, 2, 1, 1, 1);
|
layout->addWidget(m_firstNameEdit, 2, 1, 1, 1);
|
||||||
layout->addWidget(m_amountLabel, 3, 0, 1, 1);
|
layout->addWidget(m_shareTypeLabel, 3, 0, 1, 1);
|
||||||
layout->addWidget(m_amountBox, 3, 1, 1, 1);
|
layout->addWidget(m_shareTypeBox, 3, 1, 1, 1);
|
||||||
layout->addWidget(m_factorLabel, 4, 0, 1, 1);
|
layout->addWidget(m_amountLabel, 4, 0, 1, 1);
|
||||||
layout->addWidget(m_factorBox, 4, 1, 1, 1);
|
layout->addWidget(m_amountSpinBox, 4, 1, 1, 1);
|
||||||
|
layout->addWidget(m_biddingTypeLabel, 5, 0, 1, 1);
|
||||||
|
layout->addWidget(m_biddingTypeBox, 5, 1, 1, 1);
|
||||||
|
layout->addWidget(m_bidding1Label, 6, 0, 1, 1);
|
||||||
|
layout->addWidget(m_bidding1SpinBox, 6, 1, 1, 1);
|
||||||
|
layout->addWidget(m_bidding2Label, 7, 0, 1, 1);
|
||||||
|
layout->addWidget(m_bidding2SpinBox, 7, 1, 1, 1);
|
||||||
|
layout->addWidget(m_bidding3Label, 8, 0, 1, 1);
|
||||||
|
layout->addWidget(m_bidding3SpinBox, 8, 1, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish1Label, 9, 0, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish1Edit, 9, 1, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish2Label, 10, 0, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish2Edit, 10, 1, 1, 1);
|
||||||
|
layout->addWidget(m_mailLabel, 11, 0, 1, 1);
|
||||||
|
layout->addWidget(m_mailEdit, 11, 1, 1, 1);
|
||||||
|
|
||||||
m_contentContainer->setLayout(layout);
|
m_contentContainer->setLayout(layout);
|
||||||
|
|
||||||
@ -67,11 +111,19 @@ void NewItemDialog::accept() {
|
|||||||
ModelItemValues itemValues;
|
ModelItemValues itemValues;
|
||||||
// TODO (after refactoring data structure for input widgets) use iteration through the relevant
|
// TODO (after refactoring data structure for input widgets) use iteration through the relevant
|
||||||
// roles and their input widgets
|
// roles and their input widgets
|
||||||
itemValues.insert(NameRole, m_nameEdit->text());
|
// itemValues.insert(LastNameRole, m_nameEdit->text());
|
||||||
itemValues.insert(DescriptionRole, m_descriptionEdit->text());
|
itemValues.insert(GET_ROLE_FOR_COLUMN(0), m_numberBox->value());
|
||||||
itemValues.insert(InfoRole, m_infoEdit->text());
|
itemValues.insert(GET_ROLE_FOR_COLUMN(1), m_lastNameEdit->text());
|
||||||
itemValues.insert(AmountRole, m_amountBox->value());
|
itemValues.insert(GET_ROLE_FOR_COLUMN(2), m_firstNameEdit->text());
|
||||||
itemValues.insert(FactorRole, m_factorBox->value());
|
itemValues.insert(GET_ROLE_FOR_COLUMN(3), m_shareTypeBox->currentText());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(4), m_amountSpinBox->value());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(5), m_biddingTypeBox->currentText());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(6), m_bidding1SpinBox->value());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(7), m_bidding2SpinBox->value());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(8), m_bidding3SpinBox->value());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(9), m_depotWish1Edit->text());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(10), m_depotWish2Edit->text());
|
||||||
|
itemValues.insert(GET_ROLE_FOR_COLUMN(11), m_mailEdit->text());
|
||||||
|
|
||||||
const QByteArray jsonDoc = JsonParser::itemValuesListToJson({itemValues}, ITEMS_KEY_STRING);
|
const QByteArray jsonDoc = JsonParser::itemValuesListToJson({itemValues}, ITEMS_KEY_STRING);
|
||||||
emit addItems(jsonDoc);
|
emit addItems(jsonDoc);
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
#include "abstractdialog.h"
|
#include "abstractdialog.h"
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
|
class QStringListModel;
|
||||||
class QDoubleSpinBox;
|
class QDoubleSpinBox;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
@ -24,20 +27,40 @@ class NewItemDialog : public AbstractDialog {
|
|||||||
// void reject() override;
|
// void reject() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel* m_nameLabel = nullptr;
|
QLabel* m_numberLabel;
|
||||||
QLineEdit* m_nameEdit = nullptr;
|
QSpinBox* m_numberBox;
|
||||||
|
|
||||||
QLabel* m_descriptionLabel = nullptr;
|
QLabel* m_lastNameLabel;
|
||||||
QLineEdit* m_descriptionEdit = nullptr;
|
QLineEdit* m_lastNameEdit;
|
||||||
|
|
||||||
QLabel* m_infoLabel = nullptr;
|
QLabel* m_firstNameLabel;
|
||||||
QLineEdit* m_infoEdit = nullptr;
|
QLineEdit* m_firstNameEdit;
|
||||||
|
|
||||||
QLabel* m_amountLabel = nullptr;
|
QLabel* m_shareTypeLabel;
|
||||||
QSpinBox* m_amountBox = nullptr;
|
QComboBox* m_shareTypeBox;
|
||||||
|
QStringListModel* m_shareTypeModel = nullptr;
|
||||||
|
|
||||||
QLabel* m_factorLabel = nullptr;
|
QLabel* m_amountLabel;
|
||||||
QDoubleSpinBox* m_factorBox = nullptr;
|
QDoubleSpinBox* m_amountSpinBox;
|
||||||
|
|
||||||
|
QLabel* m_biddingTypeLabel;
|
||||||
|
QComboBox* m_biddingTypeBox;
|
||||||
|
QStringListModel* m_biddingTypeModel = nullptr;
|
||||||
|
|
||||||
|
QLabel* m_bidding1Label;
|
||||||
|
QSpinBox* m_bidding1SpinBox;
|
||||||
|
QLabel* m_bidding2Label;
|
||||||
|
QSpinBox* m_bidding2SpinBox;
|
||||||
|
QLabel* m_bidding3Label;
|
||||||
|
QSpinBox* m_bidding3SpinBox;
|
||||||
|
|
||||||
|
QLabel* m_depotWish1Label;
|
||||||
|
QLineEdit* m_depotWish1Edit;
|
||||||
|
QLabel* m_depotWish2Label;
|
||||||
|
QLineEdit* m_depotWish2Edit;
|
||||||
|
|
||||||
|
QLabel* m_mailLabel;
|
||||||
|
QLineEdit* m_mailEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NEWITEMDIALOG_H
|
#endif // NEWITEMDIALOG_H
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include "itemdetailmapper.h"
|
#include "itemdetailmapper.h"
|
||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QDataWidgetMapper>
|
#include <QDataWidgetMapper>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
@ -9,6 +10,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QStringListModel>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include "model/metadata.h"
|
#include "model/metadata.h"
|
||||||
|
|
||||||
@ -34,42 +36,84 @@ ItemDetailMapper::ItemDetailMapper(QWidget* parent)
|
|||||||
|
|
||||||
/// the individual widgets
|
/// the individual widgets
|
||||||
// REFACTOR deduce label names and types from meta data & use a factory
|
// REFACTOR deduce label names and types from meta data & use a factory
|
||||||
m_nameLabel = new QLabel("&Name");
|
m_numberLabel = new QLabel(GET_HEADER_FOR_COLUMN(0));
|
||||||
m_nameEdit = new QLineEdit();
|
m_numberBox = new QSpinBox();
|
||||||
m_nameLabel->setBuddy(m_nameEdit);
|
m_numberBox->setMaximum(1000);
|
||||||
|
|
||||||
m_descriptionLabel = new QLabel("&Description");
|
m_lastNameLabel = new QLabel(GET_HEADER_FOR_COLUMN(1));
|
||||||
m_descriptionEdit = new QLineEdit();
|
m_lastNameEdit = new QLineEdit();
|
||||||
m_descriptionLabel->setBuddy(m_descriptionEdit);
|
m_lastNameLabel->setBuddy(m_lastNameEdit);
|
||||||
|
|
||||||
m_infoLabel = new QLabel("&Info");
|
m_firstNameLabel = new QLabel(GET_HEADER_FOR_COLUMN(2));
|
||||||
m_infoEdit = new QLineEdit();
|
m_firstNameEdit = new QLineEdit();
|
||||||
m_infoLabel->setBuddy(m_infoEdit);
|
m_firstNameLabel->setBuddy(m_firstNameEdit);
|
||||||
|
|
||||||
m_amountLabel = new QLabel("&Amount");
|
m_shareTypeLabel = new QLabel(GET_HEADER_FOR_COLUMN(3));
|
||||||
m_amountBox = new QSpinBox();
|
m_shareTypeBox = new QComboBox();
|
||||||
m_amountBox->setMaximum(1000);
|
m_shareTypeLabel->setBuddy(m_shareTypeBox);
|
||||||
m_amountLabel->setBuddy(m_amountBox);
|
m_shareTypeModel = new QStringListModel(SHARE_TYPES, this);
|
||||||
|
m_shareTypeBox->setModel(m_shareTypeModel);
|
||||||
|
|
||||||
m_factorLabel = new QLabel("&Factor");
|
m_amountLabel = new QLabel(GET_HEADER_FOR_COLUMN(4));
|
||||||
m_factorBox = new QDoubleSpinBox();
|
m_amountSpinBox = new QDoubleSpinBox();
|
||||||
m_factorBox->setMaximum(1000);
|
m_amountLabel->setBuddy(m_amountSpinBox);
|
||||||
m_factorLabel->setBuddy(m_factorBox);
|
|
||||||
|
m_biddingTypeLabel = new QLabel(GET_HEADER_FOR_COLUMN(5));
|
||||||
|
m_biddingTypeBox = new QComboBox();
|
||||||
|
m_biddingTypeLabel->setBuddy(m_biddingTypeBox);
|
||||||
|
m_biddingTypeModel = new QStringListModel(BIDDING_TYPES, this);
|
||||||
|
m_biddingTypeBox->setModel(m_biddingTypeModel);
|
||||||
|
|
||||||
|
m_bidding1Label = new QLabel(GET_HEADER_FOR_COLUMN(6));
|
||||||
|
m_bidding1SpinBox = new QSpinBox();
|
||||||
|
m_bidding1SpinBox->setMaximum(500);
|
||||||
|
m_bidding2Label = new QLabel(GET_HEADER_FOR_COLUMN(7));
|
||||||
|
m_bidding2SpinBox = new QSpinBox();
|
||||||
|
m_bidding2SpinBox->setMaximum(500);
|
||||||
|
m_bidding3Label = new QLabel(GET_HEADER_FOR_COLUMN(8));
|
||||||
|
m_bidding3SpinBox = new QSpinBox();
|
||||||
|
m_bidding3SpinBox->setMaximum(500);
|
||||||
|
|
||||||
|
m_depotWish1Label = new QLabel(GET_HEADER_FOR_COLUMN(9));
|
||||||
|
m_depotWish1Edit = new QLineEdit();
|
||||||
|
m_depotWish1Label->setBuddy(m_depotWish1Edit);
|
||||||
|
m_depotWish2Label = new QLabel(GET_HEADER_FOR_COLUMN(10));
|
||||||
|
m_depotWish2Edit = new QLineEdit();
|
||||||
|
m_depotWish2Label->setBuddy(m_depotWish2Edit);
|
||||||
|
|
||||||
|
m_mailLabel = new QLabel(GET_HEADER_FOR_COLUMN(11));
|
||||||
|
m_mailEdit = new QLineEdit();
|
||||||
|
m_mailEdit->setMinimumWidth(200);
|
||||||
|
m_mailLabel->setBuddy(m_mailEdit);
|
||||||
|
|
||||||
QGridLayout* layout = new QGridLayout();
|
QGridLayout* layout = new QGridLayout();
|
||||||
layout->addWidget(m_nameLabel, 0, 0, 1, 1);
|
layout->addWidget(m_numberLabel, 0, 0, 1, 1);
|
||||||
layout->addWidget(m_nameEdit, 0, 1, 1, 1);
|
layout->addWidget(m_numberBox, 0, 1, 1, 1);
|
||||||
layout->addWidget(m_descriptionLabel, 1, 0, 1, 1);
|
layout->addWidget(m_lastNameLabel, 1, 0, 1, 1);
|
||||||
layout->addWidget(m_descriptionEdit, 1, 1, 1, 1);
|
layout->addWidget(m_lastNameEdit, 1, 1, 1, 1);
|
||||||
layout->addWidget(m_infoLabel, 2, 0, 1, 1);
|
layout->addWidget(m_firstNameLabel, 2, 0, 1, 1);
|
||||||
layout->addWidget(m_infoEdit, 2, 1, 1, 1);
|
layout->addWidget(m_firstNameEdit, 2, 1, 1, 1);
|
||||||
layout->addWidget(m_amountLabel, 3, 0, 1, 1);
|
layout->addWidget(m_shareTypeLabel, 3, 0, 1, 1);
|
||||||
layout->addWidget(m_amountBox, 3, 1, 1, 1);
|
layout->addWidget(m_shareTypeBox, 3, 1, 1, 1);
|
||||||
layout->addWidget(m_factorLabel, 4, 0, 1, 1);
|
layout->addWidget(m_amountLabel, 4, 0, 1, 1);
|
||||||
layout->addWidget(m_factorBox, 4, 1, 1, 1);
|
layout->addWidget(m_amountSpinBox, 4, 1, 1, 1);
|
||||||
|
layout->addWidget(m_biddingTypeLabel, 5, 0, 1, 1);
|
||||||
|
layout->addWidget(m_biddingTypeBox, 5, 1, 1, 1);
|
||||||
|
layout->addWidget(m_bidding1Label, 6, 0, 1, 1);
|
||||||
|
layout->addWidget(m_bidding1SpinBox, 6, 1, 1, 1);
|
||||||
|
layout->addWidget(m_bidding2Label, 7, 0, 1, 1);
|
||||||
|
layout->addWidget(m_bidding2SpinBox, 7, 1, 1, 1);
|
||||||
|
layout->addWidget(m_bidding3Label, 8, 0, 1, 1);
|
||||||
|
layout->addWidget(m_bidding3SpinBox, 8, 1, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish1Label, 9, 0, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish1Edit, 9, 1, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish2Label, 10, 0, 1, 1);
|
||||||
|
layout->addWidget(m_depotWish2Edit, 10, 1, 1, 1);
|
||||||
|
layout->addWidget(m_mailLabel, 11, 0, 1, 1);
|
||||||
|
layout->addWidget(m_mailEdit, 11, 1, 1, 1);
|
||||||
|
|
||||||
layout->addWidget(m_previousButton, 5, 0, 1, 1);
|
layout->addWidget(m_previousButton, 12, 0, 1, 1);
|
||||||
layout->addWidget(m_nextButton, 5, 1, 1, 1);
|
layout->addWidget(m_nextButton, 12, 1, 1, 1);
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
@ -81,11 +125,18 @@ void ItemDetailMapper::setModelMappings(QTableView* tableView) {
|
|||||||
m_selectionModel = tableView->selectionModel();
|
m_selectionModel = tableView->selectionModel();
|
||||||
|
|
||||||
m_mapper->setModel(m_model);
|
m_mapper->setModel(m_model);
|
||||||
m_mapper->addMapping(m_nameEdit, 0);
|
m_mapper->addMapping(m_numberBox, 0);
|
||||||
m_mapper->addMapping(m_descriptionEdit, 1);
|
m_mapper->addMapping(m_lastNameEdit, 1);
|
||||||
m_mapper->addMapping(m_infoEdit, 2);
|
m_mapper->addMapping(m_firstNameEdit, 2);
|
||||||
m_mapper->addMapping(m_amountBox, 3);
|
m_mapper->addMapping(m_shareTypeBox, 3, "currentText");
|
||||||
m_mapper->addMapping(m_factorBox, 4);
|
m_mapper->addMapping(m_amountSpinBox, 4);
|
||||||
|
m_mapper->addMapping(m_biddingTypeBox, 5, "currentText");
|
||||||
|
m_mapper->addMapping(m_bidding1SpinBox, 6);
|
||||||
|
m_mapper->addMapping(m_bidding2SpinBox, 7);
|
||||||
|
m_mapper->addMapping(m_bidding3SpinBox, 8);
|
||||||
|
m_mapper->addMapping(m_depotWish1Edit, 9);
|
||||||
|
m_mapper->addMapping(m_depotWish2Edit, 10);
|
||||||
|
m_mapper->addMapping(m_mailEdit, 11);
|
||||||
|
|
||||||
m_mapper->setCurrentIndex(m_selectionModel->currentIndex().row());
|
m_mapper->setCurrentIndex(m_selectionModel->currentIndex().row());
|
||||||
|
|
||||||
@ -119,11 +170,11 @@ void ItemDetailMapper::rowsRemoved(const QModelIndex& parent, int start, int end
|
|||||||
if (m_model->rowCount() == 0) {
|
if (m_model->rowCount() == 0) {
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
|
|
||||||
m_nameEdit->clear();
|
// m_nameEdit->clear();
|
||||||
m_descriptionEdit->clear();
|
// m_descriptionEdit->clear();
|
||||||
m_infoEdit->clear();
|
// m_infoEdit->clear();
|
||||||
m_amountBox->clear();
|
// m_amountBox->clear();
|
||||||
m_factorBox->clear();
|
// m_factorBox->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateButtons(m_mapper->currentIndex());
|
updateButtons(m_mapper->currentIndex());
|
||||||
|
|||||||
@ -6,11 +6,13 @@
|
|||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
class QComboBox;
|
||||||
class QDoubleSpinBox;
|
class QDoubleSpinBox;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
class QItemSelectionModel;
|
class QItemSelectionModel;
|
||||||
|
class QStringListModel;
|
||||||
class QTableView;
|
class QTableView;
|
||||||
|
|
||||||
class ItemDetailMapper : public QWidget {
|
class ItemDetailMapper : public QWidget {
|
||||||
@ -45,21 +47,42 @@ class ItemDetailMapper : public QWidget {
|
|||||||
std::unique_ptr<QDataWidgetMapper> m_mapper;
|
std::unique_ptr<QDataWidgetMapper> m_mapper;
|
||||||
|
|
||||||
/// GUI elements
|
/// GUI elements
|
||||||
QLabel* m_nameLabel = nullptr;
|
QLabel* m_numberLabel;
|
||||||
QLineEdit* m_nameEdit = nullptr;
|
QSpinBox* m_numberBox;
|
||||||
|
|
||||||
QLabel* m_descriptionLabel = nullptr;
|
QLabel* m_lastNameLabel;
|
||||||
QLineEdit* m_descriptionEdit = nullptr;
|
QLineEdit* m_lastNameEdit;
|
||||||
|
|
||||||
QLabel* m_infoLabel = nullptr;
|
QLabel* m_firstNameLabel;
|
||||||
QLineEdit* m_infoEdit = nullptr;
|
QLineEdit* m_firstNameEdit;
|
||||||
|
|
||||||
QLabel* m_amountLabel = nullptr;
|
QLabel* m_shareTypeLabel;
|
||||||
QSpinBox* m_amountBox = nullptr;
|
QComboBox* m_shareTypeBox;
|
||||||
|
QStringListModel* m_shareTypeModel = nullptr;
|
||||||
|
|
||||||
QLabel* m_factorLabel = nullptr;
|
QLabel* m_amountLabel;
|
||||||
QDoubleSpinBox* m_factorBox = nullptr;
|
QDoubleSpinBox* m_amountSpinBox;
|
||||||
|
|
||||||
|
QLabel* m_biddingTypeLabel;
|
||||||
|
QComboBox* m_biddingTypeBox;
|
||||||
|
QStringListModel* m_biddingTypeModel = nullptr;
|
||||||
|
|
||||||
|
QLabel* m_bidding1Label;
|
||||||
|
QSpinBox* m_bidding1SpinBox;
|
||||||
|
QLabel* m_bidding2Label;
|
||||||
|
QSpinBox* m_bidding2SpinBox;
|
||||||
|
QLabel* m_bidding3Label;
|
||||||
|
QSpinBox* m_bidding3SpinBox;
|
||||||
|
|
||||||
|
QLabel* m_depotWish1Label;
|
||||||
|
QLineEdit* m_depotWish1Edit;
|
||||||
|
QLabel* m_depotWish2Label;
|
||||||
|
QLineEdit* m_depotWish2Edit;
|
||||||
|
|
||||||
|
QLabel* m_mailLabel;
|
||||||
|
QLineEdit* m_mailEdit;
|
||||||
|
|
||||||
|
/// Model mapper stuff
|
||||||
QPushButton* m_nextButton;
|
QPushButton* m_nextButton;
|
||||||
QPushButton* m_previousButton;
|
QPushButton* m_previousButton;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -86,14 +86,6 @@ QJsonArray JsonParser::extractItemArray(const QJsonDocument& doc, const QString&
|
|||||||
ModelItemValues JsonParser::jsonObjectToItemValues(const QJsonObject& itemJsonObject) {
|
ModelItemValues JsonParser::jsonObjectToItemValues(const QJsonObject& itemJsonObject) {
|
||||||
ModelItemValues values;
|
ModelItemValues values;
|
||||||
|
|
||||||
const UserRoles idRole = IdRole;
|
|
||||||
const QString idRoleName = ROLE_NAMES.value(idRole);
|
|
||||||
// QVariant idValue = data(idRole);
|
|
||||||
if (itemJsonObject.contains(idRoleName)) {
|
|
||||||
std::pair<int, QVariant> keyValuePair = getKeyValuePair(itemJsonObject, idRole);
|
|
||||||
values.insert(keyValuePair.first, keyValuePair.second);
|
|
||||||
}
|
|
||||||
|
|
||||||
QListIterator<UserRoles> i(USER_FACING_ROLES);
|
QListIterator<UserRoles> i(USER_FACING_ROLES);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
const UserRoles role = i.next();
|
const UserRoles role = i.next();
|
||||||
|
|||||||
@ -26,11 +26,6 @@ EditItemCommand::EditItemCommand(TableModel* model,
|
|||||||
.arg(roleName)
|
.arg(roleName)
|
||||||
.arg(index.data(DEFAULT_ROLE).toString())
|
.arg(index.data(DEFAULT_ROLE).toString())
|
||||||
.arg(value.toString());
|
.arg(value.toString());
|
||||||
} else if (role == IdRole) {
|
|
||||||
commandText = QString("Setting '%1' of item '%2' to '%3'")
|
|
||||||
.arg(roleName)
|
|
||||||
.arg(index.data(DEFAULT_ROLE).toString())
|
|
||||||
.arg(value.toString());
|
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Role didn't match! Using a generic command text...";
|
qWarning() << "Role didn't match! Using a generic command text...";
|
||||||
commandText = QString("Edit item '%1'").arg(index.data(DEFAULT_ROLE).toString());
|
commandText = QString("Edit item '%1'").arg(index.data(DEFAULT_ROLE).toString());
|
||||||
|
|||||||
@ -24,7 +24,7 @@ QItemSelection GeneralSortFilterModel::findItems(const QString& text) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString GeneralSortFilterModel::getUuid(const QModelIndex& itemIndex) const {
|
QString GeneralSortFilterModel::getUuid(const QModelIndex& itemIndex) const {
|
||||||
return data(itemIndex, IdRole).toString();
|
return data(itemIndex, OnlineIdRole).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray GeneralSortFilterModel::jsonDataForServer(const QModelIndex& proxyIndex) {
|
QByteArray GeneralSortFilterModel::jsonDataForServer(const QModelIndex& proxyIndex) {
|
||||||
|
|||||||
@ -10,29 +10,68 @@
|
|||||||
|
|
||||||
/// model data
|
/// model data
|
||||||
enum UserRoles {
|
enum UserRoles {
|
||||||
NameRole = Qt::UserRole + 1,
|
LastNameRole = Qt::UserRole + 1,
|
||||||
DescriptionRole,
|
FirstNameRole,
|
||||||
InfoRole,
|
MembershipNumberRole,
|
||||||
AmountRole,
|
Bidding1Role,
|
||||||
FactorRole,
|
Bidding2Role,
|
||||||
/// Non user facing
|
Bidding3Role,
|
||||||
IdRole,
|
DepotWish1Role,
|
||||||
/// read only roles
|
DepotWish2Role,
|
||||||
|
ShareAmountRole,
|
||||||
|
MailRole,
|
||||||
|
ShareTypeRole,
|
||||||
|
BiddingTypeRole,
|
||||||
|
OnlineIdRole,
|
||||||
|
AccessCodeRole,
|
||||||
|
// read-only (calculated)
|
||||||
|
FullNameRole,
|
||||||
|
FactoredBiddingRole,
|
||||||
ToStringRole,
|
ToStringRole,
|
||||||
ToJsonRole
|
JsonObjectRole
|
||||||
};
|
};
|
||||||
|
|
||||||
static UserRoles DEFAULT_ROLE = NameRole;
|
static UserRoles DEFAULT_ROLE = FullNameRole;
|
||||||
// TODO ?rename USER_FACING_ROLES -> MAIN_ROLES ?
|
// TODO ?rename USER_FACING_ROLES -> MAIN_ROLES ?
|
||||||
static QList<UserRoles> USER_FACING_ROLES = {NameRole, DescriptionRole, InfoRole, AmountRole,
|
static QList<UserRoles> USER_FACING_ROLES = {
|
||||||
FactorRole};
|
LastNameRole, FirstNameRole, MembershipNumberRole, Bidding1Role, Bidding2Role,
|
||||||
static QHash<int, QByteArray> ROLE_NAMES = {
|
Bidding3Role, DepotWish1Role, DepotWish2Role, ShareAmountRole, MailRole,
|
||||||
{NameRole, "name"}, {DescriptionRole, "description"}, {InfoRole, "info"},
|
ShareTypeRole, BiddingTypeRole, OnlineIdRole, AccessCodeRole};
|
||||||
{AmountRole, "amount"}, {FactorRole, "factor"}, {ToStringRole, "ToString"},
|
static QHash<int, QByteArray> ROLE_NAMES = {{MembershipNumberRole, "Mitglieds-nr."},
|
||||||
{IdRole, "id"}};
|
{LastNameRole, "Name"},
|
||||||
static QList<UserRoles> STRING_ROLES = {NameRole, DescriptionRole, InfoRole, IdRole};
|
{FirstNameRole, "Vorname"},
|
||||||
static QList<UserRoles> INT_ROLES = {AmountRole};
|
{Bidding1Role, "Gebot 1"},
|
||||||
static QList<UserRoles> DOUBLE_ROLES = {FactorRole};
|
{Bidding2Role, "Gebot 2"},
|
||||||
|
{Bidding3Role, "Gebot 3"},
|
||||||
|
{DepotWish1Role, "Wunsch 1"},
|
||||||
|
{DepotWish2Role, "Wunsch 2"},
|
||||||
|
{ShareAmountRole, "Anzahl"},
|
||||||
|
{MailRole, "Mail"},
|
||||||
|
{ShareTypeRole, "Art"},
|
||||||
|
{BiddingTypeRole, "Bietart"},
|
||||||
|
{OnlineIdRole, "Online ID"},
|
||||||
|
{AccessCodeRole, "Access Code"},
|
||||||
|
{FactoredBiddingRole, "factoredBidding"}};
|
||||||
|
|
||||||
|
static const QList<QString> SHARE_TYPES = {"bezahlt", "teils/teils", "erarbeitet", ""};
|
||||||
|
static const QList<QString> BIDDING_TYPES = {"paper", "digital", "online", "offline", ""};
|
||||||
|
|
||||||
|
static QList<UserRoles> STRING_ROLES = {LastNameRole, FirstNameRole, DepotWish1Role,
|
||||||
|
DepotWish2Role, MailRole, ShareTypeRole,
|
||||||
|
BiddingTypeRole, OnlineIdRole, AccessCodeRole};
|
||||||
|
static QList<UserRoles> INT_ROLES = {
|
||||||
|
MembershipNumberRole,
|
||||||
|
Bidding1Role,
|
||||||
|
Bidding2Role,
|
||||||
|
Bidding3Role,
|
||||||
|
};
|
||||||
|
static QList<UserRoles> DOUBLE_ROLES = {
|
||||||
|
ShareAmountRole,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const QList<UserRoles> TYPE_ROLES = {ShareTypeRole, BiddingTypeRole};
|
||||||
|
static const QList<UserRoles> SHARE_TYPE_ROLES = {ShareTypeRole};
|
||||||
|
static const QList<UserRoles> BIDDING_TYPE_ROLES = {BiddingTypeRole};
|
||||||
|
|
||||||
/// JSON keys
|
/// JSON keys
|
||||||
static const QString ITEMS_KEY_STRING = "items";
|
static const QString ITEMS_KEY_STRING = "items";
|
||||||
@ -42,26 +81,53 @@ static const QString ITEM_KEY_STRING = "item";
|
|||||||
static const QString ITEMS_FILE_NAME = ITEMS_KEY_STRING + ".json";
|
static const QString ITEMS_FILE_NAME = ITEMS_KEY_STRING + ".json";
|
||||||
|
|
||||||
/// functions
|
/// functions
|
||||||
static int GET_ROLE_FOR_COLUMN(const int column) {
|
static UserRoles GET_ROLE_FOR_COLUMN(const int column) {
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case 0:
|
case 0:
|
||||||
return NameRole;
|
return MembershipNumberRole;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return DescriptionRole;
|
return LastNameRole;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return InfoRole;
|
return FirstNameRole;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
return AmountRole;
|
return ShareTypeRole;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return FactorRole;
|
return ShareAmountRole;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return BiddingTypeRole;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
return Bidding1Role;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
return Bidding2Role;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return Bidding3Role;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
return DepotWish1Role;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
return DepotWish2Role;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
return MailRole;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
return OnlineIdRole;
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
return AccessCodeRole;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning() << QString("No role found for column %1! Returning 'NameRole'...").arg(column);
|
qWarning() << QString("No role found for column %1! Returning 'FullNameRole'...").arg(column);
|
||||||
return NameRole;
|
return FullNameRole;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,4 +140,10 @@ static QList<QString> GET_HEADER_NAMES() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString GET_HEADER_FOR_COLUMN(const int column) {
|
||||||
|
const UserRoles role = GET_ROLE_FOR_COLUMN(column);
|
||||||
|
const QString headerName = ROLE_NAMES.value(role);
|
||||||
|
return headerName;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // METADATA_H
|
#endif // METADATA_H
|
||||||
|
|||||||
@ -52,15 +52,7 @@ QString ModelItem::toString() const {
|
|||||||
const UserRoles role = i.next();
|
const UserRoles role = i.next();
|
||||||
const QString roleName = ROLE_NAMES.value(role);
|
const QString roleName = ROLE_NAMES.value(role);
|
||||||
const QVariant value = data(role);
|
const QVariant value = data(role);
|
||||||
// result.append(value.toString());
|
result.append(QString("%1: %2\n").arg(roleName, value.toString()));
|
||||||
result.append(QString("%1: %2\n").arg(roleName, data(role).toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
const UserRoles idRole = IdRole;
|
|
||||||
QVariant idValue = data(idRole);
|
|
||||||
if (!idValue.isNull()) {
|
|
||||||
const QString idRoleName = ROLE_NAMES.value(idRole);
|
|
||||||
result.append(QString("%1: %2\n").arg(idRoleName, idValue.toString()));
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -68,12 +60,6 @@ QString ModelItem::toString() const {
|
|||||||
QJsonObject ModelItem::toJsonObject() const {
|
QJsonObject ModelItem::toJsonObject() const {
|
||||||
QJsonObject itemObject;
|
QJsonObject itemObject;
|
||||||
// TODO add UUID and dates (entry, modification, end)
|
// TODO add UUID and dates (entry, modification, end)
|
||||||
const UserRoles idRole = IdRole;
|
|
||||||
QVariant idValue = data(idRole);
|
|
||||||
if (!idValue.isNull()) {
|
|
||||||
const QString idRoleName = ROLE_NAMES.value(idRole);
|
|
||||||
itemObject.insert(idRoleName, idValue.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
QListIterator<UserRoles> i(USER_FACING_ROLES);
|
QListIterator<UserRoles> i(USER_FACING_ROLES);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
|
|||||||
@ -21,11 +21,20 @@ QByteArray TableModel::generateExampleItems() {
|
|||||||
QJsonObject itemObject;
|
QJsonObject itemObject;
|
||||||
// itemObject.insert("uuid", m_uuid.toString());
|
// itemObject.insert("uuid", m_uuid.toString());
|
||||||
// itemObject.insert("entryDateUTC", m_entryDateUTC.toString(Qt::ISODate));
|
// itemObject.insert("entryDateUTC", m_entryDateUTC.toString(Qt::ISODate));
|
||||||
itemObject.insert(ROLE_NAMES.value(NameRole), QString("Item %1").arg(row));
|
itemObject.insert(ROLE_NAMES.value(MembershipNumberRole), row);
|
||||||
itemObject.insert(ROLE_NAMES.value(DescriptionRole), QString("This is item %1").arg(row));
|
itemObject.insert(ROLE_NAMES.value(LastNameRole), QString("Nachname%1").arg(row));
|
||||||
itemObject.insert(ROLE_NAMES.value(InfoRole), QString("Info of item %1").arg(row));
|
itemObject.insert(ROLE_NAMES.value(FirstNameRole), QString("Vorname%1").arg(row));
|
||||||
itemObject.insert(ROLE_NAMES.value(AmountRole), row);
|
itemObject.insert(ROLE_NAMES.value(Bidding1Role), 100 + row);
|
||||||
itemObject.insert(ROLE_NAMES.value(FactorRole), row * 1.1);
|
itemObject.insert(ROLE_NAMES.value(DepotWish1Role), QString("Depot X%1").arg(row));
|
||||||
|
itemObject.insert(ROLE_NAMES.value(DepotWish2Role), QString("Depot Y%1").arg(row));
|
||||||
|
itemObject.insert(ROLE_NAMES.value(MailRole),
|
||||||
|
QString("%1@%2.com")
|
||||||
|
.arg(itemObject.value(ROLE_NAMES.value(FirstNameRole)).toString(),
|
||||||
|
itemObject.value(ROLE_NAMES.value(LastNameRole)).toString()));
|
||||||
|
itemObject.insert(ROLE_NAMES.value(ShareAmountRole), 1);
|
||||||
|
itemObject.insert(ROLE_NAMES.value(ShareTypeRole), SHARE_TYPES.at(row % 3));
|
||||||
|
itemObject.insert(ROLE_NAMES.value(BiddingTypeRole), BIDDING_TYPES.at(row % 4));
|
||||||
|
// itemObject.insert(ROLE_NAMES.value(FactorRole), row * 1.1);
|
||||||
|
|
||||||
array.append(itemObject);
|
array.append(itemObject);
|
||||||
}
|
}
|
||||||
@ -78,16 +87,25 @@ QVariant TableModel::data(const QModelIndex& index, int role) const {
|
|||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
case Qt::EditRole:
|
case Qt::EditRole:
|
||||||
return m_items.at(row)->data(roleForColumn);
|
return m_items.at(row)->data(roleForColumn);
|
||||||
case NameRole:
|
case MembershipNumberRole:
|
||||||
case DescriptionRole:
|
case LastNameRole:
|
||||||
case InfoRole:
|
case FirstNameRole:
|
||||||
case AmountRole:
|
case FullNameRole:
|
||||||
case FactorRole:
|
case Bidding1Role:
|
||||||
case IdRole:
|
case Bidding2Role:
|
||||||
|
case Bidding3Role:
|
||||||
|
case DepotWish1Role:
|
||||||
|
case DepotWish2Role:
|
||||||
|
case ShareAmountRole:
|
||||||
|
case MailRole:
|
||||||
|
case ShareTypeRole:
|
||||||
|
case BiddingTypeRole:
|
||||||
|
case OnlineIdRole:
|
||||||
|
case AccessCodeRole:
|
||||||
return m_items.at(row)->data(role);
|
return m_items.at(row)->data(role);
|
||||||
case ToStringRole:
|
case ToStringRole:
|
||||||
return m_items.at(row)->toString();
|
return m_items.at(row)->toString();
|
||||||
case ToJsonRole:
|
case JsonObjectRole:
|
||||||
return m_items.at(row)->toJsonObject();
|
return m_items.at(row)->toJsonObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +192,7 @@ QList<QStringList> TableModel::getItemsAsStringLists() const {
|
|||||||
|
|
||||||
// TODO use item selection as parameter to wrap multiple items into JSON data structure
|
// TODO use item selection as parameter to wrap multiple items into JSON data structure
|
||||||
QByteArray TableModel::jsonDataForServer(const QModelIndex& currentIndex) const {
|
QByteArray TableModel::jsonDataForServer(const QModelIndex& currentIndex) const {
|
||||||
const QJsonObject itemObject = data(currentIndex, ToJsonRole).toJsonObject();
|
const QJsonObject itemObject = data(currentIndex, JsonObjectRole).toJsonObject();
|
||||||
QJsonObject rootObject;
|
QJsonObject rootObject;
|
||||||
rootObject.insert(ITEM_KEY_STRING, itemObject);
|
rootObject.insert(ITEM_KEY_STRING, itemObject);
|
||||||
const QJsonDocument jsonDoc(rootObject);
|
const QJsonDocument jsonDoc(rootObject);
|
||||||
@ -350,8 +368,9 @@ QModelIndex TableModel::searchItemIndex(const ModelItemValues givenItemValues) c
|
|||||||
bool TableModel::isItemEqualToItemValues(const QModelIndex& itemIndex,
|
bool TableModel::isItemEqualToItemValues(const QModelIndex& itemIndex,
|
||||||
const ModelItemValues givenItemValues) const {
|
const ModelItemValues givenItemValues) const {
|
||||||
/// do both have a UUID?
|
/// do both have a UUID?
|
||||||
QVariant idOfItem = data(itemIndex, IdRole);
|
const UserRoles idRole = OnlineIdRole;
|
||||||
QVariant given = givenItemValues.value(IdRole);
|
QVariant idOfItem = data(itemIndex, idRole);
|
||||||
|
QVariant given = givenItemValues.value(idRole);
|
||||||
if (idOfItem.isValid() && given.isValid()) {
|
if (idOfItem.isValid() && given.isValid()) {
|
||||||
/// are the UUIDs the same?
|
/// are the UUIDs the same?
|
||||||
if (idOfItem.toString() == given.toString()) {
|
if (idOfItem.toString() == given.toString()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user