Sun, 13 Feb 2022 20:24:33 +0100
The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.
--- a/src/InventorySuppliers.cpp Sun Feb 13 17:24:55 2022 +0100 +++ b/src/InventorySuppliers.cpp Sun Feb 13 20:24:33 2022 +0100 @@ -62,7 +62,9 @@ /* Add the Edit button */ QWidget* pWidget = new QWidget(); QPushButton* btn_edit = new QPushButton(); + btn_edit->setObjectName(QString("%1").arg(query.value(0).toString())); /* Send record with the button */ btn_edit->setText(tr("Edit")); + connect(btn_edit, SIGNAL(clicked()), this, SLOT(on_editButton_clicked())); QHBoxLayout* pLayout = new QHBoxLayout(pWidget); pLayout->addWidget(btn_edit); pLayout->setAlignment(Qt::AlignCenter); @@ -75,6 +77,7 @@ setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING) ); } + InventorySuppliers::~InventorySuppliers() { qDebug() << Q_FUNC_INFO; @@ -82,13 +85,25 @@ } +void InventorySuppliers::on_editButton_clicked() +{ + QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender()); + int recno = pb->objectName().toInt(); + qDebug() << Q_FUNC_INFO << recno; + + // Call editor with recno +} + + void InventorySuppliers::on_insertButton_clicked() { qDebug() << Q_FUNC_INFO; + + // Call editor with -1 } -void InventorySuppliers::on_changeButton_clicked() +void InventorySuppliers::on_quitButton_clicked() { qDebug() << Q_FUNC_INFO; emit firstWindow();
--- a/src/InventorySuppliers.h Sun Feb 13 17:24:55 2022 +0100 +++ b/src/InventorySuppliers.h Sun Feb 13 20:24:33 2022 +0100 @@ -19,8 +19,9 @@ void firstWindow(); private slots: - void on_changeButton_clicked(); + void on_quitButton_clicked(); void on_insertButton_clicked(); + void on_editButton_clicked(); private: Ui::InventorySuppliers *ui;
--- a/ui/InventorySuppliers.ui Sun Feb 13 17:24:55 2022 +0100 +++ b/ui/InventorySuppliers.ui Sun Feb 13 20:24:33 2022 +0100 @@ -40,7 +40,7 @@ <number>0</number> </property> <item alignment="Qt::AlignLeft"> - <widget class="QPushButton" name="changeButton"> + <widget class="QPushButton" name="quitButton"> <property name="text"> <string>Quit</string> </property>