Sat, 19 Mar 2022 19:22:58 +0100
First step in loading the Inventory Suppliers database on the mainscreen. But, it is loaded at program start en not removed when done. Weird programming to get this working.
src/InventorySuppliers.cpp | file | annotate | diff | comparison | revisions | |
src/MainWindow.cpp | file | annotate | diff | comparison | revisions | |
src/bmsapp.h | file | annotate | diff | comparison | revisions | |
ui/MainWindow.ui | file | annotate | diff | comparison | revisions |
--- a/src/InventorySuppliers.cpp Sat Mar 19 10:30:56 2022 +0100 +++ b/src/InventorySuppliers.cpp Sat Mar 19 19:22:58 2022 +0100 @@ -16,6 +16,7 @@ */ #include "InventorySuppliers.h" #include "EditSupplier.h" +#include "MainWindow.h" #include "../ui/ui_InventorySuppliers.h" #include "config.h" #include "bmsapp.h" @@ -28,8 +29,6 @@ ui->setupUi(this); emit refreshTable(); - - setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING) ); } @@ -73,15 +72,13 @@ ui->tableSuppliers->setCellWidget(ridx, 5, pWidget); query.next(); } - - setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING) ); } InventorySuppliers::~InventorySuppliers() { qDebug() << "InventorySuppliers done"; - delete ui; +// delete ui; } @@ -115,6 +112,9 @@ void InventorySuppliers::on_quitButton_clicked() { - emit firstWindow(); + qDebug() << Q_FUNC_INFO; + + MainWindow a; + a.fromInventorySuppliers(); }
--- a/src/MainWindow.cpp Sat Mar 19 10:30:56 2022 +0100 +++ b/src/MainWindow.cpp Sat Mar 19 19:22:58 2022 +0100 @@ -65,8 +65,10 @@ void MainWindow::fromInventorySuppliers() { qDebug() << Q_FUNC_INFO; - delete InventorySuppliersWindow; - this->show(); +// delete InventorySuppliersWindow; + ui->mainStack->setCurrentIndex(0); + setWindowTitle( QString("BMSapp - %1").arg(VERSIONSTRING) ); + qDebug() << "fromInventorySuppliers() done"; } @@ -74,9 +76,11 @@ { qDebug() << Q_FUNC_INFO; InventorySuppliersWindow = new InventorySuppliers(this); - QObject::connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers())); - this->hide(); // Close the main window - InventorySuppliersWindow->show(); // Show a second window +// QObject::connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers())); + qDebug() << ui->mainStack->count(); + ui->mainStack->setCurrentIndex(1); +// connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers())); + setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING)); }
--- a/src/bmsapp.h Sat Mar 19 10:30:56 2022 +0100 +++ b/src/bmsapp.h Sat Mar 19 19:22:58 2022 +0100 @@ -75,8 +75,10 @@ */ static int run(bool useDevelop, bool startConfig); + MainWindow* m_mainWindow; + private: - static MainWindow* m_mainWindow; + /*static MainWindow* m_mainWindow;*/ /** * @brief Ensure some directories and files exist.
--- a/ui/MainWindow.ui Sat Mar 19 10:30:56 2022 +0100 +++ b/ui/MainWindow.ui Sat Mar 19 19:22:58 2022 +0100 @@ -25,6 +25,8 @@ <property name="focusPolicy"> <enum>Qt::NoFocus</enum> </property> + <widget class="QWidget" name="page"/> + <widget class="InventorySuppliers" name="pageIS"/> </widget> </item> </layout> @@ -349,6 +351,14 @@ </action> </widget> <layoutdefault spacing="6" margin="11"/> + <customwidgets> + <customwidget> + <class>InventorySuppliers</class> + <extends>QWidget</extends> + <header>InventorySuppliers.h</header> + <container>1</container> + </customwidget> + </customwidgets> <resources> <include location="../resources/icons.qrc"/> </resources>