From 27b93bb24d3da34fcd0ea058e7654e93bf19c0d3 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Mon, 23 May 2011 17:04:53 +0200 Subject: [PATCH] Fixed issue Sankore-9. setHidden() doesn't behave as expected on mac --- src/core/UBApplication.cpp | 17 ++++++++++++++++- src/core/UBApplication.h | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index a6cc545b..b532386b 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -223,8 +223,12 @@ int UBApplication::exec(const QString& pFileToImport) applicationController = new UBApplicationController(boardController->controlView(), boardController->displayView(), mainWindow, staticMemoryCleaner); connect(mainWindow->actionDesktop, SIGNAL(triggered(bool)), applicationController, SLOT(showDesktop(bool))); +#ifndef Q_WS_MAC connect(mainWindow->actionHideApplication, SIGNAL(triggered()), mainWindow, SLOT(showMinimized())); - +#else + connect(mainWindow->actionHideApplication, SIGNAL(triggered()), this, SLOT(showMinimized())); +#endif + mPreferencesController = new UBPreferencesController(mainWindow); connect(mainWindow->actionPreferences, SIGNAL(triggered()), mPreferencesController, SLOT(show())); @@ -300,7 +304,13 @@ int UBApplication::exec(const QString& pFileToImport) return QApplication::exec(); } +#ifdef Q_WS_MAC +void UBApplication::showMinimized() +{ + mainWindow->hide(); +} +#endif void UBApplication::showBoard() { @@ -485,6 +495,11 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) boardController->controlView()->forcedTabletRelease(); } +#ifdef Q_WS_MAC + if (event->type() == QEvent::ApplicationActivate){ + if (mainWindow->isHidden()) mainWindow->show(); + } +#endif return result; } diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index 41c7c772..76c3f094 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -99,6 +99,9 @@ class UBApplication : public QtSingleApplication private slots: void closing(); +#ifdef Q_WS_MAC + void showMinimized(); +#endif private: