diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-05-12 08:20:18 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-05-13 00:21:51 (GMT) |
commit | d45c45432ccd0a74c67e70ce5fc3a09f35923c26 (patch) | |
tree | a10c42eb95a036ab66d26fae5a4f83261c5aef46 /src/declarative/graphicsitems/qdeclarativetextinput.cpp | |
parent | f17c706db16aae93f024e88208e139063f5b2c7c (diff) | |
download | Qt-d45c45432ccd0a74c67e70ce5fc3a09f35923c26.zip Qt-d45c45432ccd0a74c67e70ce5fc3a09f35923c26.tar.gz Qt-d45c45432ccd0a74c67e70ce5fc3a09f35923c26.tar.bz2 |
Fix TextEdit and TextInput input panel support for mode RSIP_OnMouseClickAndAlreadyFocused
Task-number:
Reviewed-by: Warwick Allison
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextinput.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 8f86aa0..afbaaac 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -882,6 +882,7 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); + bool hadFocus = hasFocus(); if(d->focusOnPress){ QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { @@ -893,15 +894,20 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) } setFocus(true); } + if (!hadFocus && hasFocus()) + d->clickCausedFocus = true; + bool mark = event->modifiers() & Qt::ShiftModifier; int cursor = d->xToPos(event->pos().x()); d->control->moveCursor(cursor, mark); + event->setAccepted(true); } void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); d->control->moveCursor(d->xToPos(event->pos().x()), true); + event->setAccepted(true); } /*! @@ -913,8 +919,10 @@ void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_D(QDeclarativeTextInput); QWidget *widget = event->widget(); if (widget && !d->control->isReadOnly() && boundingRect().contains(event->pos())) - qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->focusOnPress); - d->control->processEvent(event); + qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); + d->clickCausedFocus = false; + if (!event->isAccepted()) + QDeclarativePaintedItem::mouseReleaseEvent(event); } bool QDeclarativeTextInput::event(QEvent* ev) @@ -935,8 +943,8 @@ bool QDeclarativeTextInput::event(QEvent* ev) updateSize(); } if(!handled) - return QDeclarativePaintedItem::event(ev); - return true; + handled = QDeclarativePaintedItem::event(ev); + return handled; } void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry, |