How change backcolor of pushbutton with text

Discussion about recent product features & solutions!
2 posts • Page 1 of 1
Victor.Ermakov
Posts:25
Joined: Fri Oct 20, 2017 8:50 am

How change backcolor of pushbutton with text

Post by Victor.Ermakov »

How change backcolor of pushbutton with text?

This sample works:
PUSH_NewAlarms.borderStyle=BS_NONE;
PUSH_NewAlarms.backCol="red";

It is required that the button border is not lost.

adaneau
Posts:310
Joined: Tue Feb 21, 2012 9:49 am

Re: How change backcolor of pushbutton with text

Post by adaneau »

Hi,

You can use stylesheet for this (see Style Sheets, basics in help).

Example:

Code: Select all

QPushButton[type = "myButtonTypeName"]
{
  border-radius: 5px;
  background-color: red;
  border-style: solid;
  border-width: 2px;
  border-color: black;
}
BR
Alexandre Daneau

2 posts • Page 1 of 1