Responsive Design - Change between many buttons / one button with menu depending on space available
-
wrote on 19 Sept 2018, 15:49 last edited by
Hi,
I have a UI where there are many QToolButtons in a HBoxLayout.
Now if the monitor size is too small I want to group them in fewer QToolButtons that have a menu instead of individual buttons.Is there some default mechanism in Qt implemented for this kind of task or do I have to implement it myself?
And if not, is there an example on how to implement this somewhere?Since it is a common problem I guess somebody has solved it before.
Thanks
-
-
wrote on 20 Sept 2018, 07:39 last edited by
@mjii thanks for the hint with the toolbar. However I prefer the menu and therefore will implement it myself.
There I have one question:
How is it possible to find out if there is enough space for a widget or if it gets vignetted/cut off? -
@mjii thanks for the hint with the toolbar. However I prefer the menu and therefore will implement it myself.
There I have one question:
How is it possible to find out if there is enough space for a widget or if it gets vignetted/cut off?hi
-How is it possible to find out if there is enough space for a widget or if it gets vignetted/cut off?
Well you can use
http://doc.qt.io/qt-5/qrect.html#contains-1
with proper as true.
for the widget and its parents's rect()
(i assume parent adjusts to windows size)
1/4