Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved UI Issues with QOpenGLWidget

    General and Desktop
    4
    10
    2016
    Loading More Posts
    • 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.
    • H
      Henry Valentine last edited by

      Hello all,

      I'm very new to QT, so forgive me if this ends up being a naive question.
      I'm just getting started writing an application with a QOpenGLWidget that I'd like to render to, but I've been having an issue with the UI that contains it.
      Here's a screenshot of the UI design. The large square widget in the center is the QOpenGLWidget.
      0_1502924247089_00b1336d-52cd-4904-a7c1-497cd165a434-image.png

      The issue appears when I run the program. The widgets at the top of the window get shifted up and are cutoff though the "detection boxes" for each button seem to be in the correct place (i.e. If I hover my mouse over where the button should be, the correct button is highlighted. If I hover my mouse over the apparent location of the top-left RadioButton, the Stop button is highlighted).
      0_1502924473392_4951d019-756e-43b0-ba0e-0bec4627a282-image.png
      This issue does not occur, however, if I demote the QOpenGLWidget to a simple QWidget. The buttons are in the correct location and they line up with there detection boxes.
      0_1502925249128_e29b1386-52f9-46e8-a431-07fc3bde362b-image.png
      Like I said, I'm still very new to QT, but I was not able to find any similar issues on the internet, so any help would be greatly appreciated!

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @Henry Valentine last edited by

        @Henry-Valentine What happens if you resize the window at runtime?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • H
          Henry Valentine last edited by

          @jsulm The issue persists when I resize the window.

          1 Reply Last reply Reply Quote 0
          • H
            Henry Valentine last edited by

            Adding on to this, sometimes when I'm in QT Designer and I place a QOpenGLWidget, the same issue occurs in the UI editor itself.
            Everything in the QT Creator IDE appears to shift upwards while the detection boxes for each button still seem to be in the correct locations.
            0_1502980426111_547f9363-ba7f-475c-a5c1-c974f6d5fa1d-image.png
            See here, the menu bar is gone and wherever my mouse hovers, the button above it is selected (since its detection box should be where my mouse is located).

            As soon as I remove the QOpenGLWidget, however, everything goes back to normal... (Menu bar is back)
            0_1502980563948_cd8b1bd6-dd2b-4de8-ab65-cc5f87574015-image.png

            1 Reply Last reply Reply Quote 0
            • H
              Henry Valentine last edited by

              Now that I look at it more, it appears to be more of a "zoom" effect. Some of the bottom is cutoff as well, but the issue is much more pronounced at the top.

              1 Reply Last reply Reply Quote 0
              • joaopagotto
                joaopagotto last edited by

                Hi friend, see: https://forum.qt.io/topic/79574/refresh-problem-widget-qglwidget-in-mainwindow-with-another-widgets

                1 Reply Last reply Reply Quote 0
                • H
                  Henry Valentine last edited by

                  Awesome! Thanks so much @joaopagotto .
                  I am using QOpenGlWidget instead of the obsolete QGLWidget.
                  I added the following line immediately after the call to setpUi() in my main window class:

                  setWindowFlags(Qt::CustomizeWindowHint);

                  thus disabling the default window title hints, so all the window decorations are gone. This fixes the issue of Ui elements getting cutoff and the mouse events being offset, but I may still want the window decorations. I tried adding the WindowTitleHint and WindowSystemMenuHint flags as well, but that just recreated the original issue...

                  Thanks again.

                  1 Reply Last reply Reply Quote 0
                  • H
                    Henry Valentine last edited by

                    Any other ideas? If not, I can try to make it work as is, but having window decorations would be nice.

                    1 Reply Last reply Reply Quote 0
                    • J
                      James Yoo last edited by

                      Does anybody sloved this issue?
                      I am also struggling with this problem.

                      1 Reply Last reply Reply Quote 0
                      • J
                        James Yoo last edited by

                        I solved this issue. It is a problem of Intel HD graphics driver.
                        Update to the latest version resolved the problem.

                        1 Reply Last reply Reply Quote 2
                        • First post
                          Last post