summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview/qgraphicsproxywidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsproxywidget.cpp')
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 45720802d3..e4253e9282 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -832,6 +832,10 @@ bool QGraphicsProxyWidget::event(QEvent *event)
return QGraphicsWidget::event(event);
switch (event->type()) {
+ case QEvent::WindowActivate:
+ case QEvent::WindowDeactivate:
+ QCoreApplication::sendEvent(d->widget, event);
+ break;
case QEvent::StyleChange:
// Propagate style changes to the embedded widget.
if (!d->styleChangeMode) {
@@ -1389,6 +1393,11 @@ void QGraphicsProxyWidget::focusInEvent(QFocusEvent *event)
break;
}
+ // QTBUG-88016
+ if (d->widget && d->widget->focusWidget()
+ && d->widget->focusWidget()->testAttribute(Qt::WA_InputMethodEnabled))
+ QApplication::inputMethod()->reset();
+
d->proxyIsGivingFocus = false;
}
@@ -1404,8 +1413,14 @@ void QGraphicsProxyWidget::focusOutEvent(QFocusEvent *event)
if (d->widget) {
// We need to explicitly remove subfocus from the embedded widget's
// focus widget.
- if (QWidget *focusWidget = d->widget->focusWidget())
+ if (QWidget *focusWidget = d->widget->focusWidget()) {
+ // QTBUG-88016 proxyWidget set QTextEdit(QLineEdit etc.) when input preview text,
+ // inputMethod should be reset when proxyWidget lost focus
+ if (focusWidget && focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
+ QApplication::inputMethod()->reset();
+
d->removeSubFocusHelper(focusWidget, event->reason());
+ }
}
}
@@ -1540,6 +1555,10 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt
if (exposedWidgetRect.isEmpty())
return;
+ // When rendering to pdf etc. painting may go outside widget boundaries unless clipped
+ if (painter->device()->devType() != QInternal::Widget && (flags() & ItemClipsChildrenToShape))
+ painter->setClipRect(d->widget->geometry(), Qt::IntersectClip);
+
d->widget->render(painter, exposedWidgetRect.topLeft(), exposedWidgetRect);
}