diff options
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 24 |
1 files changed, 12 insertions, 12 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); } |