Qt Stylesheet targeting a specific groupbox by title

50 Views Asked by At

I want to have different stylesheet for groupboxes with title and those without title like this

groupboxes with title: margin-top:5px

groupboxes with empty title: margin-top:0px

I think this should be done by changing stylesheet for all groupboxes then target groupboxes that have empty title

I’ve tried this but no success

    this->setStyleSheet("QGroupBox{border: 1px solid black; border-radius:3px; margin-top:5px;}"
                        "QGroupBox::title{top:-5px}"
                        "QGroupBox[title=""]{border: 1px solid black; margin-top:0px}"
                        );

Any suggestion?

0

There are 0 best solutions below