From 707eb8d28d6bc41a99676eeaec4716d4b2a15427 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 7 Oct 2014 10:29:48 +0200 Subject: [PATCH] iOS: add system palette MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return a system palette that sets the correct highligh (text selection) colors. Change-Id: Ic0a18f931913f28bdc73d9ec4ae347fe38839f17 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostheme.h | 3 +++ src/plugins/platforms/ios/qiostheme.mm | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h index 16b330a030..4cedc7b879 100644 --- a/src/plugins/platforms/ios/qiostheme.h +++ b/src/plugins/platforms/ios/qiostheme.h @@ -35,6 +35,7 @@ #define QIOSTHEME_H #include +#include #include QT_BEGIN_NAMESPACE @@ -45,6 +46,7 @@ public: QIOSTheme(); ~QIOSTheme(); + const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; QVariant themeHint(ThemeHint hint) const; QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; @@ -56,6 +58,7 @@ public: private: mutable QHash m_fonts; + QPalette m_systemPalette; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index cbeb157cf2..c89dd7dc05 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -60,7 +60,10 @@ QT_BEGIN_NAMESPACE const char *QIOSTheme::name = "ios"; QIOSTheme::QIOSTheme() + : m_systemPalette(*QPlatformTheme::palette(QPlatformTheme::SystemPalette)) { + m_systemPalette.setBrush(QPalette::Highlight, QColor(204, 221, 237)); + m_systemPalette.setBrush(QPalette::HighlightedText, Qt::black); } QIOSTheme::~QIOSTheme() @@ -68,6 +71,13 @@ QIOSTheme::~QIOSTheme() qDeleteAll(m_fonts); } +const QPalette *QIOSTheme::palette(QPlatformTheme::Palette type) const +{ + if (type == QPlatformTheme::SystemPalette) + return &m_systemPalette; + return 0; +} + QPlatformMenuItem* QIOSTheme::createPlatformMenuItem() const { return new QIOSMenuItem();