# HG changeset patch # User Michiel Broek # Date 1644769495 -3600 # Node ID ac4e363c09a7ad0fc34f634397ec0c707e01e984 # Parent 51fbea52551e7ba58767e2073de8488f9db2e8f1 The table screen is more or less complete. diff -r 51fbea52551e -r ac4e363c09a7 src/InventorySuppliers.cpp --- 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 #include +#include #include @@ -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; diff -r 51fbea52551e -r ac4e363c09a7 src/InventorySuppliers.h --- 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; diff -r 51fbea52551e -r ac4e363c09a7 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 @@ Dialog - - + + true - - + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Quit + + + + :/icons/silk/icons/silk/door_out.png:/icons/silk/icons/silk/door_out.png + + + + + + + New + + + + :/icons/silk/icons/silk/table_row_insert.png:/icons/silk/icons/silk/table_row_insert.png + + + + + + + + Qt::Horizontal - - QDialogButtonBox::Ok - - - - - changeButton - accepted() - InventorySuppliers - accept() - - - 248 - 254 - - - 157 - 274 - - - - - changeButton - rejected() - InventorySuppliers - reject() - - - 316 - 260 - - - 286 - 274 - - - - + + + +