diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-06-16 10:27:53 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-06-16 10:27:53 (GMT) |
commit | 59ec66675b725f56111e4b133e79828bc6d5d95a (patch) | |
tree | a0e4f04f62d59fa2aa07c4d9c4102284de5574e9 /src | |
parent | 50f4129a2664ed72de899f4477b47f91488c04d9 (diff) | |
download | Qt-59ec66675b725f56111e4b133e79828bc6d5d95a.zip Qt-59ec66675b725f56111e4b133e79828bc6d5d95a.tar.gz Qt-59ec66675b725f56111e4b133e79828bc6d5d95a.tar.bz2 |
Write TextInput.positionToRectangle docs.
Also renamed the argument to be more accurate.
Task-number: QTBUG-11168
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 12 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput_p.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 033e12c..9e5dfb5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -845,12 +845,18 @@ void QDeclarativeTextInput::moveCursor() } /*! - \qmlmethod rect TextInput::positionToRectangle(int x) + \qmlmethod rect TextInput::positionToRectangle(int pos) + + This function takes a character position and returns the rectangle that the + cursor would occupy, if it was placed at that character position. + + This is similar to setting the cursorPosition, and then querying the cursor + rectangle, but the cursorPosition is not changed. */ -QRectF QDeclarativeTextInput::positionToRectangle(int x) const +QRectF QDeclarativeTextInput::positionToRectangle(int pos) const { Q_D(const QDeclarativeTextInput); - return QRectF(d->control->cursorToX(x)-d->hscroll, + return QRectF(d->control->cursorToX(pos)-d->hscroll, 0.0, d->control->cursorWidth(), cursorRectangle().height()); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index c539bd3..03f55ae 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -112,7 +112,7 @@ public: //Auxilliary functions needed to control the TextInput from QML Q_INVOKABLE int positionAt(int x) const; - Q_INVOKABLE QRectF positionToRectangle(int x) const; + Q_INVOKABLE QRectF positionToRectangle(int pos) const; Q_INVOKABLE void moveCursorSelection(int pos); Q_INVOKABLE void openSoftwareInputPanel(); |