I have a QToolBar with QToolButtons. When the main window is too small, it will show a ">>" button , to extend the view into multiple lines and show all QToolButtons.
How can I style this ">>" button? I'd like to change the icon and the background color.
I already tried with these selectors: QToolButton::menu-indicator, QToolButton::menu-button, QToolButton::down-arrow. Doesn't work.
How can I change the color and the width of the ">>" button?
QToolButton {
background-color: transparent;
border: 1px solid #3A3939;
border-radius: 3px;
}
QToolButton:hover, QToolButton::menu-button:hover {
background: #787876;
}
QToolButton::checked{
background: #484846;
border: 1px solid #787876;
}
QToolButton:pressed, QToolButton::menu-button:pressed {
background: #787876;
}
QToolButton[popupMode="1"]{
/* only for MenuButtonPopup */
padding-right: 30px;
background: red;
}
QToolButton[popupMode="2"]{
/* only for OSC Server Status */
padding-right: 30px;
background: #484846;
}
QToolButton[popupMode="2"]:hover{
background: #787876;
}
QToolButton::down-arrow{
}
/* the subcontrols below are used only in the MenuButtonPopup mode */
QToolButton::menu-button{
}
QToolButton::menu-button:hover{
background: #787876;
}
QToolButton::menu-button:pressed{
}
QToolButton::menu-indicator{
bottom: 5px;
right: 5px;
}
You cannot do it via
CSS
, however it can be done using a custom styling:QStyle
/QCommonStyle
.pixelMetric
to change a size of the button.Qt4
: Create a slotstandardIconImplementation
to change an icon of the button.Qt5
: ReimplementstandardIcon
to change an icon of the button.setStyle
to apply it to the toolbar (or to the application).Reimplemented methods: