diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-02-03 11:42:07 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-02-03 11:42:07 (GMT) |
commit | 5f11d2125b9cc37768fb8174870ced5934cdacf2 (patch) | |
tree | 4cc1a0ef3bb9b11552a1477efbcc6c79fe75666b | |
parent | 944e9946f9541dead8319dcc9e4e49f41c8c40b1 (diff) | |
download | Qt-5f11d2125b9cc37768fb8174870ced5934cdacf2.zip Qt-5f11d2125b9cc37768fb8174870ced5934cdacf2.tar.gz Qt-5f11d2125b9cc37768fb8174870ced5934cdacf2.tar.bz2 |
Focus focusScope from focusing for focusOnPress
Task-number: QTBUG-6739
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstextedit.cpp | 11 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstextinput.cpp | 10 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp index 6e14d3a..c3495b3 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp @@ -784,8 +784,17 @@ Handles the given mouse \a event. void QmlGraphicsTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QmlGraphicsTextEdit); - if (d->focusOnPress) + if (d->focusOnPress){ + QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? + while(p) { + if(p->flags() & QGraphicsItem::ItemIsFocusScope){ + p->setFocus(); + break; + } + p = p->parentItem(); + } setFocus(true); + } d->control->processEvent(event, QPointF(0, 0)); if (!event->isAccepted()) QmlGraphicsPaintedItem::mousePressEvent(event); diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp index 6068e93..cfb93f6 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp @@ -647,9 +647,15 @@ void QmlGraphicsTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QmlGraphicsTextInput); if(d->focusOnPress){ + QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? + while(p) { + if(p->flags() & QGraphicsItem::ItemIsFocusScope){ + p->setFocus(); + break; + } + p = p->parentItem(); + } setFocus(true); - setCursorVisible(true); - d->focused = true; } d->control->processEvent(event); } |