Add setPalette to QGuiApplication
authorLars Knoll <lars.knoll@nokia.com>
Thu, 12 Jan 2012 13:23:57 +0000 (14:23 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 12 Jan 2012 13:35:42 +0000 (14:35 +0100)
If we have a getter, we also need the setter to be
symmetric.

Change-Id: Ibcb20d66c711e4c1bebd448781fa9eddb9cd773f
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/kernel/qguiapplication.cpp
src/gui/kernel/qguiapplication.h

index c674573..9f1eaea 100644 (file)
@@ -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());
index 7223e26..dd7b1f8 100644 (file)
@@ -108,6 +108,7 @@ public:
 #endif
 
     static QPalette palette();
+    static void setPalette(const QPalette &pal);
 
     static Qt::KeyboardModifiers keyboardModifiers();
     static Qt::MouseButtons mouseButtons();