diff options
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 7 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index e16f34f..c54c8e3 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -177,10 +177,14 @@ void MainWindow::setCurrentSubWindow(SubWindow *subwindow) setWindowTitle(QString("[%1] - %2").arg(subwindow->windowTitle(), defaultWindowTitle)); // connect signlas + disconnect(windowTitleConnection); disconnect(viewChangedConnection); disconnect(statusBarConnection); setView(subwindow->currentView()); + windowTitleConnection = connect(subwindow, &SubWindow::windowTitleChanged, this, [this](const QString &title) { + setWindowTitle(QString("[%1] - %2").arg(title, defaultWindowTitle)); + }); viewChangedConnection = connect(subwindow, &SubWindow::currentViewChanged, this, &MainWindow::setView); statusBarConnection = connect(subwindow, &SubWindow::showStatusMessage, statusBar(), &QStatusBar::showMessage); } @@ -201,5 +205,8 @@ void MainWindow::closeEvent(QCloseEvent *event) return; } } + disconnect(windowTitleConnection); + disconnect(viewChangedConnection); + disconnect(statusBarConnection); event->accept(); } diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h index 2b9f82b..bec2cdd 100644 --- a/src/mainwindow/mainwindow.h +++ b/src/mainwindow/mainwindow.h @@ -86,6 +86,7 @@ private: QVector<SubWindow *> m_subwindows; + QMetaObject::Connection windowTitleConnection; QMetaObject::Connection viewChangedConnection; QMetaObject::Connection statusBarConnection; }; |