summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-29 17:29:16 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-10-30 10:43:16 +0100
commit3a851dfd4078b3ca9f9c1b06424b136cc6f852c5 (patch)
tree8df32ef561f75be2b50fb95a04bb44463b34b0f0
parent052dea3003b393d2ebb6754d0ed2fd7329cd8d26 (diff)
downloadqtquickcontrols-3a851dfd4078b3ca9f9c1b06424b136cc6f852c5.tar.gz
Make the cursor and selection handle delegates private for now
The API is not ideal, we don't want to lock this thing down like as it is now. All styles implemented so far created CursorHandleStyle.qml and SelectionHandleStyle.qml so perhaps that's the better way to go. Furthermore, there's never going to be multiple occurrences of the handle pairs, so it should be one shared instance. Thus, the relevant style delegates probably shouldn't be sprinkled around various control styles... So, for now, the most pragmatic solution is to make the handles and cursors internal since we don't have time to revamp it before 5.4.0. Change-Id: Ib9fcc4a431bb510c8c55a760159f4d6a631554b3 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--src/controls/ComboBox.qml4
-rw-r--r--src/controls/Private/TextInputWithHandles.qml3
-rw-r--r--src/controls/SpinBox.qml4
-rw-r--r--src/controls/Styles/Android/ComboBoxStyle.qml4
-rw-r--r--src/controls/Styles/Android/SpinBoxStyle.qml4
-rw-r--r--src/controls/Styles/Android/TextAreaStyle.qml4
-rw-r--r--src/controls/Styles/Android/TextFieldStyle.qml4
-rw-r--r--src/controls/Styles/Base/ComboBoxStyle.qml15
-rw-r--r--src/controls/Styles/Base/SpinBoxStyle.qml15
-rw-r--r--src/controls/Styles/Base/TextAreaStyle.qml15
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml15
-rw-r--r--src/controls/Styles/iOS/ComboBoxStyle.qml6
-rw-r--r--src/controls/Styles/iOS/SpinBoxStyle.qml6
-rw-r--r--src/controls/Styles/iOS/TextAreaStyle.qml6
-rw-r--r--src/controls/Styles/iOS/TextFieldStyle.qml6
-rw-r--r--src/controls/TextArea.qml6
-rw-r--r--src/controls/TextField.qml4
-rw-r--r--tests/manual/texthandles/main.qml16
18 files changed, 74 insertions, 63 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 68429483..f2f37a0a 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -401,8 +401,8 @@ Control {
clip: contentWidth > width
control: comboBox
- cursorHandle: __style ? __style.cursorHandle : undefined
- selectionHandle: __style ? __style.selectionHandle : undefined
+ cursorHandle: __style ? __style.__cursorHandle : undefined
+ selectionHandle: __style ? __style.__selectionHandle : undefined
anchors.fill: parent
anchors.leftMargin: __style ? __style.padding.left : 0
diff --git a/src/controls/Private/TextInputWithHandles.qml b/src/controls/Private/TextInputWithHandles.qml
index 3c8351a3..ceb63084 100644
--- a/src/controls/Private/TextInputWithHandles.qml
+++ b/src/controls/Private/TextInputWithHandles.qml
@@ -52,7 +52,7 @@ TextInput {
readonly property int selectionPosition: selectionStart !== cursorPosition ? selectionStart : selectionEnd
readonly property alias containsMouse: mouseArea.containsMouse
property alias editMenu: editMenu
- cursorDelegate: __style && __style.cursorDelegate ? __style.cursorDelegate : null
+ cursorDelegate: __style && __style.__cursorDelegate ? __style.__cursorDelegate : null
selectByMouse: control.selectByMouse && (!cursorHandle.delegate || !selectionHandle.delegate)
@@ -164,7 +164,6 @@ TextInput {
parent: control
control: input.control
active: control.selectByMouse
- delegate: style.cursorHandle
minimum: input.hasSelection ? selectionHandle.position + 1 : -1
property var mappedPos: parent.mapFromItem(editor, editor.cursorRectangle.x, editor.cursorRectangle.y)
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index f13e81dc..66a21027 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -291,8 +291,8 @@ Control {
anchors.bottomMargin: __style ? __style.padding.bottom: 0
control: spinbox
- cursorHandle: __style ? __style.cursorHandle : undefined
- selectionHandle: __style ? __style.selectionHandle : undefined
+ cursorHandle: __style ? __style.__cursorHandle : undefined
+ selectionHandle: __style ? __style.__selectionHandle : undefined
focus: true
activeFocusOnPress: spinbox.activeFocusOnPress
diff --git a/src/controls/Styles/Android/ComboBoxStyle.qml b/src/controls/Styles/Android/ComboBoxStyle.qml
index 715dd9f6..b6ff1c30 100644
--- a/src/controls/Styles/Android/ComboBoxStyle.qml
+++ b/src/controls/Styles/Android/ComboBoxStyle.qml
@@ -105,11 +105,11 @@ Style {
property Component __popupStyle: null
property Component __dropDownStyle: null
- property Component selectionHandle: DrawableLoader {
+ property Component __selectionHandle: DrawableLoader {
styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
x: -width / 4 * 3
y: styleData.lineHeight
}
- property Component cursorHandle: CursorHandleStyle { }
+ property Component __cursorHandle: CursorHandleStyle { }
}
diff --git a/src/controls/Styles/Android/SpinBoxStyle.qml b/src/controls/Styles/Android/SpinBoxStyle.qml
index 86fce034..5c05774f 100644
--- a/src/controls/Styles/Android/SpinBoxStyle.qml
+++ b/src/controls/Styles/Android/SpinBoxStyle.qml
@@ -98,11 +98,11 @@ Style {
}
}
- property Component selectionHandle: DrawableLoader {
+ property Component __selectionHandle: DrawableLoader {
styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
x: -width / 4 * 3
y: styleData.lineHeight
}
- property Component cursorHandle: CursorHandleStyle { }
+ property Component __cursorHandle: CursorHandleStyle { }
}
diff --git a/src/controls/Styles/Android/TextAreaStyle.qml b/src/controls/Styles/Android/TextAreaStyle.qml
index 61ea9fb8..85950efa 100644
--- a/src/controls/Styles/Android/TextAreaStyle.qml
+++ b/src/controls/Styles/Android/TextAreaStyle.qml
@@ -72,11 +72,11 @@ ScrollViewStyle {
styleDef: style.styleDef
}
- property Component selectionHandle: DrawableLoader {
+ property Component __selectionHandle: DrawableLoader {
styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
x: -width / 4 * 3
y: styleData.lineHeight
}
- property Component cursorHandle: CursorHandleStyle { }
+ property Component __cursorHandle: CursorHandleStyle { }
}
diff --git a/src/controls/Styles/Android/TextFieldStyle.qml b/src/controls/Styles/Android/TextFieldStyle.qml
index e7eec32c..67cd3b78 100644
--- a/src/controls/Styles/Android/TextFieldStyle.qml
+++ b/src/controls/Styles/Android/TextFieldStyle.qml
@@ -91,11 +91,11 @@ Style {
}
}
- property Component selectionHandle: DrawableLoader {
+ property Component __selectionHandle: DrawableLoader {
styleDef: AndroidStyle.styleDef.textViewStyle.TextView_textSelectHandleLeft
x: -width / 4 * 3
y: styleData.lineHeight
}
- property Component cursorHandle: CursorHandleStyle { }
+ property Component __cursorHandle: CursorHandleStyle { }
}
diff --git a/src/controls/Styles/Base/ComboBoxStyle.qml b/src/controls/Styles/Base/ComboBoxStyle.qml
index 77d2e91e..1a810772 100644
--- a/src/controls/Styles/Base/ComboBoxStyle.qml
+++ b/src/controls/Styles/Base/ComboBoxStyle.qml
@@ -280,7 +280,8 @@ Style {
property Component __scrollerStyle: null
}
- /*! The cursor handle.
+ /*! \internal
+ The cursor handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -297,9 +298,10 @@ Style {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component cursorHandle
+ property Component __cursorHandle
- /*! The selection handle.
+ /*! \internal
+ The selection handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -316,10 +318,11 @@ Style {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component selectionHandle
+ property Component __selectionHandle
- /*! The cursor delegate.
+ /*! \internal
+ The cursor delegate.
\since QtQuick.Controls.Styles 1.3
*/
- property Component cursorDelegate
+ property Component __cursorDelegate
}
diff --git a/src/controls/Styles/Base/SpinBoxStyle.qml b/src/controls/Styles/Base/SpinBoxStyle.qml
index 1bcb6b5c..d821940a 100644
--- a/src/controls/Styles/Base/SpinBoxStyle.qml
+++ b/src/controls/Styles/Base/SpinBoxStyle.qml
@@ -210,7 +210,8 @@ Style {
}
}
- /*! The cursor handle.
+ /*! \internal
+ The cursor handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -227,9 +228,10 @@ Style {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component cursorHandle
+ property Component __cursorHandle
- /*! The selection handle.
+ /*! \internal
+ The selection handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -246,10 +248,11 @@ Style {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component selectionHandle
+ property Component __selectionHandle
- /*! The cursor delegate.
+ /*! \internal
+ The cursor delegate.
\since QtQuick.Controls.Styles 1.3
*/
- property Component cursorDelegate
+ property Component __cursorDelegate
}
diff --git a/src/controls/Styles/Base/TextAreaStyle.qml b/src/controls/Styles/Base/TextAreaStyle.qml
index bd3ed31e..56a1ec58 100644
--- a/src/controls/Styles/Base/TextAreaStyle.qml
+++ b/src/controls/Styles/Base/TextAreaStyle.qml
@@ -104,7 +104,8 @@ ScrollViewStyle {
\sa TextArea::textMargin */
property real textMargin: 4
- /*! The cursor handle.
+ /*! \internal
+ The cursor handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -121,9 +122,10 @@ ScrollViewStyle {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component cursorHandle
+ property Component __cursorHandle
- /*! The selection handle.
+ /*! \internal
+ The selection handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -140,10 +142,11 @@ ScrollViewStyle {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component selectionHandle
+ property Component __selectionHandle
- /*! The cursor delegate.
+ /*! \internal
+ The cursor delegate.
\since QtQuick.Controls.Styles 1.3
*/
- property Component cursorDelegate
+ property Component __cursorDelegate
}
diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml
index c1e7a69f..4d0a66eb 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -157,7 +157,8 @@ Style {
}
}
- /*! The cursor handle.
+ /*! \internal
+ The cursor handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -174,9 +175,10 @@ Style {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component cursorHandle
+ property Component __cursorHandle
- /*! The selection handle.
+ /*! \internal
+ The selection handle.
\since QtQuick.Controls.Styles 1.3
The parent of the handle is positioned to the top left corner of
@@ -193,10 +195,11 @@ Style {
\row \li \b {styleData.hasSelection} : bool \li Whether the editor has selected text.
\endtable
*/
- property Component selectionHandle
+ property Component __selectionHandle
- /*! The cursor delegate.
+ /*! \internal
+ The cursor delegate.
\since QtQuick.Controls.Styles 1.3
*/
- property Component cursorDelegate
+ property Component __cursorDelegate
}
diff --git a/src/controls/Styles/iOS/ComboBoxStyle.qml b/src/controls/Styles/iOS/ComboBoxStyle.qml
index 147fd7fd..ba657298 100644
--- a/src/controls/Styles/iOS/ComboBoxStyle.qml
+++ b/src/controls/Styles/iOS/ComboBoxStyle.qml
@@ -42,7 +42,7 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3
ComboBoxStyle {
- selectionHandle: SelectionHandleStyle{}
- cursorHandle: CursorHandleStyle{}
- cursorDelegate: CursorDelegate{}
+ __selectionHandle: SelectionHandleStyle{}
+ __cursorHandle: CursorHandleStyle{}
+ __cursorDelegate: CursorDelegate{}
}
diff --git a/src/controls/Styles/iOS/SpinBoxStyle.qml b/src/controls/Styles/iOS/SpinBoxStyle.qml
index a764cb79..c898e5e9 100644
--- a/src/controls/Styles/iOS/SpinBoxStyle.qml
+++ b/src/controls/Styles/iOS/SpinBoxStyle.qml
@@ -42,7 +42,7 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3
SpinBoxStyle {
- selectionHandle: SelectionHandleStyle{}
- cursorHandle: CursorHandleStyle{}
- cursorDelegate: CursorDelegate{}
+ __selectionHandle: SelectionHandleStyle{}
+ __cursorHandle: CursorHandleStyle{}
+ __cursorDelegate: CursorDelegate{}
}
diff --git a/src/controls/Styles/iOS/TextAreaStyle.qml b/src/controls/Styles/iOS/TextAreaStyle.qml
index 6b8a1800..6be12be6 100644
--- a/src/controls/Styles/iOS/TextAreaStyle.qml
+++ b/src/controls/Styles/iOS/TextAreaStyle.qml
@@ -51,7 +51,7 @@ ScrollViewStyle {
property color selectedTextColor: SystemPaletteSingleton.highlightedText(control.enabled)
property color backgroundColor: control.backgroundVisible ? SystemPaletteSingleton.base(control.enabled) : "transparent"
property int renderType: Text.QtRendering
- property Component selectionHandle: SelectionHandleStyle{}
- property Component cursorHandle: CursorHandleStyle{}
- property Component cursorDelegate: CursorDelegate{}
+ property Component __selectionHandle: SelectionHandleStyle{}
+ property Component __cursorHandle: CursorHandleStyle{}
+ property Component __cursorDelegate: CursorDelegate{}
}
diff --git a/src/controls/Styles/iOS/TextFieldStyle.qml b/src/controls/Styles/iOS/TextFieldStyle.qml
index 28ad692f..ca237a0a 100644
--- a/src/controls/Styles/iOS/TextFieldStyle.qml
+++ b/src/controls/Styles/iOS/TextFieldStyle.qml
@@ -42,7 +42,7 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3
TextFieldStyle {
- selectionHandle: SelectionHandleStyle{}
- cursorHandle: CursorHandleStyle{}
- cursorDelegate: CursorDelegate{}
+ __selectionHandle: SelectionHandleStyle{}
+ __cursorHandle: CursorHandleStyle{}
+ __cursorDelegate: CursorDelegate{}
}
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index 8acdb6dc..c644230d 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -718,7 +718,7 @@ ScrollView {
TextEdit {
id: edit
focus: true
- cursorDelegate: __style && __style.cursorDelegate ? __style.cursorDelegate : null
+ cursorDelegate: __style && __style.__cursorDelegate ? __style.__cursorDelegate : null
Rectangle {
id: colorRect
@@ -885,7 +885,7 @@ ScrollView {
z: 1 // above scrollbars
parent: Qt.platform.os === "ios" ? editor : __scroller // no clip
active: area.selectByMouse
- delegate: __style.selectionHandle
+ delegate: __style.__selectionHandle
maximum: cursorHandle.position - 1
// Mention contentX and contentY in the mappedPos binding to force re-evaluation if they change
@@ -921,7 +921,7 @@ ScrollView {
z: 1 // above scrollbars
parent: Qt.platform.os === "ios" ? editor : __scroller // no clip
active: area.selectByMouse
- delegate: __style.cursorHandle
+ delegate: __style.__cursorHandle
minimum: edit.hasSelection ? selectionHandle.position + 1 : -1
// Mention contentX and contentY in the mappedPos binding to force re-evaluation if they change
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index a7aa67eb..5c1e5e51 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -633,8 +633,8 @@ Control {
selectedTextColor: __panel ? __panel.selectedTextColor : "white"
control: textfield
- cursorHandle: __style ? __style.cursorHandle : undefined
- selectionHandle: __style ? __style.selectionHandle : undefined
+ cursorHandle: __style ? __style.__cursorHandle : undefined
+ selectionHandle: __style ? __style.__selectionHandle : undefined
font: __panel ? __panel.font : TextSingleton.font
anchors.leftMargin: __panel ? __panel.leftMargin : 0
diff --git a/tests/manual/texthandles/main.qml b/tests/manual/texthandles/main.qml
index ab10b861..5a520d17 100644
--- a/tests/manual/texthandles/main.qml
+++ b/tests/manual/texthandles/main.qml
@@ -105,8 +105,8 @@ ApplicationWindow {
selectByMouse: selectBox.checked
style: TextFieldStyle {
- cursorHandle: handleBox.checked ? cursorDelegate : null
- selectionHandle: handleBox.checked ? selectionDelegate : null
+ __cursorHandle: handleBox.checked ? cursorDelegate : null
+ __selectionHandle: handleBox.checked ? selectionDelegate : null
}
}
@@ -121,8 +121,8 @@ ApplicationWindow {
horizontalAlignment: Qt.AlignHCenter
style: SpinBoxStyle {
- cursorHandle: handleBox.checked ? cursorDelegate : null
- selectionHandle: handleBox.checked ? selectionDelegate : null
+ __cursorHandle: handleBox.checked ? cursorDelegate : null
+ __selectionHandle: handleBox.checked ? selectionDelegate : null
}
}
@@ -148,8 +148,8 @@ ApplicationWindow {
}
style: ComboBoxStyle {
- cursorHandle: handleBox.checked ? cursorDelegate : null
- selectionHandle: handleBox.checked ? selectionDelegate : null
+ __cursorHandle: handleBox.checked ? cursorDelegate : null
+ __selectionHandle: handleBox.checked ? selectionDelegate : null
}
}
@@ -164,8 +164,8 @@ ApplicationWindow {
text: loremIpsum + "<p>" + loremIpsum + "<p>" + loremIpsum + "<p>" + loremIpsum
style: TextAreaStyle {
- cursorHandle: handleBox.checked ? cursorDelegate : null
- selectionHandle: handleBox.checked ? selectionDelegate : null
+ __cursorHandle: handleBox.checked ? cursorDelegate : null
+ __selectionHandle: handleBox.checked ? selectionDelegate : null
}
}
}