src/ProdOnTree.cpp

Thu, 18 Aug 2022 20:34:15 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 18 Aug 2022 20:34:15 +0200
changeset 401
583148eb6e01
parent 336
e97f9e87d94b
permissions
-rw-r--r--

Init est_carb field for new products.

232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * ProdOnTree.cpp is part of bmsapp.
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "ProdOnTree.h"
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "MainWindow.h"
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "EditProduct.h"
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "config.h"
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 #include "Utils.h"
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 ProdOnTree::ProdOnTree(QWidget *parent) : QDialog(parent)
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 qDebug() << "ProdOnTree start";
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 gridLayout = new QGridLayout(this);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 treeWidget = new QTreeWidget(this);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 treeWidget->setObjectName(QString::fromUtf8("treeWidget"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 sizePolicy.setHorizontalStretch(0);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 sizePolicy.setVerticalStretch(0);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 sizePolicy.setHeightForWidth(treeWidget->sizePolicy().hasHeightForWidth());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 treeWidget->setSizePolicy(sizePolicy);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 gridLayout->addWidget(treeWidget, 0, 0, 1, 1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 recipeBox = new QGroupBox(this);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 recipeBox->setObjectName(QString::fromUtf8("recipeBox"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 QSizePolicy sizePolicy3(QSizePolicy::Preferred, QSizePolicy::Expanding);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 sizePolicy3.setHorizontalStretch(0);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 sizePolicy3.setVerticalStretch(0);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 sizePolicy3.setHeightForWidth(recipeBox->sizePolicy().hasHeightForWidth());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 recipeBox->setSizePolicy(sizePolicy3);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 recipeBox->setMinimumSize(QSize(500, 0));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 volumeLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 volumeLabel->setObjectName(QString::fromUtf8("volumeLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 volumeLabel->setGeometry(QRect(100, 30, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 volumeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 volumeLabel->setText(tr("Brew volume:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 efficiencyLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 efficiencyLabel->setObjectName(QString::fromUtf8("efficiencyLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 efficiencyLabel->setGeometry(QRect(100, 120, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 efficiencyLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 efficiencyLabel->setText(tr("Brewhouse efficiency:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 boilvolumeLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 boilvolumeLabel->setObjectName(QString::fromUtf8("boilvolumeLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 boilvolumeLabel->setGeometry(QRect(100, 60, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 boilvolumeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 boilvolumeLabel->setText(tr("Boil volume:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 boiltimeLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 boiltimeLabel->setObjectName(QString::fromUtf8("boiltimeLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 boiltimeLabel->setGeometry(QRect(100, 90, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 boiltimeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 boiltimeLabel->setText(tr("Boil time:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 ogLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 ogLabel->setObjectName(QString::fromUtf8("ogLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 ogLabel->setGeometry(QRect(100, 150, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 ogLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 ogLabel->setText(tr("Original gravity:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 fgLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 fgLabel->setObjectName(QString::fromUtf8("fgLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 fgLabel->setGeometry(QRect(100, 180, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 fgLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 fgLabel->setText(tr("Final gravity:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 abvLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 abvLabel->setObjectName(QString::fromUtf8("abvLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 abvLabel->setGeometry(QRect(100, 210, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 abvLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 abvLabel->setText(tr("Alcohol by Volume:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 co2Label = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 co2Label->setObjectName(QString::fromUtf8("co2Label"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 co2Label->setGeometry(QRect(100, 240, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 co2Label->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 co2Label->setText(tr("CO2 Volume:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 colorLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 colorLabel->setObjectName(QString::fromUtf8("colorLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 colorLabel->setGeometry(QRect(100, 270, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 colorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 colorLabel->setText(tr("Color EBC:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 colormethodLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 colormethodLabel->setObjectName(QString::fromUtf8("colormethodLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 colormethodLabel->setGeometry(QRect(100, 300, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 colormethodLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 colormethodLabel->setText(tr("Color method:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 ibuLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 ibuLabel->setObjectName(QString::fromUtf8("ibuLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 ibuLabel->setGeometry(QRect(100, 330, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 ibuLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 ibuLabel->setText(tr("Bitterness IBU:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 ibumethodLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 ibumethodLabel->setObjectName(QString::fromUtf8("ibumethodLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 ibumethodLabel->setGeometry(QRect(100, 360, 141, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 ibumethodLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 ibumethodLabel->setText(tr("Bitterness method:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 remarksLabel = new QLabel(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 remarksLabel->setObjectName(QString::fromUtf8("remarksLabel"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 remarksLabel->setGeometry(QRect(30, 390, 101, 20));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 remarksLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 remarksLabel->setText(tr("Remarks:"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 volumeEdit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 volumeEdit->setObjectName(QString::fromUtf8("volumeEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 volumeEdit->setGeometry(QRect(260, 30, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 volumeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 volumeEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 volumeEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 volumeEdit->setDecimals(1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 volumeEdit->setMaximum(100000.000000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 volumeEdit->setSuffix(tr(" L"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 boilvolumeEdit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 boilvolumeEdit->setObjectName(QString::fromUtf8("boilvolumeEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 boilvolumeEdit->setGeometry(QRect(260, 60, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 boilvolumeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 boilvolumeEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 boilvolumeEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 boilvolumeEdit->setDecimals(1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 boilvolumeEdit->setMaximum(100000.000000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 boilvolumeEdit->setSuffix(tr(" L"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 efficiencyEdit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 efficiencyEdit->setObjectName(QString::fromUtf8("efficiencyEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 efficiencyEdit->setGeometry(QRect(260, 120, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 efficiencyEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 efficiencyEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 efficiencyEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 efficiencyEdit->setDecimals(1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 efficiencyEdit->setMaximum(100.000000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 efficiencyEdit->setSuffix(tr(" %"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 ogEdit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 ogEdit->setObjectName(QString::fromUtf8("ogEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 ogEdit->setGeometry(QRect(260, 150, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 ogEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 ogEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 ogEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 ogEdit->setDecimals(3);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 ogEdit->setMaximum(1.200000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 fgEdit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 fgEdit->setObjectName(QString::fromUtf8("fgEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 fgEdit->setGeometry(QRect(260, 180, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 fgEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 fgEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 fgEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 fgEdit->setDecimals(3);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 fgEdit->setMaximum(1.200000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 abvEdit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 abvEdit->setObjectName(QString::fromUtf8("abvEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 abvEdit->setGeometry(QRect(260, 210, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 abvEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 abvEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 abvEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 abvEdit->setDecimals(1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 abvEdit->setMaximum(100.000000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 abvEdit->setSuffix(tr(" %"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 co2Edit = new QDoubleSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 co2Edit->setObjectName(QString::fromUtf8("co2Edit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 co2Edit->setGeometry(QRect(260, 240, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 co2Edit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 co2Edit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171 co2Edit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 co2Edit->setDecimals(2);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 co2Edit->setMaximum(100.000000000000000);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 boiltimeEdit = new QSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 boiltimeEdit->setObjectName(QString::fromUtf8("boiltimeEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 boiltimeEdit->setGeometry(QRect(260, 90, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 boiltimeEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 boiltimeEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 boiltimeEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 boiltimeEdit->setMaximum(1440);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181 boiltimeEdit->setSuffix(tr(" min"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 colorEdit = new QSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 colorEdit->setObjectName(QString::fromUtf8("colorEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 colorEdit->setGeometry(QRect(260, 270, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 colorEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 colorEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 colorEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 colorEdit->setMaximum(1440);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189 ibuEdit = new QSpinBox(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 ibuEdit->setObjectName(QString::fromUtf8("ibuEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 ibuEdit->setGeometry(QRect(260, 330, 111, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 ibuEdit->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 ibuEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 ibuEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195 ibuEdit->setMaximum(1440);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 remarksEdit = new QPlainTextEdit(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 remarksEdit->setObjectName(QString::fromUtf8("remarksEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 remarksEdit->setGeometry(QRect(30, 410, 441, 111));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 remarksEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 colormethodEdit = new QLineEdit(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201 colormethodEdit->setObjectName(QString::fromUtf8("colormethodEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 colormethodEdit->setGeometry(QRect(260, 300, 113, 23));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 colormethodEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 ibumethodEdit = new QLineEdit(recipeBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 ibumethodEdit->setObjectName(QString::fromUtf8("ibumethodEdit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 ibumethodEdit->setGeometry(QRect(260, 360, 113, 23));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 ibumethodEdit->setReadOnly(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209 gridLayout->addWidget(recipeBox, 0, 1, 2, 1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 groupBox = new QGroupBox(this);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 groupBox->setObjectName(QString::fromUtf8("groupBox"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 groupBox->setEnabled(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 groupBox->setFlat(false);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 horizontalLayout = new QHBoxLayout(groupBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 horizontalLayout->setSpacing(6);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 horizontalLayout->setContentsMargins(0, 0, 0, 0);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 quitButton = new QPushButton(groupBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 quitButton->setObjectName(QString::fromUtf8("quitButton"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222 quitButton->setMinimumSize(QSize(80, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 quitButton->setText(tr("Quit"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 QIcon icon;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 icon.addFile(QString::fromUtf8(":icons/silk/door_out.png"), QSize(), QIcon::Normal, QIcon::Off);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 quitButton->setIcon(icon);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 horizontalLayout->addWidget(quitButton, 0, Qt::AlignLeft);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 openButton = new QPushButton(groupBox);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 openButton->setObjectName(QString::fromUtf8("openButton"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231 openButton->setMinimumSize(QSize(80, 24));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 openButton->setText(tr("Open"));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 QIcon icon1;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 icon1.addFile(QString::fromUtf8(":icons/silk/cup_go.png"), QSize(), QIcon::Normal, QIcon::Off);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 openButton->setIcon(icon1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 horizontalLayout->addWidget(openButton, 0, Qt::AlignRight);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 gridLayout->addWidget(groupBox, 1, 0, 1, 1);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 record = -2;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 connect(quitButton, SIGNAL(clicked()), parent, SLOT(fromProdOnTree()));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 connect(openButton, SIGNAL(clicked()), this, SLOT(on_openButton_clicked()));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243 connect(this, SIGNAL(setStatus(QString)), parent, SLOT(statusMsg(QString)));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
245 treeWidget->setColumnCount(5);
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
246 treeWidget->setHeaderLabels({ tr("Guide"), tr("Group"), tr("Style"), tr("Code"), tr("Product") });
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 treeWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(on_item_clicked(QTreeWidgetItem*, int)));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 connect(treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_item_doubleclicked(QTreeWidgetItem*, int)));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 emit refreshTable();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 void ProdOnTree::refreshTable()
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 QTreeWidgetItem *st_guide, *st_group, *st_name, *name;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261 qDebug() << "ProdOnTree reload";
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 treeWidget->clear();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 QSqlQuery query0;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 query0.prepare("SELECT DISTINCT st_guide FROM products WHERE stage='11' ORDER BY st_guide");
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267 query0.exec();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 while (query0.next()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 st_guide = new QTreeWidgetItem( QStringList( { query0.value(0).toString() } ));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 treeWidget->addTopLevelItem( st_guide );
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 st_guide->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273 QSqlQuery query1;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 query1.prepare("SELECT DISTINCT st_letter FROM products WHERE stage='11' AND st_guide=:guide ORDER BY st_letter");
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 query1.bindValue(":guide", query0.value(0).toString());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 query1.exec();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 while (query1.next()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 st_group = new QTreeWidgetItem(QStringList({ "", query1.value(0).toString() }));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 st_group->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 st_guide->addChild( st_group );
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 QSqlQuery query2;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 query2.prepare("SELECT DISTINCT st_name FROM products WHERE stage='11' AND st_guide=:guide AND st_letter=:group ORDER BY st_name");
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 query2.bindValue(":guide", query0.value(0).toString());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 query2.bindValue(":group", query1.value(0).toString());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 query2.exec();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 while (query2.next()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 st_name = new QTreeWidgetItem(QStringList({ "", "", query2.value(0).toString() }));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 st_name->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290 st_group->addChild( st_name );
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 QSqlQuery query3;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 query3.prepare("SELECT name,record,code FROM products WHERE stage='11' AND st_guide=:guide AND st_letter=:group AND st_name=:name "
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 "ORDER BY code,name");
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 query3.bindValue(":guide", query0.value(0).toString());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 query3.bindValue(":group", query1.value(0).toString());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 query3.bindValue(":name", query2.value(0).toString());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 query3.exec();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 while (query3.next()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 name = new QTreeWidgetItem(QStringList({ "", "", "",
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
301 query3.value(2).toString(), query3.value(0).toString(), query3.value(1).toString() }));
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 st_name->addChild( name );
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 treeWidget->expandItem(st_group);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 treeWidget->expandItem(st_guide);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 QSqlQuery query("SELECT record FROM products WHERE stage='11'");
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 emit setStatus(QString(tr("Total items: %1")).arg(query.size()));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 showRecipe();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 void ProdOnTree::showRecipe()
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 QString w;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 qDebug() << "showRecipe" << record;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 const QStringList c_method({"Morey", "Mosher", "Daniels", "Halberstadt", "Naudts" });
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 /*
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 * If no recipe is "pre" selected, return.
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 */
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 if (record < 1) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 recipeBox->setEnabled(false);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 return;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 /*
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 * Fill in basic details of the selected recipe.
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 */
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 QSqlQuery query;
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
337 query.prepare("SELECT batch_size,boil_size,boil_time,efficiency,est_og,est_fg,est_abv,est_color,color_method,est_ibu,ibu_method,est_carb,notes,name,code "
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 "FROM products WHERE record=:record");
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 query.bindValue(":record", record);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 query.exec();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 if (query.size() == 1) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 query.first();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 volumeEdit->setValue(query.value(0).toDouble());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 boilvolumeEdit->setValue(query.value(1).toDouble());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 boiltimeEdit->setValue(query.value(2).toInt());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 efficiencyEdit->setValue(query.value(3).toDouble());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 ogEdit->setValue(query.value(4).toDouble());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 fgEdit->setValue(query.value(5).toDouble());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 abvEdit->setValue(query.value(6).toInt());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 colorEdit->setValue(query.value(7).toInt());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 colorEdit->setStyleSheet(Utils::ebc_to_style(query.value(7).toInt()));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 colormethodEdit->setText(c_method[query.value(8).toInt()]);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 ibuEdit->setValue(query.value(9).toInt());
336
e97f9e87d94b IBU method names are now global.
Michiel Broek <mbroek@mbse.eu>
parents: 234
diff changeset
354 ibumethodEdit->setText(g_ibu_method[query.value(10).toInt()]);
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 co2Edit->setValue(query.value(11).toDouble());
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 remarksEdit->setPlainText(query.value(12).toString());
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
357 recipeBox->setTitle(query.value(14).toString() + " - " + query.value(13).toString());
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 recipeBox->setEnabled(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359 } else {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 qDebug() << "Error getting product record" << record;
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 ProdOnTree::~ProdOnTree() {}
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 void ProdOnTree::edit(int recno)
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369 {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 EditProduct dialog(recno, this);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 /* Signal from editor if a refresh is needed */
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 connect(&dialog, SIGNAL(entry_changed()), this, SLOT(refreshTable()));
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 dialog.setModal(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 dialog.exec();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 void ProdOnTree::on_openButton_clicked()
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 if (record > 0)
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 edit(record);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 void ProdOnTree::on_item_clicked(QTreeWidgetItem *item, int col)
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386 {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 record = -2; // Invalid
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 if (col == 0) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 if (item->isExpanded()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 treeWidget->collapseItem(item);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 } else {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 treeWidget->expandItem(item);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 } else if (col == 1) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 if (item->isExpanded()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 treeWidget->collapseItem(item);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398 } else {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 treeWidget->expandItem(item);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 } else if (col == 2 && item->text(2).length()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 if (item->isExpanded()) {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 item->setExpanded(false);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 } else {
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 item->setExpanded(true);
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 }
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
407 } else if ((col == 3) || (col == 4)) {
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408 /*
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 * if a recipe name is selected then:
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
410 * item column 3 contains the product code,
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
411 * item column 4 contains the product name,
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
412 * item column 5 contains the product record number.
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413 */
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
414 if (item->text(5).toInt() > 0) {
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
415 if (record != item->text(5).toInt()) {
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
416 record = item->text(5).toInt();
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 showRecipe();
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424 void ProdOnTree::on_item_doubleclicked(QTreeWidgetItem *item, int col)
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425 {
234
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
426 if (((col == 3) || (col == 4)) && (item->text(5).toInt() > 0)) {
51aea8b798f0 Add product archive tree by date.
Michiel Broek <mbroek@mbse.eu>
parents: 232
diff changeset
427 edit(item->text(5).toInt());
232
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 }
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430
6d3ba9c44f95 Added the product archives tree by styles.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431

mercurial