Hi,

I have a test app that has a native widget and a QLabel arranged in a
horizontal layout side by side. The application's attribute of
Qt::AA_DontCreateNativeWidgetSiblings is set to true. A cursor is set to
QLabel as following,
label->setCursor(QCursor(Qt::SizeHorCursor));

In the mousePressEvent of native widget, I emit a signal which is connected
to enable or disable the QLabel beside it. What I notice is that the cursor
immediately changes to the SizeHorCursor although the mouse is still on my
native widget. And the code of qt_qpa_set_cursor does confirm why that is
happening. However, I don't understand why is it doing it without even
checking if the mouse is on the widget

The below piece of code in qt_qpa_set_cursor is the reason why its
happening.
w = QLabel, and its internalWinId() == 0, so the nativeParent will become
the top most widget.

And since w->testAttribute(Qt::WA_SetCursor) is true, it just change the
cursor of the nativeParent
QWidget *nativeParent = w;
if (!w->internalWinId())
nativeParent = w->nativeParentWidget();
if (!nativeParent || !nativeParent->internalWinId())
return;

if (w->isWindow() || w->testAttribute(Qt::WA_SetCursor)) {
if (w->isEnabled())
applyCursor(nativeParent, w->cursor());
Thanks in advance.

Regards,
Sivan
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to