From 2107870f75362eed07d353b6b171878713c7cfd3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 11 Nov 2009 15:12:42 +0100 Subject: Fix S60 input method not showing up in editable QGraphicsTextItems Correctly set the ItemAcceptsInputMethod flag in setTextInteractionFlags. Reviewed-by: Andreas Reviewed-by: axis Reviewed-by: Janne Koskinen --- src/gui/graphicsview/qgraphicsitem.cpp | 5 +++-- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2685b86..cf2e2b1 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10046,9 +10046,10 @@ bool QGraphicsTextItemPrivate::_q_mouseOnEdge(QGraphicsSceneMouseEvent *event) void QGraphicsTextItem::setTextInteractionFlags(Qt::TextInteractionFlags flags) { if (flags == Qt::NoTextInteraction) - setFlags(this->flags() & ~QGraphicsItem::ItemIsFocusable); + setFlags(this->flags() & ~(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod)); else - setFlags(this->flags() | QGraphicsItem::ItemIsFocusable); + setFlags(this->flags() | QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod); + dd->textControl()->setTextInteractionFlags(flags); } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index dcad8e1..6c32138 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4074,8 +4074,11 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsTextItem() QCOMPARE(text->pos(), QPointF(10, 10)); + text->setTextInteractionFlags(Qt::NoTextInteraction); + QVERIFY(!(text->flags() & QGraphicsItem::ItemAcceptsInputMethod)); text->setTextInteractionFlags(Qt::TextEditorInteraction); QCOMPARE(text->textInteractionFlags(), Qt::TextInteractionFlags(Qt::TextEditorInteraction)); + QVERIFY(text->flags() & QGraphicsItem::ItemAcceptsInputMethod); { QGraphicsSceneMouseEvent event2(QEvent::GraphicsSceneMouseMove); -- cgit v0.12