Sat, 19 Mar 2022 19:22:58 +0100
First step in loading the Inventory Suppliers database on the mainscreen. But, it is loaded at program start en not removed when done. Weird programming to get this working.
48
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /** |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * ProfileWaters.cpp is part of bmsapp. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * bmsapp is free software: you can redistribute it and/or modify |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * it under the terms of the GNU General Public License as published by |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * the Free Software Foundation, either version 3 of the License, or |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * (at your option) any later version. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * bmsapp is distributed in the hope that it will be useful, |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * GNU General Public License for more details. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * You should have received a copy of the GNU General Public License |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | #include "ProfileWaters.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | #include "EditProfileWater.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | #include "../ui/ui_ProfileWaters.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | #include "config.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | #include "bmsapp.h" |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | ProfileWaters::ProfileWaters(QWidget *parent) : QDialog(parent), ui(new Ui::ProfileWaters) |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | qDebug() << "ProfileWaters start"; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | ui->setupUi(this); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | emit refreshTable(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | setWindowTitle( QString("BMSapp - %1 - Profile Waters").arg(VERSIONSTRING) ); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | void ProfileWaters::refreshTable() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | QString w; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | QWidget* pWidget; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | QLabel *label; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | QHBoxLayout* pLayout; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | qDebug() << "ProfileWaters reload"; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | QSqlQuery query("SELECT * FROM profile_water ORDER BY name"); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | const QStringList labels({tr("Name"), tr("Notes"), tr("Ca"), tr("Mg"), tr("Na"), tr("CaCO3"), tr("Cl"), tr("SO4"), tr("pH"), tr("Edit")}); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | ui->tableWaters->setColumnCount(10); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | ui->tableWaters->setColumnWidth(0, 150); /* Name */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | ui->tableWaters->setColumnWidth(1, 375); /* Notes */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | ui->tableWaters->setColumnWidth(2, 75); /* Ca */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | ui->tableWaters->setColumnWidth(3, 75); /* Mg */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | ui->tableWaters->setColumnWidth(4, 75); /* Na */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | ui->tableWaters->setColumnWidth(5, 75); /* CaCO3 */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | ui->tableWaters->setColumnWidth(6, 75); /* Cl */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | ui->tableWaters->setColumnWidth(7, 75); /* SO4 */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | ui->tableWaters->setColumnWidth(8, 75); /* pH */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | ui->tableWaters->setColumnWidth(9, 80); /* Edit button */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | ui->tableWaters->setRowCount(query.size()); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | ui->tableWaters->setHorizontalHeaderLabels(labels); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | ui->tableWaters->verticalHeader()->hide(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | ui->tableWaters->setFixedSize(1130 + 24, 640); /* Even if this is too large, it works */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | QTableWidgetItem *rightitem = new QTableWidgetItem(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | rightitem->setTextAlignment(Qt::AlignRight); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | query.first(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | for (int ridx = 0 ; ridx < query.size() ; ridx++ ) { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | ui->tableWaters->setItem(ridx, 0, new QTableWidgetItem(query.value(1).toString())); /* Name */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | ui->tableWaters->setItem(ridx, 1, new QTableWidgetItem(query.value(9).toString())); /* Notes */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | w = QString("%1").arg(query.value(2).toDouble(), 2, 'f', 1, '0' ); /* Ca */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | QTableWidgetItem *item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | ui->tableWaters->setItem(ridx, 2, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | w = QString("%1").arg(query.value(7).toDouble(), 2, 'f', 1, '0' ); /* Mg */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | ui->tableWaters->setItem(ridx, 3, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | w = QString("%1").arg(query.value(6).toDouble(), 2, 'f', 1, '0' ); /* Na */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | ui->tableWaters->setItem(ridx, 4, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | w = QString("%1").arg(query.value(10).toDouble(), 2, 'f', 1, '0' ); /* CaCO3 */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | ui->tableWaters->setItem(ridx, 5, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | w = QString("%1").arg(query.value(5).toDouble(), 2, 'f', 1, '0' ); /* Cl */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | ui->tableWaters->setItem(ridx, 6, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | w = QString("%1").arg(query.value(4).toDouble(), 2, 'f', 1, '0' ); /* SO4 */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | ui->tableWaters->setItem(ridx, 7, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | w = QString("%1").arg(query.value(8).toDouble(), 2, 'f', 1, '0' ); /* pH */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | item = new QTableWidgetItem(w); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | item->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | ui->tableWaters->setItem(ridx, 8, item); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | /* Add the Edit button */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | pWidget = new QWidget(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | QPushButton* btn_edit = new QPushButton(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | btn_edit->setText(tr("Edit")); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | pLayout = new QHBoxLayout(pWidget); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | pLayout->addWidget(btn_edit); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | pLayout->setContentsMargins(5, 0, 5, 0); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | pWidget->setLayout(pLayout); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | ui->tableWaters->setCellWidget(ridx, 9, pWidget); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | query.next(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | setWindowTitle( QString("BMSapp - %1 - Profile Waters").arg(VERSIONSTRING) ); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | ProfileWaters::~ProfileWaters() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | qDebug() << "ProfileWaters done"; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | delete ui; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | void ProfileWaters::edit(int recno) |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | qDebug() << "ProfileWaters edit:" << recno; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | EditProfileWater dialog(recno, this); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | /* Signal from editor if a refresh is needed */ |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable())); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | dialog.setModal(true); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | dialog.exec(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | void ProfileWaters::on_editButton_clicked() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | int recno = pb->objectName().toInt(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | qDebug() << Q_FUNC_INFO << recno; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | edit(recno); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | void ProfileWaters::on_insertButton_clicked() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | qDebug() << Q_FUNC_INFO; |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | edit(-1); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | void ProfileWaters::on_quitButton_clicked() |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | { |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | emit firstWindow(); |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | } |
ddd1171ecda5
Added profile water table and editor.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 |