Hi all,

I have a native Metal widget embedded in a QWidget with several other
widgets. I noticed when the input method transformation is set via
QWidget::updateWidgetTransform, it always uses the transformation of
q->mapTo(q->topLevelWidget()). So when the cursor rectangle is obtained via
qApp->inputMethod()->cursorRectangle(), like in firstRectForCharacterChange
in qnsview_complextext.mm, the return value of the cursor is already mapped
to the top level window. But the following line will simply try to map that
return value to this(native) window's global position which will be wrong.

I did try to prove the theory by the following patch and it works. But I
would like to know
QObject *obj = dynamic_cast<QObject*>(m_platformWindow->window());
if (obj && QString(obj->metaObject()->className()) == "QWidgetWindow")
{
QWidgetWindow* widgetWindow = static_cast<QWidgetWindow*>(obj);
mr.moveBottomLeft(widgetWindow->widget()->topLevelWidget()->window()->
mapToGlobal(mr.bottomLeft()));
}
else
{
mr.moveBottomLeft(m_platformWindow->window()->mapToGlobal(mr.bottomLeft()));
}
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to