From e90d2d3338c09c76fcc3c5340208c6b499f042ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Mon, 20 Jun 2011 15:57:48 +0200 Subject: [PATCH] Replace UBPlatformUtils::disableShadow() with setAttribute(Qt::WA_MacNoShadow, true) --- src/core/UBDisplayManager.cpp | 4 ++-- src/desktop/UBDesktopAnnotationController.cpp | 11 +---------- src/frameworks/UBPlatformUtils.h | 2 -- src/frameworks/UBPlatformUtils_linux.cpp | 6 ------ src/frameworks/UBPlatformUtils_mac.mm | 13 ------------- src/frameworks/UBPlatformUtils_win.cpp | 6 ------ src/gui/UBDockPalette.cpp | 2 +- 7 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/core/UBDisplayManager.cpp b/src/core/UBDisplayManager.cpp index 446a3e6f..b0dc09b9 100644 --- a/src/core/UBDisplayManager.cpp +++ b/src/core/UBDisplayManager.cpp @@ -114,7 +114,7 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget ) mControlWidget->hide(); mControlWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex)); mControlWidget->showFullScreen(); - UBPlatformUtils::disableShadow(mControlWidget); + mControlWidget->setAttribute(Qt::WA_MacNoShadow); } } @@ -127,7 +127,7 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget) mDisplayWidget->hide(); mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex)); mDisplayWidget->showFullScreen(); - UBPlatformUtils::disableShadow(mDisplayWidget); + mDisplayWidget->setAttribute(Qt::WA_MacNoShadow); } } diff --git a/src/desktop/UBDesktopAnnotationController.cpp b/src/desktop/UBDesktopAnnotationController.cpp index 60ab2150..20430a86 100644 --- a/src/desktop/UBDesktopAnnotationController.cpp +++ b/src/desktop/UBDesktopAnnotationController.cpp @@ -61,14 +61,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingView = new UBBoardView(UBApplication::boardController, 0); // deleted in UBDesktopAnnotationController::destructor mTransparentDrawingView->setAttribute(Qt::WA_TranslucentBackground, true); + mTransparentDrawingView->setAttribute(Qt::WA_MacNoShadow, true); mTransparentDrawingView->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Window); mTransparentDrawingView->setCacheMode(QGraphicsView::CacheNone); mTransparentDrawingView->resize(UBApplication::desktop()->width(), UBApplication::desktop()->height()); mTransparentDrawingView->setMouseTracking(true); - UBPlatformUtils::disableShadow(mTransparentDrawingView); - mTransparentDrawingView->setAcceptDrops(false); QString backgroundStyle = "QWidget {background-color: rgba(127, 127, 127, 0)}"; @@ -78,10 +77,8 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) mTransparentDrawingView->setScene(mTransparentDrawingScene); mLibPalette = new UBLibPalette(mTransparentDrawingView); - UBPlatformUtils::disableShadow(mLibPalette); mDesktopPalette = new UBDesktopPalette(mTransparentDrawingView); - UBPlatformUtils::disableShadow(mDesktopPalette); connect(mDesktopPalette, SIGNAL(uniboardClick()), this, SLOT(goToUniboard())); //connect(UBApplication::mainWindow->actionVirtualKeyboard, SIGNAL(triggered(bool)), this, SLOT(showKeyboard(bool))); @@ -100,17 +97,13 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent) // Add the desktop associated palettes mDesktopToolsPalette = new UBDesktopToolsPalette(mTransparentDrawingView); - UBPlatformUtils::disableShadow(mDesktopToolsPalette); mDesktopPenPalette = new UBDesktopPenPalette(mTransparentDrawingView); - UBPlatformUtils::disableShadow(mDesktopPenPalette); connect(mDesktopPalette, SIGNAL(maximized()), mDesktopPenPalette, SLOT(onParentMaximized())); connect(mDesktopPalette, SIGNAL(minimizeStart(eMinimizedLocation)), mDesktopPenPalette, SLOT(onParentMinimized())); mDesktopMarkerPalette = new UBDesktopMarkerPalette(mTransparentDrawingView); - UBPlatformUtils::disableShadow(mDesktopMarkerPalette); mDesktopEraserPalette = new UBDesktopEraserPalette(mTransparentDrawingView); - UBPlatformUtils::disableShadow(mDesktopEraserPalette); if (UBPlatformUtils::hasVirtualKeyboard()) { mKeyboardPalette = UBKeyboardPalette::create(mTransparentDrawingView); @@ -331,8 +324,6 @@ void UBDesktopAnnotationController::showWindow() UBDrawingController::drawingController()->setStylusTool(mDesktopStylusTool); mTransparentDrawingView->showFullScreen(); - UBPlatformUtils::disableShadow(mTransparentDrawingView); - UBPlatformUtils::setDesktopMode(true); diff --git a/src/frameworks/UBPlatformUtils.h b/src/frameworks/UBPlatformUtils.h index fb06cb4f..6fd59934 100644 --- a/src/frameworks/UBPlatformUtils.h +++ b/src/frameworks/UBPlatformUtils.h @@ -95,8 +95,6 @@ class UBPlatformUtils static QString preferredTranslation(); static QString preferredLanguage(); - static void disableShadow(QWidget *widget); - static bool hasVirtualKeyboard(); //static void showVirtualKeyboard(); diff --git a/src/frameworks/UBPlatformUtils_linux.cpp b/src/frameworks/UBPlatformUtils_linux.cpp index 97010c91..8f72dd48 100644 --- a/src/frameworks/UBPlatformUtils_linux.cpp +++ b/src/frameworks/UBPlatformUtils_linux.cpp @@ -53,12 +53,6 @@ QString UBPlatformUtils::preferredLanguage() return QLocale::system().name(); } -void UBPlatformUtils::disableShadow(QWidget *widget) -{ - Q_UNUSED(widget) - // Linux windows do not have a shadow -} - void UBPlatformUtils::runInstaller(const QString &installerFilePath) { // TODO UB 4.x - auto update & installer are deactivated on Linux diff --git a/src/frameworks/UBPlatformUtils_mac.mm b/src/frameworks/UBPlatformUtils_mac.mm index 1b4b12d0..1f2b33eb 100644 --- a/src/frameworks/UBPlatformUtils_mac.mm +++ b/src/frameworks/UBPlatformUtils_mac.mm @@ -205,19 +205,6 @@ QString UBPlatformUtils::preferredLanguage() return lprojFileInfo.baseName(); } -void UBPlatformUtils::disableShadow(QWidget *widget) -{ -#ifndef QT_MAC_USE_COCOA - // Make sure we have a native window, see http://doc.trolltech.com/4.5/qwidget.html#native-widgets-vs-alien-widgets - widget->winId(); - ChangeWindowAttributes(qt_mac_window_for(widget), kWindowNoShadowAttribute, kWindowNoAttributes); -#else - NSView* view = (NSView*)widget->winId(); - NSWindow* window = [view window]; - [window setHasShadow:NO]; -#endif -} - void UBPlatformUtils::runInstaller(const QString &installerFilePath) { UBApplication::setDisabled(true); diff --git a/src/frameworks/UBPlatformUtils_win.cpp b/src/frameworks/UBPlatformUtils_win.cpp index 02bf59c3..c07c7944 100644 --- a/src/frameworks/UBPlatformUtils_win.cpp +++ b/src/frameworks/UBPlatformUtils_win.cpp @@ -61,12 +61,6 @@ QString UBPlatformUtils::preferredLanguage() return QLocale::system().name(); } -void UBPlatformUtils::disableShadow(QWidget *widget) -{ - Q_UNUSED(widget); - // Windows windows do not have a shadow -} - //void UBPlatformUtils::showVirtualKeyboard() //{ // ShellExecute(NULL,NULL,TEXT("tabtip.exe"), NULL, NULL, SW_SHOWNORMAL); diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index ca767671..723619bc 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -33,7 +33,7 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name) { // standalone window setAttribute(Qt::WA_TranslucentBackground); - UBPlatformUtils::disableShadow(this); + setAttribute(Qt::WA_MacNoShadow); } mBackgroundBrush = QBrush(UBSettings::paletteColor);