diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 24 | ||||
-rw-r--r-- | src/application.h | 2 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/application.cpp b/src/application.cpp index 4f1b623b..7004a901 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -333,7 +333,7 @@ TabWindow *Application::newTabWindow() // set object name int n = m_tabWindows.count() + 1; w->setObjectName( QL1S("win") + QString::number(n) ); - + // This is used to track which window was activated most recently w->installEventFilter(this); @@ -344,17 +344,6 @@ TabWindow *Application::newTabWindow() } -void Application::removeTabWindow(TabWindow *window) -{ - m_tabWindows.removeOne(window); - kDebug() << "Removing Window from app window list..."; - - // bye bye... - if (m_tabWindows.count() == 0) - quit(); -} - - TabWindowList Application::tabWindowList() { return m_tabWindows; @@ -379,6 +368,17 @@ bool Application::eventFilter(QObject* watched, QEvent* event) } } + // As we are filtering the events occurred to the tabwindows, check also + // when we close one of them, remove from tab window list and check if it was last... + if (event->type() == QEvent::Close) + { + TabWindow *window = qobject_cast<TabWindow*>(watched); + m_tabWindows.removeOne(window); + + if (m_tabWindows.count() == 0) + quit(); + } + return QObject::eventFilter(watched, event); } diff --git a/src/application.h b/src/application.h index 4934540e..c9ad7376 100644 --- a/src/application.h +++ b/src/application.h @@ -88,8 +88,6 @@ public Q_SLOTS: TabWindow *newTabWindow(); - void removeTabWindow(TabWindow *window); - protected: // This is used to track which window was activated most recently bool eventFilter(QObject *watched, QEvent *event); |