src/InventorySuppliers.cpp

Mon, 14 Feb 2022 20:58:07 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 14 Feb 2022 20:58:07 +0100
changeset 10
8aa2bd9ba9e8
parent 9
85656dc48131
child 11
c9cdc15d3caf
permissions
-rw-r--r--

Added the EditSupplier popup window. It is now ready to validate the form data.

6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * InventorySuppliers.cpp is part of bmsapp.
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "InventorySuppliers.h"
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
18 #include "EditSupplier.h"
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "../ui/ui_InventorySuppliers.h"
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 #include "config.h"
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
21 #include "bmsapp.h"
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #include <QDebug>
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #include <QtSql>
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
25 #include <QtWidgets>
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include <QTableWidget>
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
29
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
30
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
31
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 InventorySuppliers::InventorySuppliers(QWidget *parent) : QDialog(parent), ui(new Ui::InventorySuppliers)
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 {
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 qDebug() << Q_FUNC_INFO;
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
36 ui->setupUi(this);
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
37 InventorySuppliers::loadTable();
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
38
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
39 setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING) );
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
40 }
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
41
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
42
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
43 void InventorySuppliers::loadTable(void)
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
44 {
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
45 ui->tableSuppliers = new QTableWidget(ui->tableSuppliers);
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 QSqlQuery query("SELECT * FROM inventory_suppliers ORDER BY name");
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
47 const QStringList labels({tr("Record"), tr("Name"), tr("Address"), tr("City"), tr("Country"), tr("Phone"), tr("Edit")});
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
49 ui->tableSuppliers->setColumnCount(7);
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
50 ui->tableSuppliers->setColumnWidth(0, 50); /* Record */
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
51 ui->tableSuppliers->setColumnWidth(1, 250); /* Name */
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
52 ui->tableSuppliers->setColumnWidth(2, 250); /* Address */
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
53 ui->tableSuppliers->setColumnWidth(3, 200); /* City */
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
54 ui->tableSuppliers->setColumnWidth(4, 120); /* Country */
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
55 ui->tableSuppliers->setColumnWidth(5, 120); /* Phone */
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
56 ui->tableSuppliers->setColumnWidth(6, 90); /* Edit button */
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
57 ui->tableSuppliers->setRowCount(query.size());
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
58 ui->tableSuppliers->setHorizontalHeaderLabels(labels);
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
59 ui->tableSuppliers->verticalHeader()->hide();
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
60 ui->tableSuppliers->setFixedSize(1280, 640); /* Even if this is too large, it works */
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 qDebug() << query.record().count() << query.size();
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 // So far, so good.
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 query.first();
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 for (int ridx = 0 ; ridx < query.size() ; ridx++ ) {
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
66 for (int cidx = 0 ; cidx < 4; cidx++) {
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 QTableWidgetItem* item = new QTableWidgetItem(query.value(cidx).toString());
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
68 ui->tableSuppliers->setItem(ridx, cidx, item );
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 }
7
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
70 QTableWidgetItem* item = new QTableWidgetItem(query.value(5).toString());
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
71 ui->tableSuppliers->setItem(ridx, 4, item );
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
72 item = new QTableWidgetItem(query.value(8).toString());
51fbea52551e The suppliers table now shows on the right screen.
Michiel Broek <mbroek@mbse.eu>
parents: 6
diff changeset
73 ui->tableSuppliers->setItem(ridx, 5, item );
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
74 /* Add the Edit button */
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
75 QWidget* pWidget = new QWidget();
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
76 QPushButton* btn_edit = new QPushButton();
9
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
77 btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
78 btn_edit->setText(tr("Edit"));
9
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
79 connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked()));
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
80 QHBoxLayout* pLayout = new QHBoxLayout(pWidget);
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
81 pLayout->addWidget(btn_edit);
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
82 pLayout->setAlignment(Qt::AlignCenter);
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
83 pLayout->setContentsMargins(0, 0, 0, 0);
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
84 pWidget->setLayout(pLayout);
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
85 ui->tableSuppliers->setCellWidget(ridx, 6, pWidget);
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 query.next();
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 }
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING) );
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 }
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91
9
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
92
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 InventorySuppliers::~InventorySuppliers()
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 {
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 qDebug() << Q_FUNC_INFO;
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 delete ui;
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 }
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
100 bool InventorySuppliers::edit(int recno)
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
101 {
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
102 qDebug() << Q_FUNC_INFO << recno;
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
103
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
104 EditSupplier dialog(recno, this);
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
105 dialog.setModal(true);
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
106 int rc = dialog.exec(); /* rc 0 == cancel, rc 1 == ok */
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
107
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
108 qDebug() << Q_FUNC_INFO << recno << rc;
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
109 return false;
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
110 }
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
111
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
112
9
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
113 void InventorySuppliers::on_editButton_clicked()
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
114 {
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
115 QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
116 int recno = pb->objectName().toInt();
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
117 qDebug() << Q_FUNC_INFO << recno;
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
118 edit(recno);
9
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
119 }
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
120
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
121
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
122 void InventorySuppliers::on_insertButton_clicked()
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
123 {
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
124 qDebug() << Q_FUNC_INFO;
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents: 9
diff changeset
125 edit(-1);
8
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
126 }
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
127
ac4e363c09a7 The table screen is more or less complete.
Michiel Broek <mbroek@mbse.eu>
parents: 7
diff changeset
128
9
85656dc48131 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
Michiel Broek <mbroek@mbse.eu>
parents: 8
diff changeset
129 void InventorySuppliers::on_quitButton_clicked()
6
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 {
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 qDebug() << Q_FUNC_INFO;
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 emit firstWindow();
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 }
f8474f2c5db9 We can fetch a list of suppliers and show it in the wrong window. Still a lot to learn about Qt5
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134

mercurial