diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index bad40b0cff..7dcfd47dc0 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10311,14 +10311,16 @@ QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const v = int(inputMethodHints()); else if (dd->control) v = dd->control->inputMethodQuery(query, QVariant()); - if (v.userType() == QMetaType::QRectF) - v = v.toRectF().translated(-dd->controlOffset()); - else if (v.userType() == QMetaType::QPointF) - v = v.toPointF() - dd->controlOffset(); - else if (v.userType() == QMetaType::QRect) - v = v.toRect().translated(-dd->controlOffset().toPoint()); - else if (v.userType() == QMetaType::QPoint) - v = v.toPoint() - dd->controlOffset().toPoint(); + if (dd->control) { + if (v.userType() == QMetaType::QRectF) + v = v.toRectF().translated(-dd->controlOffset()); + else if (v.userType() == QMetaType::QPointF) + v = v.toPointF() - dd->controlOffset(); + else if (v.userType() == QMetaType::QRect) + v = v.toRect().translated(-dd->controlOffset().toPoint()); + else if (v.userType() == QMetaType::QPoint) + v = v.toPoint() - dd->controlOffset().toPoint(); + } return v; }