summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2014-06-26 16:15:55 +0200
committerJ-P Nurmi <jpnurmi@digia.com>2014-07-01 16:12:44 +0200
commite9ec17508e09d633c563d53cd43c2b7ef0fab82d (patch)
tree5d4bb45b264c8bfa1d3c9c3c2268330bc7224814 /src
parent3e4d0ed66b2f8f3cf7b9af9f14af67c045b94682 (diff)
downloadqtquickcontrols-e9ec17508e09d633c563d53cd43c2b7ef0fab82d.tar.gz
TextField/AreaStyle: add styleData.activated() signal for handles
This makes it possible for the Android style to implement "transient" handles that fade out when idle, and show up when the editor is clicked Change-Id: I53da6a4d5345c98b8b7286b30006982eaf17df45 Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/Private/TextHandle.qml6
-rw-r--r--src/controls/Styles/Base/TextAreaStyle.qml6
-rw-r--r--src/controls/Styles/Base/TextFieldStyle.qml6
-rw-r--r--src/controls/TextArea.qml2
-rw-r--r--src/controls/TextField.qml2
5 files changed, 18 insertions, 4 deletions
diff --git a/src/controls/Private/TextHandle.qml b/src/controls/Private/TextHandle.qml
index 90fceced..3fc6256a 100644
--- a/src/controls/Private/TextHandle.qml
+++ b/src/controls/Private/TextHandle.qml
@@ -57,12 +57,18 @@ Loader {
property Item control
property QtObject styleData: QtObject {
+ id: styleData
+ signal activated()
readonly property alias pressed: mouse.pressed
readonly property alias position: handle.position
readonly property real lineHeight: position !== -1 ? editor.positionToRectangle(position).height
: editor.cursorRectangle.height
}
+ function activate() {
+ styleData.activated()
+ }
+
MouseArea {
id: mouse
anchors.fill: item
diff --git a/src/controls/Styles/Base/TextAreaStyle.qml b/src/controls/Styles/Base/TextAreaStyle.qml
index 301ac165..f6bceabc 100644
--- a/src/controls/Styles/Base/TextAreaStyle.qml
+++ b/src/controls/Styles/Base/TextAreaStyle.qml
@@ -104,9 +104,10 @@ ScrollViewStyle {
the cursor position. The interactive area is determined by the
geometry of the handle delegate.
- The following read-only properties are available within the scope
+ The following signals and read-only properties are available within the scope
of the handle delegate:
\table
+ \row \li \b {styleData.activated()} [signal] \li Emitted when the handle is activated ie. the editor is clicked.
\row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
\row \li \b {styleData.position} : int \li The character position of the handle.
\row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
@@ -121,9 +122,10 @@ ScrollViewStyle {
the first selected character. The interactive area is determined
by the geometry of the handle delegate.
- The following read-only properties are available within the scope
+ The following signals and read-only properties are available within the scope
of the handle delegate:
\table
+ \row \li \b {styleData.activated()} [signal] \li Emitted when the handle is activated ie. the editor is clicked.
\row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
\row \li \b {styleData.position} : int \li The character position of the handle.
\row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
diff --git a/src/controls/Styles/Base/TextFieldStyle.qml b/src/controls/Styles/Base/TextFieldStyle.qml
index f33d4876..13970867 100644
--- a/src/controls/Styles/Base/TextFieldStyle.qml
+++ b/src/controls/Styles/Base/TextFieldStyle.qml
@@ -162,9 +162,10 @@ Style {
the cursor position. The interactive area is determined by the
geometry of the handle delegate.
- The following read-only properties are available within the scope
+ The following signals and read-only properties are available within the scope
of the handle delegate:
\table
+ \row \li \b {styleData.activated()} [signal] \li Emitted when the handle is activated ie. the editor is clicked.
\row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
\row \li \b {styleData.position} : int \li The character position of the handle.
\row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
@@ -179,9 +180,10 @@ Style {
the first selected character. The interactive area is determined
by the geometry of the handle delegate.
- The following read-only properties are available within the scope
+ The following signals and read-only properties are available within the scope
of the handle delegate:
\table
+ \row \li \b {styleData.activated()} [signal] \li Emitted when the handle is activated ie. the editor is clicked.
\row \li \b {styleData.pressed} : bool \li Whether the handle is pressed.
\row \li \b {styleData.position} : int \li The character position of the handle.
\row \li \b {styleData.lineHeight} : real \li The height of the line the handle is on.
diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml
index aa02cb14..d09b6d02 100644
--- a/src/controls/TextArea.qml
+++ b/src/controls/TextArea.qml
@@ -812,6 +812,8 @@ ScrollView {
if (!readOnly)
Qt.inputMethod.show()
}
+ cursorHandle.activate()
+ selectionHandle.activate()
}
function moveHandles(cursor, selection) {
diff --git a/src/controls/TextField.qml b/src/controls/TextField.qml
index f25b8195..dfadd78d 100644
--- a/src/controls/TextField.qml
+++ b/src/controls/TextField.qml
@@ -672,6 +672,8 @@ Control {
if (!readOnly)
Qt.inputMethod.show()
}
+ cursorHandle.activate()
+ selectionHandle.activate()
}
function moveHandles(cursor, selection) {