The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.

Sun, 13 Feb 2022 20:24:33 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 13 Feb 2022 20:24:33 +0100
changeset 9
85656dc48131
parent 8
ac4e363c09a7
child 10
8aa2bd9ba9e8

The Edit buttons include the record number in the database. Ready to build the modal supplier edit/insert/delete screen.

src/InventorySuppliers.cpp file | annotate | diff | comparison | revisions
src/InventorySuppliers.h file | annotate | diff | comparison | revisions
ui/InventorySuppliers.ui file | annotate | diff | comparison | revisions
--- 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>

mercurial