Adjusted to GenericCore::postItemsToServer and using ModelItemsValues typedef in new item dialog.
This commit is contained in:
@ -64,7 +64,7 @@ void NewItemDialog::createContent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NewItemDialog::accept() {
|
void NewItemDialog::accept() {
|
||||||
QHash<int, QVariant> 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(NameRole, m_nameEdit->text());
|
||||||
@ -73,7 +73,7 @@ void NewItemDialog::accept() {
|
|||||||
itemValues.insert(AmountRole, m_amountBox->value());
|
itemValues.insert(AmountRole, m_amountBox->value());
|
||||||
itemValues.insert(FactorRole, m_factorBox->value());
|
itemValues.insert(FactorRole, m_factorBox->value());
|
||||||
|
|
||||||
const QByteArray jsonDoc = JsonParser::itemValuesListToJson({itemValues}, ITEM_KEY_STRING);
|
const QByteArray jsonDoc = JsonParser::itemValuesListToJson({itemValues}, ITEMS_KEY_STRING);
|
||||||
emit addItems(jsonDoc);
|
emit addItems(jsonDoc);
|
||||||
|
|
||||||
// resetContent();
|
// resetContent();
|
||||||
|
|||||||
@ -306,7 +306,7 @@ void MainWindow::postItems() {
|
|||||||
showStatusMessage(tr("Invoked 'Server|Post items'"));
|
showStatusMessage(tr("Invoked 'Server|Post items'"));
|
||||||
const QModelIndex currentIndex = ui->tableView->currentIndex();
|
const QModelIndex currentIndex = ui->tableView->currentIndex();
|
||||||
const QByteArray jsonData = m_proxyModel->jsonDataForServer(currentIndex);
|
const QByteArray jsonData = m_proxyModel->jsonDataForServer(currentIndex);
|
||||||
emit m_core->sendItemToServer(jsonData);
|
emit m_core->postItemToServer(jsonData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createActions() {
|
void MainWindow::createActions() {
|
||||||
|
|||||||
Reference in New Issue
Block a user