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. UI Issues with QOpenGLWidget

UI Issues with QOpenGLWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 2.6k Views
  • 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 Offline
    H Offline
    Henry Valentine
    wrote on last edited by
    #1

    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!

    jsulmJ 1 Reply Last reply
    0
    • H Henry Valentine

      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!

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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
      0
      • H Offline
        H Offline
        Henry Valentine
        wrote on last edited by
        #3

        @jsulm The issue persists when I resize the window.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          Henry Valentine
          wrote on last edited by
          #4

          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
          0
          • H Offline
            H Offline
            Henry Valentine
            wrote on last edited by
            #5

            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
            0
            • joaopagottoJ Offline
              joaopagottoJ Offline
              joaopagotto
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • H Offline
                H Offline
                Henry Valentine
                wrote on last edited by
                #7

                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
                0
                • H Offline
                  H Offline
                  Henry Valentine
                  wrote on last edited by
                  #8

                  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
                  0
                  • J Offline
                    J Offline
                    James Yoo
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      James Yoo
                      wrote on last edited by
                      #10

                      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
                      2

                      • Login

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