summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxtextedit.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-06 06:22:56 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-06 06:22:56 (GMT)
commitcc5a322cbfa9ae84a6114ef7c171d7e119e6a86c (patch)
tree94dc68061fc5e2e8deb62cff92b5d180e6805a2f /src/declarative/fx/qfxtextedit.cpp
parent395169a94dba47baec683c95874de9556ba4952d (diff)
downloadQt-cc5a322cbfa9ae84a6114ef7c171d7e119e6a86c.zip
Qt-cc5a322cbfa9ae84a6114ef7c171d7e119e6a86c.tar.gz
Qt-cc5a322cbfa9ae84a6114ef7c171d7e119e6a86c.tar.bz2
Make TextEdit's cursor position usable from Qml.
Diffstat (limited to 'src/declarative/fx/qfxtextedit.cpp')
-rw-r--r--src/declarative/fx/qfxtextedit.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 7f08fba..3778e9a 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -410,7 +410,7 @@ void QFxTextEdit::setWrap(bool w)
}
/*!
- \property QFxTextEdit::cursorVisible
+ \qmlproperty TextEdit::cursorVisible
\brief If true the text edit shows a cursor.
This property is set and unset when the text edit gets focus, but it can also
@@ -435,6 +435,25 @@ void QFxTextEdit::setCursorVisible(bool on)
}
/*!
+ \qmlproperty TextEdit::cursorPosition
+ \brief The position of the cursor in the TextEdit.
+*/
+int QFxTextEdit::cursorPosition() const
+{
+ Q_D(const QFxTextEdit);
+ return d->control->textCursor().position();
+}
+
+void QFxTextEdit::setCursorPosition(int pos)
+{
+ Q_D(QFxTextEdit);
+ QTextCursor cursor = d->control->textCursor();
+ if (cursor.position() == pos)
+ return;
+ cursor.setPosition(pos);
+}
+
+/*!
\qmlproperty bool TextEdit::focusOnPress
Whether the TextEdit should gain focus on a mouse press. By default this is