Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Attach button and other widgets to the right side of the parent widget, on resize.
Furkas last edited by
I'm using Qt5.6, for an UI widgets desktop application, on windows platform.
I want to attach pushbuttons to the right side of the frame, as the user resize the application window.
The mainwindow is a QWidget, with some other widgets placed using Designer.
When I reduce the application frame, the right side is masked.
How can I link the button so they can move with the right side (and eventually disapears to the left side if there isnt enough room ...)
Thanks for your advices
- use QLayouts. Spacer <-> Widget
- call setGeometry()/move() manually in the resizeEvent() handler of the parent widget with the calculated position
A Former User last edited by
Hi! To add to @raven-worx, have a look at this screenshot:
First your central widget needs a horizontal layout. This can be selected in the property editor on the right. Next is to add a vertical layout from the component menu on the left (not shown in the screenshot). You can then drop your buttons in this vertical layout and also add one or more vertical spacers to it if you like.