# HG changeset patch # User Michiel Broek # Date 1644780273 -3600 # Node ID 85656dc481314bbd86fe96c617e45e93ec90bfd5 # Parent ac4e363c09a7ad0fc34f634397ec0c707e01e984 The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen. diff -r ac4e363c09a7 -r 85656dc48131 src/InventorySuppliers.cpp --- 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(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(); diff -r ac4e363c09a7 -r 85656dc48131 src/InventorySuppliers.h --- 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; diff -r ac4e363c09a7 -r 85656dc48131 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 @@ 0 - + Quit