I have a:
class Box : public QWidget
and it has
this->setLayout(new QGridLayout(this));
I tried doing:
this->setStyleSheet( "border-radius: 5px; "
"border: 1px solid black;"
"border: 2px groove gray;"
"background-color:blue;");
this->setStyleSheet( "QGridLayout{"
"background-color:blue;"
"border-radius: 5px; "
"border: 1px solid black;"
"border: 2px groove gray;"
"}"
);
this->setObjectName(QString("Box"));
this->setStyleSheet( "QWidget#Box {"
"background-color:blue;"
"border-radius: 5px; "
"border: 1px solid black;"
"border: 2px groove gray;"
"}"
);
but the first affects only the items that are added, the other two do nothing. I want the box itself to have rounded corners and a border (bonus for how to do lines between rows).
How do I get the stylesheet to affect the Box widget, not its children?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…