summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-10-17 15:37:30 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-21 12:48:32 +0200
commite38b8327dc03526dbea5b6a0f073ba1d32d6d9f2 (patch)
tree28fed46504cfa533022e1605bee8acb42ec3213c
parent66c2c264b32748ea5a80cdd33fd6d7909e9825ed (diff)
downloadqtquickcontrols-e38b8327dc03526dbea5b6a0f073ba1d32d6d9f2.tar.gz
Expose renderType to SpinBox and TextField
This is useful in case you want to create your own scaling styled controls. Task-number: QTBUG-33917 Change-Id: I0d641319a3106b8e0971d0aae69799bc1aff7f78 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
-rw-r--r--src/controls/SpinBox.qml2
-rw-r--r--src/controls/Styles/Base/SpinBoxStyle.qml15
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml15
-rw-r--r--src/controls/Styles/Desktop/SpinBoxStyle.qml2
-rw-r--r--src/controls/Styles/Desktop/TextFieldStyle.qml2
-rw-r--r--src/controls/TextField.qml4
6 files changed, 37 insertions, 3 deletions
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index 5f96434a..0cc2f5a7 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -260,7 +260,7 @@ Control {
selectedTextColor: __panel ? __panel.selectedTextColor : "black"
opacity: parent.enabled ? 1 : 0.5
- renderType: Text.NativeRendering
+ renderType: __style ? __style.renderType : Text.NativeRendering
function selectValue() {
select(prefix.length, text.length - suffix.length)
diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml
index 795cdf45..1617ba1f 100644
--- a/src/controls/Styles/Base/SpinBoxStyle.qml
+++ b/src/controls/Styles/Base/SpinBoxStyle.qml
@@ -102,6 +102,21 @@ Style {
/*! The highlighted text color, used in selections. */
property color selectedTextColor: __syspal.highlightedText
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+
/*! The button used to increment the value. */
property Component incrementControl: Item {
implicitWidth: 18
diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml
index 0eb93e77..6c16c8de 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -91,6 +91,21 @@ Style {
/*! The highlighted text color, used in selections. */
property color selectedTextColor: __syspal.highlightedText
+ /*!
+ \qmlproperty enumeration renderType
+
+ Override the default rendering type for the control.
+
+ Supported render types are:
+ \list
+ \li Text.QtRendering
+ \li Text.NativeRendering - the default
+ \endlist
+
+ \sa Text::renderType
+ */
+ property int renderType: Text.NativeRendering
+
/*! The placeholder text color, used when the text field is empty.
\since 5.2
*/
diff --git a/src/controls/Styles/Desktop/SpinBoxStyle.qml b/src/controls/Styles/Desktop/SpinBoxStyle.qml
index fe374fe9..0fe5ac41 100644
--- a/src/controls/Styles/Desktop/SpinBoxStyle.qml
+++ b/src/controls/Styles/Desktop/SpinBoxStyle.qml
@@ -57,6 +57,8 @@ Style {
}
StyleItem {id: styleitem ; visible: false}
+ property int renderType: Text.NativeRendering
+
property Component panel: Item {
id: style
diff --git a/src/controls/Styles/Desktop/TextFieldStyle.qml b/src/controls/Styles/Desktop/TextFieldStyle.qml
index 10bcab68..7044b389 100644
--- a/src/controls/Styles/Desktop/TextFieldStyle.qml
+++ b/src/controls/Styles/Desktop/TextFieldStyle.qml
@@ -42,6 +42,8 @@ import QtQuick.Controls 1.1
import QtQuick.Controls.Private 1.0
Style {
+ property int renderType: Text.NativeRendering
+
property Component panel: StyleItem {
id: textfieldstyle
elementType: "edit"
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index d8829403..8ac2e273 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -561,7 +561,7 @@ Control {
color: __panel ? __panel.placeholderTextColor : "darkgray"
clip: contentWidth > width;
elide: Text.ElideRight
- renderType: Text.NativeRendering
+ renderType: __style ? __style.renderType : Text.NativeRendering
Behavior on opacity { NumberAnimation { duration: 90 } }
}
@@ -584,7 +584,7 @@ Control {
color: __panel ? __panel.textColor : "darkgray"
clip: contentWidth > width
- renderType: Text.NativeRendering
+ renderType: __style ? __style.renderType : Text.NativeRendering
onAccepted: textfield.accepted()
}