Skip to content
  • 0 Votes
    4 Posts
    1k Views
    A

    Ok,
    I found the bullshit. My first try was setStyleSheet("background-color: myColor;"). As it did not work (no border when checked), I tried after setStyleSheet("QToolButton {background-color: myColor;}"). As it was still the same shit, and as the documentation recommends to set the border, I have moved to setStyleSheet("QToolButton {background-color: myColor; border:none;}") (as in the QSS file). And all the following tries were with "border:none" on the rule without the :checked modifier.

    Suprisingly, without the definition of the border in the setStyleSheet everything works well. So I have the border defined in the QSS file (as from the beginning). And in the program I have:

    currentBtn ->setStyleSheet(QString("QToolButton#BooleanObject {background-color: %1;} QToolButton#BooleanObject:checked {background-color:%1;}").arg(myColor.name()));

    This is a really strange behavior. But, long time ago, I have understood that I will never understand the "logic" of the QT style sheet.