button background color when it is clicked
Hi,
I have placed some buttons which has seCheckable() state and SetAutodefault() state as true.
I want to change the back ground color when it is active and when the button is pressed and down.
I can change the color when it is active, but when it is clicked i want to change the background color of the button. i.e user should feel that button is pressed(down). when i use pressed or checked in my style sheet, the color changed only when mouse button is down.
so how can i change the background color when button is down state.untill user press other button or the current button comes up, button color shouldnt change
Thank You
Re: button background color when it is clicked
try to use style sheets
Quote:
QPushButton:hover: pressed { color: blue; }
Re: button background color when it is clicked
I already used StyleSheets. Even i used QPushButton:hover: pressed { background-color: blue; }. Button will turn to blue when use press down and until mouse is in clicked state.. once you release the mouse it will be normal form.
But i need to differentiate clicked state and normal state using background color.
Thank You
Re: button background color when it is clicked
Can anyone help me out to resolve this :confused:
Re: button background color when it is clicked
try this
Code:
QString style_sheet_btn
=" QPushButton:checked {background-color:rgb(255,100,100);border-style:solid;border-width:1.5px;border-color:gray;}";
Re: button background color when it is clicked
Quote:
Originally Posted by
calmspeaker
try this
Code:
QString style_sheet_btn
=" QPushButton:checked {background-color:rgb(255,100,100);border-style:solid;border-width:1.5px;border-color:gray;}";
See this <https://youtu.be/DwZ-B_ipmQY?si=nkvHz1obS0PLWOgL>
Simply receive the button event and then change the style of the button that triggered the event using setStyleSheet() method