QPushbutton, background-color but flat ?
I've a QPushBUtton
i want to change the button color so i use a simple stylesheet
setStyleSheet("QPushButton { background-color: red; color: black;}");
The button is now red and text black, but it is became FLAT !!! So no, border and simple 3d effect like the standard button..
Why this ?
Re: QPushbutton, background-color but flat ?
why? because that is what you told it to do. :confused:
Re: QPushbutton, background-color but flat ?
For QPushButton, changing the background , you will need to change other properties as well.
Usually QPushButton paints according to the system theme. You will need to use some image with 3D effect for the button to look better.
Also there are ways to change colors of button using custom button.
Re: QPushbutton, background-color but flat ?
My problem is that i have a simple panel with a button grey, with default qt style,
but if i simply change the background to make the button red, the button becomes red but it not seems to be a button because it becomes flat, it seems a text box !!
Re: QPushbutton, background-color but flat ?
Code:
pb->setStyleSheet(
"QPushButton {"
"margin: 1px;"
"border-color: #0c457e;"
"border-style: outset;"
"border-radius: 3px;"
"border-width: 1px;"
"color: black;"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2198c0, stop: 1 #0d5ca6);"
"}"
"QPushButton:pressed {"
"background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #0d5ca6, stop: 1 #2198c0);"
"}"
);
Change what you want to what you want but general idea is that you have to style the button yourself from scratch.