Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. incorrect mapToGlobal in Qt 5.14 - 5.15
Forum Updated to NodeBB v4.3 + New Features

incorrect mapToGlobal in Qt 5.14 - 5.15

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sawarsi
    wrote on last edited by
    #1

    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

    J.HilkJ 1 Reply Last reply
    0
    • S sawarsi

      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

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @sawarsi
      Check this previous topic
      https://forum.qt.io/topic/116360/qwidget-maptoglobal-not-giving-right-result

      and the solution to it, do you call the correct mapToGlobal ? I can't tell as you do not show code 🤷‍♂️


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      S 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @sawarsi
        Check this previous topic
        https://forum.qt.io/topic/116360/qwidget-maptoglobal-not-giving-right-result

        and the solution to it, do you call the correct mapToGlobal ? I can't tell as you do not show code 🤷‍♂️

        S Offline
        S Offline
        sawarsi
        wrote on last edited by
        #3

        @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.

        mrjjM 1 Reply Last reply
        0
        • S sawarsi

          @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.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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/

          S 1 Reply Last reply
          0
          • mrjjM mrjj

            @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/

            S Offline
            S Offline
            sawarsi
            wrote on last edited by
            #5

            @mrjj ok, i will try to see if i can create a small example that shows this issue. thanks

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sawarsi
              wrote on last edited by
              #6

              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.

              S 1 Reply Last reply
              0
              • S sawarsi

                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.

                S Offline
                S Offline
                sawarsi
                wrote on last edited by
                #7

                @sawarsi i also submitted this issue to qt support as suggested with the example code.

                S 1 Reply Last reply
                1
                • S sawarsi

                  @sawarsi i also submitted this issue to qt support as suggested with the example code.

                  S Offline
                  S Offline
                  sawarsi
                  wrote on last edited by
                  #8

                  @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

                  mrjjM S 2 Replies Last reply
                  1
                  • S sawarsi

                    @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

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @sawarsi
                    Just so im sure i understand.
                    You didnt have a parent for qglwidget inside the MDI window and
                    the fix was to assign one ?

                    also please provide the bug report link here :)

                    1 Reply Last reply
                    0
                    • S sawarsi

                      @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

                      S Offline
                      S Offline
                      sawarsi
                      wrote on last edited by
                      #10

                      @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:

                      https://bugreports.qt.io/browse/QTBUG-85401

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved