src/InventoryWaters.cpp

Sun, 20 Mar 2022 17:33:18 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 20 Mar 2022 17:33:18 +0100
changeset 72
7992c686e349
parent 46
404b79f6a681
child 73
ebd2fc719b1a
permissions
-rw-r--r--

Inventory Waters now on the mainscreen.

29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * InventoryWaters.cpp is part of bmsapp.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "InventoryWaters.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "EditWater.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "../ui/ui_InventoryWaters.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "config.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 #include "bmsapp.h"
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
24 InventoryWaters::InventoryWaters(QWidget *parent) : QDialog(parent)
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 qDebug() << "InventoryWaters start";
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
28 gridLayout = new QGridLayout(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
29 gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
30 tableWaters = new QTableWidget(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
31 tableWaters->setObjectName(QString::fromUtf8("tableWaters"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
32 tableWaters->setEnabled(true);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
33 QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
34 sizePolicy.setHorizontalStretch(0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
35 sizePolicy.setVerticalStretch(0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
36 tableWaters->setSizePolicy(sizePolicy);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
37 tableWaters->setMinimumSize(QSize(954, 0));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
38 gridLayout->addWidget(tableWaters, 0, 0, 1, 1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
39
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
40 groupBox = new QGroupBox(this);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
41 groupBox->setObjectName(QString::fromUtf8("groupBox"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
42 groupBox->setEnabled(true);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
43 groupBox->setFlat(false);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
44 horizontalLayout = new QHBoxLayout(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
45 horizontalLayout->setSpacing(6);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
46 horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
47 horizontalLayout->setContentsMargins(0, 0, 0, 0);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
48
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
49 quitButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
50 quitButton->setObjectName(QString::fromUtf8("quitButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
51 quitButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
52 quitButton->setText(tr("Quit"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
53 QIcon icon;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
54 icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
55 quitButton->setIcon(icon);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
56 horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
57
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
58 exportButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
59 exportButton->setObjectName(QString::fromUtf8("exportButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
60 exportButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
61 exportButton->setText(tr("Export"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
62 QIcon icon1;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
63 icon1.addFile(QString::fromUtf8(":/icons/silk/database_save.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
64 exportButton->setIcon(icon1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
65 horizontalLayout->addWidget(exportButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
66
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
67 importButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
68 importButton->setObjectName(QString::fromUtf8("importButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
69 importButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
70 importButton->setText(tr("Import"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
71 QIcon icon2;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
72 icon2.addFile(QString::fromUtf8(":/icons/silk/database_add.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
73 importButton->setIcon(icon2);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
74 horizontalLayout->addWidget(importButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
75
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
76 insertButton = new QPushButton(groupBox);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
77 insertButton->setObjectName(QString::fromUtf8("insertButton"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
78 insertButton->setMinimumSize(QSize(80, 24));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
79 insertButton->setText(tr("New"));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
80 QIcon icon3;
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
81 icon3.addFile(QString::fromUtf8(":icons/silk/table_row_insert.png"), QSize(), QIcon::Normal, QIcon::Off);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
82 insertButton->setIcon(icon3);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
83 horizontalLayout->addWidget(insertButton, 0, Qt::AlignRight);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
84 gridLayout->addWidget(groupBox, 1, 0, 1, 1);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
85
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
86 connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromInventoryWaters()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
87 connect(insertButton, SIGNAL(clicked()), this, SLOT(on_insertButton_clicked()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
88 connect(exportButton, SIGNAL(clicked()), this, SLOT(on_exportButton_clicked()));
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
89 // connect(importButton, SIGNAL(clicked()), this, SLOT(on_importButton_clicked()));
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 emit refreshTable();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 void InventoryWaters::refreshTable()
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 QString w;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 QWidget* pWidget;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 QLabel *label;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 QHBoxLayout* pLayout;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 qDebug() << "InventoryWaters reload";
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 QSqlQuery query("SELECT * FROM inventory_waters ORDER BY name");
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 const QStringList labels({tr("Name"), tr("Notes"), tr("Unlimited"), tr("Stock"), tr("Edit")});
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
106 this->tableWaters->setColumnCount(5);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
107 this->tableWaters->setColumnWidth(0, 200); /* Name */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
108 this->tableWaters->setColumnWidth(1, 500); /* Notes */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
109 this->tableWaters->setColumnWidth(2, 75); /* Unlimited */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
110 this->tableWaters->setColumnWidth(3, 75); /* Stock */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
111 this->tableWaters->setColumnWidth(4, 80); /* Edit button */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
112 this->tableWaters->setRowCount(query.size());
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
113 this->tableWaters->setHorizontalHeaderLabels(labels);
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
114 this->tableWaters->verticalHeader()->hide();
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 QTableWidgetItem *rightitem = new QTableWidgetItem();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 rightitem->setTextAlignment(Qt::AlignRight);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 query.first();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) {
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
121 this->tableWaters->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
122 this->tableWaters->setItem(ridx, 1, new QTableWidgetItem(query.value(10).toString())); /* Notes */
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 if (query.value(2).toInt()) {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 pWidget = new QWidget();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 label = new QLabel;
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 label->setPixmap(QPixmap(":icons/silk/tick.png"));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 pLayout = new QHBoxLayout(pWidget);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 pLayout->addWidget(label);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 pLayout->setAlignment(Qt::AlignCenter);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 pLayout->setContentsMargins(0, 0, 0, 0);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 pWidget->setLayout(pLayout);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
132 this->tableWaters->setCellWidget(ridx, 2, pWidget);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 } else {
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
134 this->tableWaters->removeCellWidget(ridx, 2);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 w = QString("");
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 if (query.value(12).toDouble() > 0) {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 w = QString("%1 L").arg(query.value(12).toDouble(), 2, 'f', 1, '0' );
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 QTableWidgetItem *item = new QTableWidgetItem(w);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
143 this->tableWaters->setItem(ridx, 3, item);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 /* Add the Edit button */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 pWidget = new QWidget();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 QPushButton* btn_edit = new QPushButton();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 btn_edit->setText(tr("Edit"));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked()));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 pLayout = new QHBoxLayout(pWidget);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 pLayout->addWidget(btn_edit);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 pLayout->setContentsMargins(5, 0, 5, 0);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 pWidget->setLayout(pLayout);
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
155 this->tableWaters->setCellWidget(ridx, 4, pWidget);
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 query.next();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160
72
7992c686e349 Inventory Waters now on the mainscreen.
Michiel Broek <mbroek@mbse.eu>
parents: 46
diff changeset
161 InventoryWaters::~InventoryWaters() {}
29
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 void InventoryWaters::edit(int recno)
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 EditWater dialog(recno, this);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 /* Signal from editor if a refresh is needed */
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable()));
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 dialog.setModal(true);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 dialog.exec();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 void InventoryWaters::on_editButton_clicked()
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 int recno = pb->objectName().toInt();
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 edit(recno);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 void InventoryWaters::on_insertButton_clicked()
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 {
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 edit(-1);
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 }
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186
76846c99f827 Added inventory water editor and table. In Yeasts table make sure the fields without a tickmark are empty. Removed Utils::Round function, not reliable.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187
46
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
188 void InventoryWaters::on_exportButton_clicked()
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
189 {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
190 qDebug() << Q_FUNC_INFO;
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
191
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
192 QSqlQuery query("SELECT * FROM inventory_waters ORDER BY name");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
193
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
194 QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QDir::homePath() + "/waters.xml", tr("Files (*.xml)"));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
195 if (fileName == 0) {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
196 QMessageBox::warning(this, tr("Save File"), tr("No XML file selected."));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
197 return;
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
198 }
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
199
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
200 QFile file(fileName);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
201 file.open(QIODevice::WriteOnly);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
202
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
203 QXmlStreamWriter *xmlWriter = new QXmlStreamWriter(&file);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
204 xmlWriter->writeStartDocument();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
205 xmlWriter->setAutoFormatting(true);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
206 xmlWriter->setAutoFormattingIndent(1);
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
207 xmlWriter->writeStartElement("WATERS");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
208
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
209 query.first();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
210 for (int i = 0 ; i < query.size() ; i++ ) {
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
211 xmlWriter->writeStartElement("WATER");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
212 xmlWriter->writeTextElement("VERSION", "1");
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
213 xmlWriter->writeTextElement("NAME", query.value(1).toString());
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
214 if (query.value(13).toDouble() > 0)
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
215 xmlWriter->writeTextElement("COST", QString::number(query.value(13).toDouble(), 'f', 5));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
216 if (query.value(10).toString().length())
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
217 xmlWriter->writeTextElement("NOTES", query.value(10).toString());
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
218 xmlWriter->writeTextElement("CALCIUM", QString::number(query.value(3).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
219 xmlWriter->writeTextElement("BICARBONATE", QString::number(query.value(4).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
220 xmlWriter->writeTextElement("SULFATE", QString::number(query.value(5).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
221 xmlWriter->writeTextElement("CHLORIDE", QString::number(query.value(6).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
222 xmlWriter->writeTextElement("SODIUM", QString::number(query.value(7).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
223 xmlWriter->writeTextElement("MAGNESIUM", QString::number(query.value(8).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
224 xmlWriter->writeTextElement("TOTAL_ALKALINITY", QString::number(query.value(11).toDouble(), 'f', 4));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
225 xmlWriter->writeTextElement("PH", QString::number(query.value(9).toDouble(), 'f', 5));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
226 xmlWriter->writeEndElement();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
227 query.next();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
228 }
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
229
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
230 xmlWriter->writeEndElement();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
231 xmlWriter->writeEndDocument();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
232 QMessageBox::information(this, tr("Save File"), tr("XML export ready"));
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
233
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
234 file.close();
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
235 }
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
236
404b79f6a681 Added waters CML export.
Michiel Broek <mbroek@mbse.eu>
parents: 29
diff changeset
237

mercurial