diff options
author | jasplin <qt-info@nokia.com> | 2009-07-03 13:40:20 (GMT) |
---|---|---|
committer | jasplin <qt-info@nokia.com> | 2009-07-03 14:04:04 (GMT) |
commit | 7bc98d7bd7aabc6086e5cd27a167769d7aa71d83 (patch) | |
tree | d90f7a01a905212f9e96fbb14b41322172100548 /src/gui/graphicsview/qgraphicsproxywidget.cpp | |
parent | ccdf924d01cbcb716ed25862561bb94d53ffed1f (diff) | |
download | Qt-7bc98d7bd7aabc6086e5cd27a167769d7aa71d83.zip Qt-7bc98d7bd7aabc6086e5cd27a167769d7aa71d83.tar.gz Qt-7bc98d7bd7aabc6086e5cd27a167769d7aa71d83.tar.bz2 |
Improved the support for input methods in Graphics View.
This patch improves the graphics view support for input
methods in several ways:
* A new ItemAcceptsInputMethod flag is introduced to serve
the same purpose for graphics items as WA_InputMethodEnabled
does for widgets: Input method support can be controlled
individually for each item.
* The input method sensitivity of a view (i.e. the value of
the WA_InputMethodEnabled flag) is updated dynamically
whenever the input method support of the current focus
item may change.
* Input contexts are reset whenever an item that supports
input methods loses focus.
Reviewed-by: janarve
Task-number: 254492
Diffstat (limited to 'src/gui/graphicsview/qgraphicsproxywidget.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsproxywidget.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 0b421ad..5fac6cf 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -451,6 +451,22 @@ void QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget() /*! \internal +*/ +void QGraphicsProxyWidgetPrivate::updateProxyInputMethodAcceptanceFromWidget() +{ + Q_Q(QGraphicsProxyWidget); + if (!widget) + return; + + QWidget *focusWidget = widget->focusWidget(); + if (!focusWidget) + focusWidget = widget; + q->setFlag(QGraphicsItem::ItemAcceptsInputMethod, + focusWidget->testAttribute(Qt::WA_InputMethodEnabled)); +} + +/*! + \internal Embeds \a subWin as a subwindow of this proxy widget. \a subWin must be a top-level widget and a descendant of the widget managed by this proxy. A separate subproxy @@ -690,6 +706,8 @@ void QGraphicsProxyWidgetPrivate::setWidget_helper(QWidget *newWidget, bool auto updateProxyGeometryFromWidget(); + updateProxyInputMethodAcceptanceFromWidget(); + // Hook up the event filter to keep the state up to date. newWidget->installEventFilter(q); QObject::connect(newWidget, SIGNAL(destroyed()), q, SLOT(_q_removeWidgetSlot())); @@ -1303,8 +1321,8 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event) if (d->widget && d->widget->focusWidget()) { d->widget->focusWidget()->setFocus(event->reason()); return; - } - break; + } + break; } } |