From d613f30bd4cf93b27ed5f6cc101f882cc8153512 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 12 Jan 2012 14:23:57 +0100 Subject: Add setPalette to QGuiApplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we have a getter, we also need the setter to be symmetric. Change-Id: Ibcb20d66c711e4c1bebd448781fa9eddb9cd773f Reviewed-by: Samuel Rødal --- src/gui/kernel/qguiapplication.cpp | 10 ++++++++++ src/gui/kernel/qguiapplication.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c674573bb6..9f1eaeacfd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1185,6 +1185,16 @@ QPalette QGuiApplication::palette() return *QGuiApplicationPrivate::app_pal; } +void QGuiApplication::setPalette(const QPalette &pal) +{ + if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal)) + return; + if (!QGuiApplicationPrivate::app_pal) + QGuiApplicationPrivate::app_pal = new QPalette(pal); + else + *QGuiApplicationPrivate::app_pal = pal; +} + QFont QGuiApplication::font() { QMutexLocker locker(applicationFontMutex()); diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 7223e2639e..dd7b1f8806 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -108,6 +108,7 @@ public: #endif static QPalette palette(); + static void setPalette(const QPalette &pal); static Qt::KeyboardModifiers keyboardModifiers(); static Qt::MouseButtons mouseButtons(); -- cgit v1.2.3