Apologies for the half sent message. Accidentally sent it.

So, follow up to the issue I was referring, I would like to know what is
the correct approach or if the assumption was that
m_platformWindow->window() is always equal to the topLevelWidget that was
set in the QWidget.cpp.

Thanks in advance.

Regards,
Sivan

On Fri, Aug 8, 2025 at 8:03 PM sivan nanthiran <[email protected]>
wrote:

> 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
[email protected]
https://lists.qt-project.org/listinfo/interest

Reply via email to