UI Issues with QOpenGLWidget



  • 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!


  • Moderators

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



  • @jsulm The issue persists when I resize the window.



  • 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



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





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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.