diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-06-02 01:19:47 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-06-02 01:19:47 (GMT) |
commit | 850efd1651acbec1f99fc3b7f35307a88504327b (patch) | |
tree | 3a94e6e68d948de3ffb9ff17bd184624a95c61e1 /src/declarative | |
parent | 9cb0802cede5f9fd91ca303bcec5ae869acae951 (diff) | |
download | Qt-850efd1651acbec1f99fc3b7f35307a88504327b.zip Qt-850efd1651acbec1f99fc3b7f35307a88504327b.tar.gz Qt-850efd1651acbec1f99fc3b7f35307a88504327b.tar.bz2 |
More autoScroll fixes
Task-number: QTBUG-11143
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 19 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput_p.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 7b96c0c..91ef0a2 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -891,6 +891,22 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) QDeclarativePaintedItem::keyPressEvent(ev); } +/*! +\overload +Handles the given mouse \a event. +*/ +void QDeclarativeTextInput::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeTextInput); + if (d->selectByMouse) { + int cursor = d->xToPos(event->pos().x()); + d->control->selectWordAtPos(cursor); + event->setAccepted(true); + } else { + QDeclarativePaintedItem::mouseDoubleClickEvent(event); + } +} + void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); @@ -949,10 +965,9 @@ bool QDeclarativeTextInput::event(QEvent* ev) case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: + case QEvent::GraphicsSceneMouseDoubleClick: break; default: - if (ev->type() == QEvent::GraphicsSceneMouseDoubleClick && !d->selectByMouse) - break; handled = d->control->processEvent(ev); if (ev->type() == QEvent::InputMethod) updateSize(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 6bc6fc4..4b857ca 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -225,6 +225,7 @@ protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void keyPressEvent(QKeyEvent* ev); bool event(QEvent *e); void focusInEvent(QFocusEvent *event); |