summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2010-03-31 04:28:59 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2010-03-31 07:04:43 (GMT)
commit93ae014d7ee06a6ebb701420fffef5895cd731c4 (patch)
tree4fb5872be0d96587a009cd1bf3d2da35df407c9c /src/gui/graphicsview
parent525e6207b5e5c9cce82ed6e76a65571f56971f92 (diff)
downloadQt-93ae014d7ee06a6ebb701420fffef5895cd731c4.zip
Qt-93ae014d7ee06a6ebb701420fffef5895cd731c4.tar.gz
Qt-93ae014d7ee06a6ebb701420fffef5895cd731c4.tar.bz2
Add a QGraphicsItem::updateMicroFocus() to QGraphicsItem.
QGraphicsItem is no more lacking a way to notify the input method of a changed micro focus. Reviewed-by:denis Reviewed-by:simon hausmann
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp34
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h4
2 files changed, 38 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 02a1ecb..71f248d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -731,6 +731,9 @@
#include <QtGui/qevent.h>
#include <QtGui/qinputcontext.h>
#include <QtGui/qgraphicseffect.h>
+#ifndef QT_NO_ACCESSIBILITY
+# include "qaccessible.h"
+#endif
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicswidget_p.h>
@@ -738,6 +741,7 @@
#include <private/qtextdocumentlayout_p.h>
#include <private/qtextengine_p.h>
#include <private/qwidget_p.h>
+#include <private/qapplication_p.h>
#ifdef Q_WS_X11
#include <private/qt_x11_p.h>
@@ -7305,6 +7309,31 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
}
/*!
+ Updates the item's micro focus.
+
+ \since 4.7
+
+ \sa QInputContext
+*/
+void QGraphicsItem::updateMicroFocus()
+{
+#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN))
+ if (QWidget *fw = qApp->focusWidget()) {
+ if (qt_widget_private(fw)->ic || qApp->d_func()->inputContext) {
+ if (QInputContext *ic = fw->inputContext()) {
+ if (ic)
+ ic->update();
+ }
+ }
+#ifndef QT_NO_ACCESSIBILITY
+ // ##### is this correct
+ QAccessible::updateAccessibility(fw, 0, QAccessible::StateChanged);
+#endif
+ }
+#endif
+}
+
+/*!
This virtual function is called by QGraphicsItem to notify custom items
that some part of the item's state changes. By reimplementing this
function, your can react to a change, and in some cases, (depending on \a
@@ -7580,6 +7609,11 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
}
}
+void QGraphicsObject::updateMicroFocus()
+{
+ QGraphicsItem::updateMicroFocus();
+}
+
void QGraphicsItemPrivate::append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item)
{
QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast<QGraphicsObject *>(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0);
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index 2c45b62..9cc75af 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -424,6 +424,7 @@ public:
void removeSceneEventFilter(QGraphicsItem *filterItem);
protected:
+ void updateMicroFocus();
virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
virtual bool sceneEvent(QEvent *event);
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
@@ -571,6 +572,9 @@ public:
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
+protected Q_SLOTS:
+ void updateMicroFocus();
+
Q_SIGNALS:
void parentChanged();
void opacityChanged();