summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
authorA-Team <ateam@pad.test.qt.nokia.com>2010-12-20 23:00:22 (GMT)
committerA-Team <ateam@pad.test.qt.nokia.com>2010-12-20 23:00:22 (GMT)
commit6e8ee41d64fe0dfa86995402954b2cbfede48d21 (patch)
treec9dac16f9b43f224c7d320674ad433642afe13ec /src/declarative/graphicsitems
parent7317b84067387b6b0350a28d6c63e8d7f6945829 (diff)
parent987a683ff51997cb23cb931af99c6554651742d7 (diff)
downloadQt-6e8ee41d64fe0dfa86995402954b2cbfede48d21.zip
Qt-6e8ee41d64fe0dfa86995402954b2cbfede48d21.tar.gz
Qt-6e8ee41d64fe0dfa86995402954b2cbfede48d21.tar.bz2
Merge branch '4.7-upstream' into 4.7-doc
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index e05f4e4..4e16d24 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -643,6 +643,8 @@ int QDeclarativeTextEdit::cursorPosition() const
void QDeclarativeTextEdit::setCursorPosition(int pos)
{
Q_D(QDeclarativeTextEdit);
+ if (pos < 0 || pos > d->text.length())
+ return;
QTextCursor cursor = d->control->textCursor();
if (cursor.position() == pos)
return;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index df103de..521e4ab 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -437,6 +437,8 @@ int QDeclarativeTextInput::cursorPosition() const
void QDeclarativeTextInput::setCursorPosition(int cp)
{
Q_D(QDeclarativeTextInput);
+ if (cp < 0 || cp > d->control->text().length())
+ return;
d->control->moveCursor(cp);
}