Adapt QGraphicsView from QInputContext to QInputPanel
Change-Id: Icbb458af7914f0af3e37ac012aa7c1cbd5f3a023 Reviewed-on: http://codereview.qt-project.org/5631 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>bb10
parent
940a526fc6
commit
d0968472c6
|
|
@ -742,7 +742,7 @@
|
|||
#include <QtGui/qpixmapcache.h>
|
||||
#include <QtWidgets/qstyleoption.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtWidgets/qinputcontext.h>
|
||||
#include <QtGui/qinputpanel.h>
|
||||
#include <QtWidgets/qgraphicseffect.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
# include "qaccessible.h"
|
||||
|
|
@ -7373,15 +7373,10 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
|
|||
if (!hasFocus())
|
||||
return;
|
||||
d->scene->d_func()->updateInputMethodSensitivityInViews();
|
||||
#if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN))
|
||||
QWidget *fw = QApplication::focusWidget();
|
||||
if (!fw)
|
||||
return;
|
||||
for (int i = 0 ; i < scene()->views().count() ; ++i)
|
||||
if (scene()->views().at(i) == fw)
|
||||
if (QInputContext *inputContext = fw->inputContext())
|
||||
inputContext->update();
|
||||
#endif
|
||||
qApp->inputPanel()->update(Qt::ImHints);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
@ -7398,14 +7393,15 @@ void QGraphicsItem::updateMicroFocus()
|
|||
if (scene()) {
|
||||
for (int i = 0 ; i < scene()->views().count() ; ++i) {
|
||||
if (scene()->views().at(i) == fw) {
|
||||
if (QInputContext *inputContext = fw->inputContext()) {
|
||||
inputContext->update();
|
||||
if (qApp)
|
||||
qApp->inputPanel()->update(Qt::ImQueryAll);
|
||||
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
// ##### is this correct
|
||||
if (toGraphicsObject())
|
||||
QAccessible::updateAccessibility(toGraphicsObject(), 0, QAccessible::StateChanged);
|
||||
// ##### is this correct
|
||||
if (toGraphicsObject())
|
||||
QAccessible::updateAccessibility(toGraphicsObject(), 0, QAccessible::StateChanged);
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10206,15 +10202,12 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event)
|
|||
case QEvent::KeyRelease:
|
||||
// Reset the focus widget's input context, regardless
|
||||
// of how this item gained or lost focus.
|
||||
if (QWidget *fw = qApp->focusWidget()) {
|
||||
#ifndef QT_NO_IM
|
||||
if (QInputContext *qic = fw->inputContext()) {
|
||||
if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut)
|
||||
qic->reset();
|
||||
else
|
||||
qic->update();
|
||||
}
|
||||
#endif //QT_NO_IM
|
||||
if (event->type() == QEvent::FocusIn) {
|
||||
qApp->inputPanel()->reset();
|
||||
} else if (event->type() == QEvent::FocusOut) {
|
||||
qApp->inputPanel()->commit();
|
||||
} else {
|
||||
qApp->inputPanel()->update(Qt::ImQueryInput);
|
||||
}
|
||||
break;
|
||||
case QEvent::ShortcutOverride:
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@
|
|||
#include <QtWidgets/qstyleoption.h>
|
||||
#include <QtWidgets/qtooltip.h>
|
||||
#include <QtGui/qtransform.h>
|
||||
#include <QtWidgets/qinputcontext.h>
|
||||
#include <QtGui/qinputpanel.h>
|
||||
#include <QtWidgets/qgraphicseffect.h>
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
# include <QtWidgets/qaccessible.h>
|
||||
|
|
@ -821,9 +821,8 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
|
|||
// automatically by removing WA_InputMethodEnabled on
|
||||
// the views, but if we are changing focus, we have to
|
||||
// do it ourselves.
|
||||
for (int i = 0; i < views.size(); ++i)
|
||||
if (views.at(i)->inputContext())
|
||||
views.at(i)->inputContext()->reset();
|
||||
if (qApp)
|
||||
qApp->inputPanel()->commit();
|
||||
}
|
||||
|
||||
focusItem = 0;
|
||||
|
|
|
|||
|
|
@ -280,7 +280,6 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
|
|||
#include <QtGui/qpainter.h>
|
||||
#include <QtWidgets/qscrollbar.h>
|
||||
#include <QtWidgets/qstyleoption.h>
|
||||
#include <QtWidgets/qinputcontext.h>
|
||||
#ifdef Q_WS_X11
|
||||
#include <QtGui/qpaintengine.h>
|
||||
#include <private/qt_x11_p.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue