incorrect mapToGlobal in Qt 5.14 - 5.15
-
this appears to be a windows issue only.
i have an MDI application (each subwindow contains a widget derived from QGLWidget) that has worked fine with Qt4 and Qt5 all the way up to Qt 5.12. recently, i updated to 5.15.0 and now i am running into the following issue:
first of all everything works fine for the first subwindow created. the second and all subsequent subwindows when i call mapToGlobal the resulting QPoint is incorrect . as a test i called mapToGlobal with a QPoint(0,0) to get the location of the origin of the subwindow and it appears to be shifted to the right and down; each subsequent window is further shifted from the one previous.
i have also noticed the following warning on creation of the second and subsequent subwindows (not sure if this is related to the incorrect window origin):
QWindowsWindow::setGeometry: Unable to set geometry 1342x942+0+0 (frame: 1342x942+0+0) on QWidgetWindow/"QGLWidgetClassWindow" on "\.\DISPLAY1". Resulting geometry 1342x942+12+8 (frame: 1342x942) margins: 0, 0, 0, 0)
i tried setMinimumSize and setGeometry on both the QGLWidget and the subwindow but i could not remove this warning.
if anyone knows about this issue and a possible workaround or any ideas i would appreciate any help.
thanks
-
this appears to be a windows issue only.
i have an MDI application (each subwindow contains a widget derived from QGLWidget) that has worked fine with Qt4 and Qt5 all the way up to Qt 5.12. recently, i updated to 5.15.0 and now i am running into the following issue:
first of all everything works fine for the first subwindow created. the second and all subsequent subwindows when i call mapToGlobal the resulting QPoint is incorrect . as a test i called mapToGlobal with a QPoint(0,0) to get the location of the origin of the subwindow and it appears to be shifted to the right and down; each subsequent window is further shifted from the one previous.
i have also noticed the following warning on creation of the second and subsequent subwindows (not sure if this is related to the incorrect window origin):
QWindowsWindow::setGeometry: Unable to set geometry 1342x942+0+0 (frame: 1342x942+0+0) on QWidgetWindow/"QGLWidgetClassWindow" on "\.\DISPLAY1". Resulting geometry 1342x942+12+8 (frame: 1342x942) margins: 0, 0, 0, 0)
i tried setMinimumSize and setGeometry on both the QGLWidget and the subwindow but i could not remove this warning.
if anyone knows about this issue and a possible workaround or any ideas i would appreciate any help.
thanks
@sawarsi
Check this previous topic
https://forum.qt.io/topic/116360/qwidget-maptoglobal-not-giving-right-resultand the solution to it, do you call the correct mapToGlobal ? I can't tell as you do not show code 🤷♂️
-
@sawarsi
Check this previous topic
https://forum.qt.io/topic/116360/qwidget-maptoglobal-not-giving-right-resultand the solution to it, do you call the correct mapToGlobal ? I can't tell as you do not show code 🤷♂️
-
@J-Hilk thanks for the reply but this is not my issue. this appears to be a change in the internals of Qt that has caused this issue with 5.14 and 5.15 as the application worked fine with all earlier versions.
@sawarsi
Hi
If you can use 5.12 on same pc and same everything besides the Qt version and then it works.
I would make a small example to show this effect and
open a bug ticket. It could be regression.
https://bugreports.qt.io/ -
@sawarsi
Hi
If you can use 5.12 on same pc and same everything besides the Qt version and then it works.
I would make a small example to show this effect and
open a bug ticket. It could be regression.
https://bugreports.qt.io/ -
i have a zip file with a simple example that will reproduce the issue. notice that when starting the application on the second creation of the subwindow the warnings are issued. is it possible to attach a file to this ticket?
as the mouse is moved in the tabs the origin of the window is printed via QDebug. when the 2nd tab is activated then u will notice that its origin is incorrect by a factor of two; both tabs should have the same origin. even in non-tabbed mode this error seems to be there.
-
i have a zip file with a simple example that will reproduce the issue. notice that when starting the application on the second creation of the subwindow the warnings are issued. is it possible to attach a file to this ticket?
as the mouse is moved in the tabs the origin of the window is printed via QDebug. when the 2nd tab is activated then u will notice that its origin is incorrect by a factor of two; both tabs should have the same origin. even in non-tabbed mode this error seems to be there.
-
@sawarsi i have found and fixed the issue. in the versions of Qt beyond 5.12 it is required to pass a parent widget to the constructor of the qglwidget
-
@sawarsi i have found and fixed the issue. in the versions of Qt beyond 5.12 it is required to pass a parent widget to the constructor of the qglwidget
@mrjj sorry i just saw your reply. yes, originally i was not passing a parent widget as the parent of the derived QGLWidget the fix i did was to make the parent of the QGLWidget as the mainwindow.
the link is: