diff -r b0d30697af67 -r 2ef981980daa src/MainWindow.cpp --- a/src/MainWindow.cpp Sat Mar 19 19:22:58 2022 +0100 +++ b/src/MainWindow.cpp Sat Mar 19 22:59:11 2022 +0100 @@ -37,6 +37,9 @@ #include #include #include +#include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -65,8 +68,11 @@ void MainWindow::fromInventorySuppliers() { qDebug() << Q_FUNC_INFO; -// delete InventorySuppliersWindow; - ui->mainStack->setCurrentIndex(0); + qDebug() << "fromInventorySuppliers() start"; + ui->mainStack->setCurrentIndex(-1); + ui->mainStack->removeWidget(InventorySuppliersWindow); + qDebug() << ui->mainStack->count(); + delete InventorySuppliersWindow; setWindowTitle( QString("BMSapp - %1").arg(VERSIONSTRING) ); qDebug() << "fromInventorySuppliers() done"; } @@ -75,11 +81,11 @@ void MainWindow::on_actionSuppliers_triggered() { qDebug() << Q_FUNC_INFO; + InventorySuppliersWindow = new InventorySuppliers(this); -// QObject::connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers())); + ui->mainStack->addWidget(InventorySuppliersWindow); qDebug() << ui->mainStack->count(); - ui->mainStack->setCurrentIndex(1); -// connect(InventorySuppliersWindow, SIGNAL(firstWindow()), this, SLOT(fromInventorySuppliers())); + ui->mainStack->setCurrentIndex(2); setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING)); }