I was able to get my desired behavior by putting each row of Tool Buttons in a QHBoxLayout
, putting that layout in a empty QWidget
, and calling toolBar->addWidget( widget )
for each row. This gives me a grid toolbar when the toolbar is mounted on the left, and single horizontal bar when mounted on the top.
Make a Toolbar have a grid layout
Vra
I want to make a QToolBar
have 3 columns of buttons when docked on the left side of the QMainWindow
, but have 1 row when docked on the top of the main window. Is this possible?
I have a tried using a QToolBar
with a custom layout, but the normal re-size behavior of the QToolBar
doesn’t work (doesn’t hide widgets behind an expand button when its too small). The non-working expand button isn’t that big of a deal, but the bigger problem is that the custom layout prevents the main window from being smaller than the toolbar.
Oplossing
Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow