If you are applying styles to multiple objects or children under the widget, you need to group your parameters to the object you want to apply it to.
In your stylesheet string, you left "border: none;"
dangling but also have a style for a QToolButton
. You can d0 such a thing only if you are applying styles only to tool_speed_button
.
Try something like this:
ui->tool_speed_button->setStyleSheet("QWidget{border: none; }QToolButton::down-arrow {image: none;}");
You will need to replace Qwidget
with the type of tool_speed_button
. When you start a project in Qt, you can check the stylesheet of your MainWindow in the designer file for more examples on how to format stylesheets.
In your case, you would do this:
ui->tool_speed_button->setStyleSheet("QToolButton::down-arrow {border: none;image: none;}");
Edit
Just wanted to add an explanation for what the first stylesheet example in my answer means:
In the style string, the first group QWidget{border:none;}
applies the style to any QWidget
that belongs to tool_speed_button
.
QToolButton::down-arrow {image: none;}
applies the style only for any QToolButton
that belongs to tool_speed_button
and is also of type down-arrow
(which is a property of QToolButton
). Since tool_speed_button
is a QToolButton
itself, it applies the style specified in the braces to itself and all its children.
Edit:
I was wrong. You can have dangling style sheet attribute along without grouped ones under curly braces as the question suggests. The dangling attributes just apply to all relevant objects in the widget.