src/MainWindow.cpp

changeset 68
abac28effb21
parent 66
72386c164f54
child 69
228cb2a01acf
--- a/src/MainWindow.cpp	Sun Mar 20 14:08:05 2022 +0100
+++ b/src/MainWindow.cpp	Sun Mar 20 15:51:09 2022 +0100
@@ -92,18 +92,24 @@
 void MainWindow::fromInventoryFermentables()
 {
     qDebug() << Q_FUNC_INFO;
+    ui->mainStack->setCurrentIndex(-1);
+    ui->mainStack->removeWidget(InventoryFermentablesWindow);
     delete InventoryFermentablesWindow;
-    this->show();
+    setWindowTitle( QString("BMSapp - %1").arg(VERSIONSTRING) );
+    ui->menuBar->setVisible(true);
 }
 
 
 void MainWindow::on_actionFermentables_triggered()
 {
     qDebug() << Q_FUNC_INFO;
+
     InventoryFermentablesWindow = new InventoryFermentables(this);
-    QObject::connect(InventoryFermentablesWindow, SIGNAL(firstWindow()), this, SLOT(fromInventoryFermentables()));
-    this->hide();    // Close the main window
-    InventoryFermentablesWindow->show();  // Show a second window
+    int index = ui->mainStack->count();
+    ui->mainStack->addWidget(InventoryFermentablesWindow);
+    ui->mainStack->setCurrentIndex(index);
+    setWindowTitle(QString("BMSapp - %1 - Inventory Fermentables").arg(VERSIONSTRING));
+    ui->menuBar->setVisible(false);
 }
 
 

mercurial