diff options
author | Daniel Jones <admin@danieljon.es> | 2019-04-08 16:45:24 +0930 |
---|---|---|
committer | Daniel Jones <admin@danieljon.es> | 2019-04-08 16:45:24 +0930 |
commit | d977c34d53a2d11b2d0f912e303c27c8af64a4cb (patch) | |
tree | 518c74754dfbcb86a2625dc43da53bc4f4710dfa /productinventory.cpp | |
parent | e38858efb7c8904352f9c4c1dea403b53a7a99f4 (diff) | |
download | productinventory-d977c34d53a2d11b2d0f912e303c27c8af64a4cb.tar.gz productinventory-d977c34d53a2d11b2d0f912e303c27c8af64a4cb.zip |
database changes, lots of core work
Diffstat (limited to 'productinventory.cpp')
-rw-r--r-- | productinventory.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/productinventory.cpp b/productinventory.cpp index 6b26aa0..5842a81 100644 --- a/productinventory.cpp +++ b/productinventory.cpp @@ -45,6 +45,12 @@ ProductInventory::ProductInventory(QWidget *parent) : headerLabels.append(QString("Brand")); headerLabels.append(QString("Color")); headerLabels.append(QString("Comment")); + headerLabels.append(QString("Images")); + headerLabels.append(QString("Date added")); + createTable("Connect to the database to populate the tables"); + + categoryLayout = new QGridLayout; + ui->filterCategoryScrollArea->setLayout(categoryLayout); } /*! @@ -53,6 +59,7 @@ ProductInventory::ProductInventory(QWidget *parent) : ProductInventory::~ProductInventory() { clearTables(); + delete categoryLayout; delete ui; } @@ -140,11 +147,7 @@ ProductInventory::resizeEvent(QResizeEvent* event) { QMainWindow::resizeEvent(event); ui->tableWidget->resizeRowsToContents(); // not needed? - QList<QTableWidget *>::iterator i; - for (i = tables.begin(); i != tables.end(); i++) - { - (*i)->resizeRowsToContents(); - } + resizeRows(); } void ProductInventory::on_mustHaveImagesCheckBox_clicked() @@ -199,7 +202,16 @@ ProductInventory::clearTables() { (*l)->hide(); labels.erase(l); + delete *l; } + + QList<QCheckBox *>::iterator c; + for (c = checkboxes.begin(); c != checkboxes.end(); c++) + { + checkboxes.erase(c); + delete *c; + } + } /*! @@ -213,7 +225,7 @@ ProductInventory::createTable(QString category) if (table == nullptr) return -1; table->setMinimumHeight(100); - table->setColumnCount(3); + table->setColumnCount(headerLabels.size()); table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); table->setHorizontalHeaderLabels(headerLabels); table->verticalHeader()->hide(); @@ -228,3 +240,16 @@ ProductInventory::createTable(QString category) tables.append(table); return tables.size()-1; } + +/*! + * resize each row in every table to fit its content + */ +void +ProductInventory::resizeRows() +{ + QList<QTableWidget *>::iterator i; + for (i = tables.begin(); i != tables.end(); i++) + { + (*i)->resizeRowsToContents(); + } +} |