Reputation: 542
I'm trying to use style sheets to customize a QPushButton. Using the following style sheet I have create a button with a gray background and a black boarder around it :
background-color: rgb(97, 97, 97);
border-style: outset;
border-width: 1px;
border-color: rgb(0, 0, 0);
border-radius: 4px;
color:rgb(255, 255, 255);
I'd like to add a second border around the button using the style sheet. I tried setting a padding color, but that does not seem to do anything. Is it possible to add a second border?
Upvotes: 0
Views: 4436
Reputation: 811
If you would like to use only style sheet it's probably not possible.
Similar solution is to change border-style to double, e.g.
background-color: rgb(97, 97, 97);
border-style: double;
border-width: 3px;
border-color: rgb(0, 0, 0);
border-radius: 4px;
color:rgb(255, 255, 255);
All available borders.
Relating to padding it's not possible to set a color for it. Explain how it look is here.
Upvotes: 2
Reputation: 19132
Wrap the button with a QFrame, and style that QFrame in addition to the QPushButton.
// ------Widget------
// ------hbox----------
// ------QFrame---------
// ------frameLayout-----
// ------QPushButton-----
QHBoxLayout * hbox = new QHBoxLayout;
QFrame * frame = new QFrame;
QPushButton * button = new QPushButton("Double Border Button");
QHBoxLayout * frameLayout = new QHBoxLayout;
frameLayout->addWidget(button);
frame->setLayout(frameLayout);
hbox->addWidget(frame);
this->setLayout(hbox);
Hope that helps.
Upvotes: 1