I would like to know how to, in a stylesheet, I can reach and style the "overflow button" that appears when a QToolBar with a bunch of QToolButtons is displayed because not all the buttons fit in the window.
Examples:
I would like to know how to, in a stylesheet, I can reach and style the "overflow button" that appears when a QToolBar with a bunch of QToolButtons is displayed because not all the buttons fit in the window.
Examples:
That "button" is a
QToolBarExtension
so you can select it in QSS using that class name.Example:
This would be the result:
Another whay of selecting an object in QSS is by its object name. So
QToolBarExtension#qt_toolbar_ext_button
would work as well.As it seems Qt does not provide a straightforward way of styling the extension button depending on its orientation I'll try to provide a workaround that will address your problem.
Inherit QToolBar to create a tool bar that updates the extension button name when orientation changes.
mytoolbar.h
mytoolbar.cpp
Now you can style the button this way:
where
qt_toolbar_ext_button_hor
represents the button when the toolbar is oriented horizontally andqt_toolbar_ext_button_ver
when vertically.