From c9bc4176359a3bfbb4b5f95e27b1c5c8e8c9186b Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Thu, 7 Aug 2014 22:25:03 +0100 Subject: [PATCH] remove global QApplication *application .. it is available from the macro qApp anyway. --- src/HomeWindow.cpp | 3 ++- src/HomeWindow.h | 1 - src/main.cpp | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index 9c4e2336b..fcc6d7ed2 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -155,11 +155,12 @@ HomeWindow::HomeWindow(Context *context, QString name, QString /* windowtitle */ connect(titleEdit, SIGNAL(textChanged(const QString&)), SLOT(titleChanged())); installEventFilter(this); - application->installEventFilter(this); + qApp->installEventFilter(this); } HomeWindow::~HomeWindow() { + qApp->removeEventFilter(this); } void diff --git a/src/HomeWindow.h b/src/HomeWindow.h index 662a6fa2a..e85f6bb03 100644 --- a/src/HomeWindow.h +++ b/src/HomeWindow.h @@ -40,7 +40,6 @@ #include "QtMacSegmentedButton.h" #endif -extern QApplication *application; class ChartBar; class HomeWindow : public GcWindow diff --git a/src/main.cpp b/src/main.cpp index 022c06be9..9bbb3baf4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,7 +58,6 @@ void nostderr(QString dir) #include #endif -QApplication *application; bool restarting = false; // root directory shared by all @@ -142,7 +141,7 @@ main(int argc, char *argv[]) #endif // create the application -- only ever ONE regardless of restarts - application = new QApplication(argc, argv); + QApplication *application = new QApplication(argc, argv); #ifdef Q_OS_MAC // get an autorelease pool setup