diff options
Diffstat (limited to 'src/quickcontrols/ios/qquickiostheme.mm')
-rw-r--r-- | src/quickcontrols/ios/qquickiostheme.mm | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/quickcontrols/ios/qquickiostheme.mm b/src/quickcontrols/ios/qquickiostheme.mm index 2ee9a63d3d..2f7c84ae7e 100644 --- a/src/quickcontrols/ios/qquickiostheme.mm +++ b/src/quickcontrols/ios/qquickiostheme.mm @@ -3,7 +3,9 @@ #include "qquickiostheme_p.h" +#if defined(Q_OS_APPLE) #include <QtGui/private/qcoregraphics_p.h> +#endif #ifdef Q_OS_IOS #include <UIKit/UIInterface.h> @@ -19,8 +21,9 @@ void QQuickIOSTheme::initialize(QQuickTheme *theme) QPalette systemPalette; QColor window; - QColor windowText; - QColor background; + QColor base; + QColor text; + QColor disabledText; QColor placeholderText; QColor button; QColor disabledButton; @@ -30,8 +33,9 @@ void QQuickIOSTheme::initialize(QQuickTheme *theme) QColor darkGray; #ifdef Q_OS_IOS window = qt_mac_toQColor(UIColor.systemGroupedBackgroundColor.CGColor); - windowText = qt_mac_toQColor(UIColor.labelColor.CGColor); - background = qt_mac_toQColor(UIColor.secondarySystemGroupedBackgroundColor.CGColor); + base = qt_mac_toQColor(UIColor.secondarySystemGroupedBackgroundColor.CGColor); + text = qt_mac_toQColor(UIColor.labelColor.CGColor); + disabledText = qt_mac_toQColor(UIColor.tertiaryLabelColor.CGColor); placeholderText = qt_mac_toQColor(UIColor.placeholderTextColor.CGColor); button = qt_mac_toQColor(UIColor.systemBlueColor.CGColor); disabledButton = qt_mac_toQColor(UIColor.tertiarySystemFillColor.CGColor); @@ -42,9 +46,10 @@ void QQuickIOSTheme::initialize(QQuickTheme *theme) #else bool isDarkSystemTheme = QQuickStylePrivate::isDarkSystemTheme(); window = isDarkSystemTheme ? QColor(qRgba(0, 0, 0, 255)) : QColor(qRgba(242, 242, 247, 255)); - windowText = isDarkSystemTheme ? QColor(Qt::white) : QColor(Qt::black); - background = isDarkSystemTheme ? QColor(qRgba(28, 28, 30, 255)) : QColor(Qt::white); - placeholderText = isDarkSystemTheme ? QColor(qRgba(235, 235, 245, 77)) : QColor(qRgba(60, 60, 67, 77)); + base = isDarkSystemTheme ? QColor(qRgba(28, 28, 30, 255)) : QColor(Qt::white); + text = isDarkSystemTheme ? QColor(Qt::white) : QColor(Qt::black); + disabledText = isDarkSystemTheme ? QColor(qRgba(60, 60, 67, 76)) : QColor(qRgba(235, 235, 245, 76)); + placeholderText = isDarkSystemTheme ? QColor(qRgba(235, 235, 245, 76)) : QColor(qRgba(60, 60, 67, 77)); button = isDarkSystemTheme ? QColor(qRgba(10, 132, 255, 255)) : QColor(qRgba(0, 122, 255, 255)); disabledButton = isDarkSystemTheme ? QColor(qRgba(118, 118, 128, 61)) : QColor(qRgba(118, 118, 128, 31)); white = QColor(Qt::white); @@ -53,23 +58,23 @@ void QQuickIOSTheme::initialize(QQuickTheme *theme) darkGray = QColor(qRgba(142, 142, 147, 255)); #endif systemPalette.setColor(QPalette::Window, window); + systemPalette.setColor(QPalette::Base, base); - systemPalette.setColor(QPalette::Active, QPalette::WindowText, windowText); - systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, darkGray); - - systemPalette.setColor(QPalette::Base, background); - + systemPalette.setColor(QPalette::WindowText, text); + systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledText); + systemPalette.setColor(QPalette::Text, text); + systemPalette.setColor(QPalette::Disabled, QPalette::Text, disabledText); systemPalette.setColor(QPalette::PlaceholderText, placeholderText); systemPalette.setColor(QPalette::Button, button); systemPalette.setColor(QPalette::Disabled, QPalette::Button, disabledButton); - systemPalette.setColor(QPalette::ButtonText, white); - white.setAlphaF(0.5); - systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText, white); + systemPalette.setColor(QPalette::Disabled, QPalette::ButtonText, disabledText); + + systemPalette.setColor(QPalette::ToolTipText, text); + systemPalette.setColor(QPalette::Disabled, QPalette::ToolTipText, disabledText); - button.setAlphaF(0.8); - systemPalette.setColor(QPalette::Highlight, button); + systemPalette.setColor(QPalette::Highlight, button.lighter(115)); systemPalette.setColor(QPalette::Light, lightGray); systemPalette.setColor(QPalette::Mid, gray); @@ -79,4 +84,3 @@ void QQuickIOSTheme::initialize(QQuickTheme *theme) } QT_END_NAMESPACE - |