summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetextinput.cpp
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-05-19 07:10:14 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-05-19 07:10:14 (GMT)
commitd395903e4d061a30117f7b925bdad41771a29067 (patch)
treee7e2e2d09afc77af51197f5d4954249b21ee9a44 /src/declarative/graphicsitems/qdeclarativetextinput.cpp
parent8238ef5d6648ca8fde2c709d6125772cac6a11a5 (diff)
parentf5588a2177452de29804e67ae8cd45c50f6dfdba (diff)
downloadQt-d395903e4d061a30117f7b925bdad41771a29067.zip
Qt-d395903e4d061a30117f7b925bdad41771a29067.tar.gz
Qt-d395903e4d061a30117f7b925bdad41771a29067.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts: doc/src/snippets/declarative/listview/highlight.qml doc/src/snippets/declarative/listview/listview.qml
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextinput.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 8aa7e99..2e7715f 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -907,8 +907,12 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativeTextInput);
- d->control->moveCursor(d->xToPos(event->pos().x()), true);
- event->setAccepted(true);
+ if (d->selectByMouse) {
+ d->control->moveCursor(d->xToPos(event->pos().x()), true);
+ event->setAccepted(true);
+ } else {
+ QDeclarativePaintedItem::mouseMoveEvent(event);
+ }
}
/*!
@@ -939,6 +943,8 @@ bool QDeclarativeTextInput::event(QEvent* ev)
case QEvent::GraphicsSceneMouseRelease:
break;
default:
+ if (ev->type() == QEvent::GraphicsSceneMouseDoubleClick && !d->selectByMouse)
+ break;
handled = d->control->processEvent(ev);
if (ev->type() == QEvent::InputMethod)
updateSize();
@@ -1114,6 +1120,32 @@ QString QDeclarativeTextInput::displayText() const
}
/*!
+ \qmlproperty string TextInput::selectByMouse
+
+ Defaults to false.
+
+ If true, the user can use the mouse to select text in some
+ platform-specific way. Note that for some platforms this may
+ not be an appropriate interaction (eg. may conflict with how
+ the text needs to behave inside a Flickable.
+*/
+bool QDeclarativeTextInput::selectByMouse() const
+{
+ Q_D(const QDeclarativeTextInput);
+ return d->selectByMouse;
+}
+
+void QDeclarativeTextInput::setSelectByMouse(bool on)
+{
+ Q_D(QDeclarativeTextInput);
+ if (d->selectByMouse != on) {
+ d->selectByMouse = on;
+ emit selectByMouseChanged(on);
+ }
+}
+
+
+/*!
\qmlmethod void TextInput::moveCursorSelection(int position)
Moves the cursor to \a position and updates the selection accordingly.