summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-02-07 14:43:37 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-11 20:59:15 +0100
commit34dba9261ec0446312a28056af90c0b32944ec9d (patch)
tree6fa718945a0848485177b8ecb1b4acf9606b3c83 /src
parent2a9944e281ba3c4d81f036ea0760c1850fd5c837 (diff)
Widgets: update widget transform upon receiving QEvent::FocusIn
QWidgetPrivate::updateWidgetTransform will only update the transform if the widget is the current focus object. But if someone calls QApplication::setActiveWindow, Qt will call QWindow::requestActivate and then send focus in/out events, all in the same event loop recursion. The problem now is that requestActivate is not guaranteed to be synchronous (it's not on iOS). So the window activation (together with updating the focus object) will still be pending when the widget receives the focus-in event. As such, the transform update will also fail. This patch will give the event as input to the function, so that we don't depend on window activation being synchronous. This will fix IM spell checking popups on iOS to show at the correct place, also after closing font popups etc. Change-Id: If0ee70f55692bbd613821b126923364e39ed1199 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qwidget.cpp10
-rw-r--r--src/widgets/kernel/qwidget_p.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index def3589d9a..70249785e2 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -353,10 +353,10 @@ void QWidgetPrivate::scrollChildren(int dx, int dy)
}
}
-void QWidgetPrivate::updateWidgetTransform()
+void QWidgetPrivate::updateWidgetTransform(QEvent *event)
{
Q_Q(QWidget);
- if (q == qGuiApp->focusObject()) {
+ if (q == qGuiApp->focusObject() || event->type() == QEvent::FocusIn) {
QTransform t;
QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
t.translate(p.x(), p.y());
@@ -8058,7 +8058,7 @@ bool QWidget::event(QEvent *event)
break;
case QEvent::FocusIn:
focusInEvent((QFocusEvent*)event);
- d->updateWidgetTransform();
+ d->updateWidgetTransform(event);
break;
case QEvent::FocusOut:
@@ -8100,12 +8100,12 @@ bool QWidget::event(QEvent *event)
case QEvent::Move:
moveEvent((QMoveEvent*)event);
- d->updateWidgetTransform();
+ d->updateWidgetTransform(event);
break;
case QEvent::Resize:
resizeEvent((QResizeEvent*)event);
- d->updateWidgetTransform();
+ d->updateWidgetTransform(event);
break;
case QEvent::Close:
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 5387341a75..c8fb2782b3 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -438,7 +438,7 @@ public:
void syncBackingStore(const QRegion &region);
// tells the input method about the widgets transform
- void updateWidgetTransform();
+ void updateWidgetTransform(QEvent *event);
void reparentFocusWidgets(QWidget *oldtlw);