diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-09-18 16:48:25 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-09-19 12:24:18 +0200 |
commit | 332ef31f0d1645eded5588729176134bbdcd38a2 (patch) | |
tree | 71091684801a123a6b748eb21a51d813943bd3b1 /src/controls | |
parent | 85114be06703e7675b6c780776e45c14a69a5c2d (diff) | |
download | qtquickcontrols-332ef31f0d1645eded5588729176134bbdcd38a2.tar.gz |
Default to Text.QtRendering on mobile platforms
Change-Id: I9aa23691aa8bb4659545ed43c1506128a639ff6c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/controls')
-rw-r--r-- | src/controls/Label.qml | 4 | ||||
-rw-r--r-- | src/controls/Private/qquickcontrolsettings.cpp | 9 | ||||
-rw-r--r-- | src/controls/Private/qquickcontrolsettings_p.h | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/ButtonStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/CheckBoxStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/ComboBoxStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/GroupBoxStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/MenuBarStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/MenuStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/RadioButtonStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/SpinBoxStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/TabViewStyle.qml | 2 | ||||
-rw-r--r-- | src/controls/Styles/Base/TableViewStyle.qml | 4 | ||||
-rw-r--r-- | src/controls/Styles/Base/TextAreaStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/TextFieldStyle.qml | 6 | ||||
-rw-r--r-- | src/controls/Styles/Base/ToolButtonStyle.qml | 1 |
16 files changed, 42 insertions, 20 deletions
diff --git a/src/controls/Label.qml b/src/controls/Label.qml index e3052f44..0b3a6505 100644 --- a/src/controls/Label.qml +++ b/src/controls/Label.qml @@ -39,6 +39,8 @@ ****************************************************************************/ import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Private 1.0 /*! \qmltype Label @@ -85,7 +87,7 @@ Text { id: label color: pal.windowText activeFocusOnTab: false - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering SystemPalette { id: pal colorGroup: enabled ? SystemPalette.Active : SystemPalette.Disabled diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp index ee1b57df..f05df0d5 100644 --- a/src/controls/Private/qquickcontrolsettings.cpp +++ b/src/controls/Private/qquickcontrolsettings.cpp @@ -82,6 +82,15 @@ bool QQuickControlSettings::hasTouchScreen() const #endif } +bool QQuickControlSettings::isMobile() const +{ +#if defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_BLACKBERRY) || defined(Q_OS_QNX) || defined(Q_OS_WINRT) + return true; +#else + return false; +#endif +} + static QString styleImportPath(QQmlEngine *engine, const QString &styleName) { QString path = qgetenv("QT_QUICK_CONTROLS_STYLE"); diff --git a/src/controls/Private/qquickcontrolsettings_p.h b/src/controls/Private/qquickcontrolsettings_p.h index 3f90862f..72a1ca6a 100644 --- a/src/controls/Private/qquickcontrolsettings_p.h +++ b/src/controls/Private/qquickcontrolsettings_p.h @@ -50,6 +50,7 @@ class QQuickControlSettings : public QObject Q_PROPERTY(qreal dpiScaleFactor READ dpiScaleFactor CONSTANT) Q_PROPERTY(qreal dragThreshold READ dragThreshold CONSTANT) Q_PROPERTY(bool hasTouchScreen READ hasTouchScreen CONSTANT) + Q_PROPERTY(bool isMobile READ isMobile CONSTANT) public: QQuickControlSettings(QQmlEngine *engine); @@ -66,6 +67,7 @@ public: qreal dragThreshold() const; bool hasTouchScreen() const; + bool isMobile() const; signals: void styleChanged(); diff --git a/src/controls/Styles/Base/ButtonStyle.qml b/src/controls/Styles/Base/ButtonStyle.qml index 426e7f61..54576b7f 100644 --- a/src/controls/Styles/Base/ButtonStyle.qml +++ b/src/controls/Styles/Base/ButtonStyle.qml @@ -141,7 +141,7 @@ Style { } Text { id: text - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering anchors.verticalCenter: parent.verticalCenter text: control.text color: SystemPaletteSingleton.buttonText(control.enabled) diff --git a/src/controls/Styles/Base/CheckBoxStyle.qml b/src/controls/Styles/Base/CheckBoxStyle.qml index 5702ca75..a23c7721 100644 --- a/src/controls/Styles/Base/CheckBoxStyle.qml +++ b/src/controls/Styles/Base/CheckBoxStyle.qml @@ -101,7 +101,7 @@ Style { text: control.text anchors.centerIn: parent color: SystemPaletteSingleton.text(control.enabled) - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } } /*! The background under indicator and label. */ diff --git a/src/controls/Styles/Base/ComboBoxStyle.qml b/src/controls/Styles/Base/ComboBoxStyle.qml index 92154d0a..f71c8c98 100644 --- a/src/controls/Styles/Base/ComboBoxStyle.qml +++ b/src/controls/Styles/Base/ComboBoxStyle.qml @@ -63,12 +63,14 @@ Style { Supported render types are: \list \li Text.QtRendering - \li Text.NativeRendering - the default + \li Text.NativeRendering \endlist + The default value is platform dependent. + \sa Text::renderType */ - property int renderType: Text.NativeRendering + property int renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering /*! \since QtQuick.Controls.Styles 1.3 diff --git a/src/controls/Styles/Base/GroupBoxStyle.qml b/src/controls/Styles/Base/GroupBoxStyle.qml index 2adc18d0..22252a96 100644 --- a/src/controls/Styles/Base/GroupBoxStyle.qml +++ b/src/controls/Styles/Base/GroupBoxStyle.qml @@ -126,7 +126,7 @@ Style { anchors.margins: 4 text: control.title color: textColor - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } BorderImage { diff --git a/src/controls/Styles/Base/MenuBarStyle.qml b/src/controls/Styles/Base/MenuBarStyle.qml index 11b8069c..40e6ea5d 100644 --- a/src/controls/Styles/Base/MenuBarStyle.qml +++ b/src/controls/Styles/Base/MenuBarStyle.qml @@ -106,7 +106,7 @@ Style { font: root.font text: formatMnemonic(styleData.text, styleData.underlineMnemonic) anchors.centerIn: parent - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering color: styleData.open ? "white" : SystemPaletteSingleton.windowText(control.enabled) } } diff --git a/src/controls/Styles/Base/MenuStyle.qml b/src/controls/Styles/Base/MenuStyle.qml index ceb2bfca..61202bae 100644 --- a/src/controls/Styles/Base/MenuStyle.qml +++ b/src/controls/Styles/Base/MenuStyle.qml @@ -192,7 +192,7 @@ Style { text: formatMnemonic(styleData.text, styleData.underlineMnemonic) color: __currentTextColor font: styleRoot.font - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } submenuIndicator: Text { @@ -201,7 +201,7 @@ Style { color: __currentTextColor style: styleData.selected ? Text.Normal : Text.Raised styleColor: Qt.lighter(color, 4) - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } shortcut: Text { @@ -219,7 +219,7 @@ Style { wordSpacing: styleRoot.font.wordSpacing } color: __currentTextColor - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } checkmarkIndicator: Loader { diff --git a/src/controls/Styles/Base/RadioButtonStyle.qml b/src/controls/Styles/Base/RadioButtonStyle.qml index 3fda616a..8f70d854 100644 --- a/src/controls/Styles/Base/RadioButtonStyle.qml +++ b/src/controls/Styles/Base/RadioButtonStyle.qml @@ -100,7 +100,7 @@ Style { text: control.text anchors.centerIn: parent color: SystemPaletteSingleton.text(control.enabled) - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } } diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml index 03863173..14d72863 100644 --- a/src/controls/Styles/Base/SpinBoxStyle.qml +++ b/src/controls/Styles/Base/SpinBoxStyle.qml @@ -103,12 +103,14 @@ Style { Supported render types are: \list \li Text.QtRendering - \li Text.NativeRendering - the default + \li Text.NativeRendering \endlist + The default value is platform dependent. + \sa Text::renderType */ - property int renderType: Text.NativeRendering + property int renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering /*! \since QtQuick.Controls.Styles 1.3 diff --git a/src/controls/Styles/Base/TabViewStyle.qml b/src/controls/Styles/Base/TabViewStyle.qml index 35491ad3..53da921f 100644 --- a/src/controls/Styles/Base/TabViewStyle.qml +++ b/src/controls/Styles/Base/TabViewStyle.qml @@ -167,7 +167,7 @@ Style { horizontalAlignment: Text.AlignHCenter text: styleData.title elide: Text.ElideMiddle - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering scale: control.tabPosition === Qt.TopEdge ? 1 : -1 color: SystemPaletteSingleton.text(styleData.enabled) Rectangle { diff --git a/src/controls/Styles/Base/TableViewStyle.qml b/src/controls/Styles/Base/TableViewStyle.qml index 602049c4..ca4cc428 100644 --- a/src/controls/Styles/Base/TableViewStyle.qml +++ b/src/controls/Styles/Base/TableViewStyle.qml @@ -92,7 +92,7 @@ ScrollViewStyle { text: styleData.value elide: Text.ElideRight color: textColor - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } Rectangle { anchors.right: parent.right @@ -135,7 +135,7 @@ ScrollViewStyle { elide: styleData.elideMode text: styleData.value !== undefined ? styleData.value : "" color: styleData.textColor - renderType: Text.NativeRendering + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } } } diff --git a/src/controls/Styles/Base/TextAreaStyle.qml b/src/controls/Styles/Base/TextAreaStyle.qml index a8dace6a..cc154a5d 100644 --- a/src/controls/Styles/Base/TextAreaStyle.qml +++ b/src/controls/Styles/Base/TextAreaStyle.qml @@ -90,12 +90,14 @@ ScrollViewStyle { Supported render types are: \list \li Text.QtRendering - \li Text.NativeRendering - the default + \li Text.NativeRendering \endlist + The default value is platform dependent. + \sa Text::renderType */ - property int renderType: Text.NativeRendering + property int renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering /*! The default margin, in pixels, around the text in the TextArea. \since QtQuick.Controls.Styles 1.3 diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml index ca639514..a7e5884a 100644 --- a/src/controls/Styles/Base/TextFieldStyle.qml +++ b/src/controls/Styles/Base/TextFieldStyle.qml @@ -95,12 +95,14 @@ Style { Supported render types are: \list \li Text.QtRendering - \li Text.NativeRendering - the default + \li Text.NativeRendering \endlist + The default value is platform dependent. + \sa Text::renderType */ - property int renderType: Text.NativeRendering + property int renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering /*! The placeholder text color, used when the text field is empty. \since QtQuick.Controls.Styles 1.1 diff --git a/src/controls/Styles/Base/ToolButtonStyle.qml b/src/controls/Styles/Base/ToolButtonStyle.qml index 1f47675f..364b1b31 100644 --- a/src/controls/Styles/Base/ToolButtonStyle.qml +++ b/src/controls/Styles/Base/ToolButtonStyle.qml @@ -75,6 +75,7 @@ Style { visible: !hasIcon anchors.centerIn: parent text: control.text + renderType: Settings.isMobile ? Text.QtRendering : Text.NativeRendering } Image { id: icon |