The table screen is more or less complete.

Sun, 13 Feb 2022 17:24:55 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 13 Feb 2022 17:24:55 +0100
changeset 8
ac4e363c09a7
parent 7
51fbea52551e
child 9
85656dc48131

The table screen is more or less complete.

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 15:15:03 2022 +0100
+++ b/src/InventorySuppliers.cpp	Sun Feb 13 17:24:55 2022 +0100
@@ -20,6 +20,7 @@
 
 #include <QDebug>
 #include <QtSql>
+#include <QtWidgets>
 #include <QTableWidget>
 
 
@@ -40,7 +41,7 @@
     ui->tableSuppliers->setColumnWidth(3, 200);	/* City		*/
     ui->tableSuppliers->setColumnWidth(4, 120);	/* Country	*/
     ui->tableSuppliers->setColumnWidth(5, 120);	/* Phone	*/
-    ui->tableSuppliers->setColumnWidth(6, 150);	/* Edit button	*/
+    ui->tableSuppliers->setColumnWidth(6, 90);	/* Edit button	*/
     ui->tableSuppliers->setRowCount(query.size());
     ui->tableSuppliers->setHorizontalHeaderLabels(labels);
     ui->tableSuppliers->verticalHeader()->hide();
@@ -58,6 +59,16 @@
 	ui->tableSuppliers->setItem(ridx, 4, item );
 	item = new QTableWidgetItem(query.value(8).toString());
         ui->tableSuppliers->setItem(ridx, 5, item );
+	/* Add the Edit button */
+	QWidget* pWidget = new QWidget();
+	QPushButton* btn_edit = new QPushButton();
+	btn_edit->setText(tr("Edit"));
+	QHBoxLayout* pLayout = new QHBoxLayout(pWidget);
+	pLayout->addWidget(btn_edit);
+	pLayout->setAlignment(Qt::AlignCenter);
+	pLayout->setContentsMargins(0, 0, 0, 0);
+	pWidget->setLayout(pLayout);
+	ui->tableSuppliers->setCellWidget(ridx, 6, pWidget);
 	query.next();
     }
 
@@ -71,6 +82,12 @@
 }
 
 
+void InventorySuppliers::on_insertButton_clicked()
+{
+    qDebug() << Q_FUNC_INFO;
+}
+
+
 void InventorySuppliers::on_changeButton_clicked()
 {
     qDebug() << Q_FUNC_INFO;
--- a/src/InventorySuppliers.h	Sun Feb 13 15:15:03 2022 +0100
+++ b/src/InventorySuppliers.h	Sun Feb 13 17:24:55 2022 +0100
@@ -20,6 +20,7 @@
 
 private slots:
     void on_changeButton_clicked();
+    void on_insertButton_clicked();
 
 private:
     Ui::InventorySuppliers *ui;
--- a/ui/InventorySuppliers.ui	Sun Feb 13 15:15:03 2022 +0100
+++ b/ui/InventorySuppliers.ui	Sun Feb 13 17:24:55 2022 +0100
@@ -13,59 +13,68 @@
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
     <widget class="QTableWidget" name="tableSuppliers">
      <property name="enabled">
       <bool>true</bool>
      </property>
     </widget>
    </item>
-   <item>
-    <widget class="QDialogButtonBox" name="changeButton">
+   <item row="2" column="0">
+    <widget class="QGroupBox" name="groupBox">
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="spacing">
+       <number>6</number>
+      </property>
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>0</number>
+      </property>
+      <item alignment="Qt::AlignLeft">
+       <widget class="QPushButton" name="changeButton">
+        <property name="text">
+         <string>Quit</string>
+        </property>
+        <property name="icon">
+         <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+          <normaloff>:/icons/silk/icons/silk/door_out.png</normaloff>:/icons/silk/icons/silk/door_out.png</iconset>
+        </property>
+       </widget>
+      </item>
+      <item alignment="Qt::AlignRight">
+       <widget class="QPushButton" name="insertButton">
+        <property name="text">
+         <string>New</string>
+        </property>
+        <property name="icon">
+         <iconset resource="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc">
+          <normaloff>:/icons/silk/icons/silk/table_row_insert.png</normaloff>:/icons/silk/icons/silk/table_row_insert.png</iconset>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="Line" name="line">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
-     <property name="standardButtons">
-      <set>QDialogButtonBox::Ok</set>
-     </property>
     </widget>
    </item>
   </layout>
  </widget>
- <resources/>
- <connections>
-  <connection>
-   <sender>changeButton</sender>
-   <signal>accepted()</signal>
-   <receiver>InventorySuppliers</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>changeButton</sender>
-   <signal>rejected()</signal>
-   <receiver>InventorySuppliers</receiver>
-   <slot>reject()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>286</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <resources>
+  <include location="../../../../../../home/mbroek/MyProjects/bmsapp/resources/icons.qrc"/>
+ </resources>
+ <connections/>
 </ui>

mercurial