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