summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp24
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp22
3 files changed, 48 insertions, 10 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 2161e23..b618183 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -726,8 +726,18 @@ void QDeclarativeTextInput::setEchoMode(QDeclarativeTextInput::EchoMode echo)
Q_D(QDeclarativeTextInput);
if (echoMode() == echo)
return;
-
+ Qt::InputMethodHints imHints = inputMethodHints();
+ if (echo == Password || echo == NoEcho)
+ imHints |= Qt::ImhHiddenText;
+ else
+ imHints &= ~Qt::ImhHiddenText;
+ if (echo != Normal)
+ imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
+ else
+ imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
+ setInputMethodHints(imHints);
d->control->setEchoMode((uint)echo);
+ update();
emit echoModeChanged(echoMode());
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 6cc3f7d..326f130 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7325,6 +7325,18 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
{
Q_D(QGraphicsItem);
d->imHints = 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
}
/*!
@@ -7337,13 +7349,11 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
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();
- }
- }
+ if (QWidget *fw = QApplication::focusWidget()) {
+ for (int i = 0 ; i < scene()->views().count() ; ++i)
+ if (scene()->views().at(i) == fw)
+ if (QInputContext *inputContext = fw->inputContext())
+ inputContext->update();
#ifndef QT_NO_ACCESSIBILITY
// ##### is this correct
QAccessible::updateAccessibility(fw, 0, QAccessible::StateChanged);
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 114de85..c951dce 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -1037,10 +1037,28 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
void QGraphicsViewPrivate::updateInputMethodSensitivity()
{
Q_Q(QGraphicsView);
- bool enabled = scene && scene->focusItem()
- && (scene->focusItem()->flags() & QGraphicsItem::ItemAcceptsInputMethod);
+ QGraphicsItem *focusItem = 0;
+ bool enabled = scene && (focusItem = scene->focusItem())
+ && (focusItem->d_ptr->flags & QGraphicsItem::ItemAcceptsInputMethod);
q->setAttribute(Qt::WA_InputMethodEnabled, enabled);
q->viewport()->setAttribute(Qt::WA_InputMethodEnabled, enabled);
+
+ if (!enabled) {
+ q->setInputMethodHints(0);
+ return;
+ }
+
+ QGraphicsProxyWidget *proxy = focusItem->d_ptr->isWidget && focusItem->d_ptr->isProxyWidget()
+ ? static_cast<QGraphicsProxyWidget *>(focusItem) : 0;
+ if (!proxy) {
+ q->setInputMethodHints(focusItem->inputMethodHints());
+ } else if (QWidget *widget = proxy->widget()) {
+ if (QWidget *fw = widget->focusWidget())
+ widget = fw;
+ q->setInputMethodHints(widget->inputMethodHints());
+ } else {
+ q->setInputMethodHints(0);
+ }
}
/*!