Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved]QStyleSheet and QGroupBox



  • @ui_->renameGroup->setStyleSheet("border: 2px solid gray;border-radius: 5px;");@

    In the renameGroup, there are some QPushButton and QLabel, this solution will change the border
    of those QPushButton and QLabel too.I only want to change the border of the QGroupBox, what should
    I do?Thanks



  • You need a selector outset the rules, or it will considered as global selector: "*". Consider the way like this:
    @
    QGroupBox { // see, a selector
    border: 2px solid gray;
    border-radius: 5px;
    }
    @



  • Thanks, it work and easy to use.


Log in to reply