Stylesheet is not working for QToolButton
Hi Every body
I'm tryng to apply stylesheet for both pushbutton and tool button through qss file. Below i've posted the qss file. its working fine for QPushButton. but not working for QtoolButton. Plz help me.
Code:
{
image: url(":/resource/Icons/Popup_BTN_N.png");
}
{
image: url(":/resource/Icons/Popup_BTN_D.png");
}
{
image: url(":/resource/Icons/Popup_BTN_F.png");
}
{
image: url(":/resource/Icons/Popup_BTN_F.png");
}
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_N.png");
}
{
bimage: url(":/resource/Icons/Contents_Monitor_Close_Icon_D.png");
}
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_F.png");
}
Re: Stylesheet is not working for QToolButton
Hi,
What about QToolButton::indicator?
Re: Stylesheet is not working for QToolButton
Quote:
Originally Posted by
zgulser
Hi,
What about QToolButton::indicator?
Shall i add it like
QToolButton:indicator
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_F.png");
}
My need is to change the colors while it is focussing or selected or neutral.
Is above code right???
Re: Stylesheet is not working for QToolButton
Yeah I meant you need to add it like you showed.
But if you want to change the background color, use "background-color" property not "image".
Re: Stylesheet is not working for QToolButton
Quote:
Originally Posted by
zgulser
Yeah I meant you need to add it like you showed.
But if you want to change the background color, use "background-color" property not "image".
i did like this. but its not working. i ve some png to apply toolbutton. it should change during different state like, pressed, or hovered.
how to do it??
Re: Stylesheet is not working for QToolButton
Quote:
Originally Posted by
sudhansu
i did like this. but its not working. i ve some png to apply toolbutton. it should change during different state like, pressed, or hovered.
how to do it??
Hi ALl
I'm still stuck in the problem. Please tell me how to solve it.
Thank you all.
Re: Stylesheet is not working for QToolButton
Hi,
I guess it'll work now..
QToolButton:pressed{
border: 2px solid #8f8f91;
border-radius: 6px; // not necessary
background-color:red;
}
Re: Stylesheet is not working for QToolButton
Quote:
Originally Posted by
zgulser
Hi,
I guess it'll work now..
QToolButton:pressed{
border: 2px solid #8f8f91;
border-radius: 6px; // not necessary
background-color:red;
}
Thank you very much for the reply. But i need to change the background images. I ve different images for mouse hovering or button focused, neutral and selected . How to do it?
Re: Stylesheet is not working for QToolButton
Brother then just change as the following;
QToolButton:hover
{
border: 2px solid #8f8f91;
border-radius: 6px; // not necessary
image: url("yourimage.jpg");
}
This is for hover. Apply it to other pseudo states by just replacing hover with selected, focused or something.
Re: Stylesheet is not working for QToolButton
Quote:
Originally Posted by
zgulser
Brother then just change as the following;
QToolButton:hover
{
border: 2px solid #8f8f91;
border-radius: 6px; // not necessary
image: url("yourimage.jpg");
}
This is for hover. Apply it to other pseudo states by just replacing hover with selected, focused or something.
No its not working this way. I tried like
Code:
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_N.png");
}
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_D.png");
}
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_F.png");
}
{
image: url(":/resource/Icons/Contents_Monitor_Close_Icon_F.png");
}
Re: Stylesheet is not working for QToolButton
QToolButton:hover
{
border: 2px solid #8f8f91;
border-radius: 6px; // not necessary
background- image: url("yourimage.jpg");
}
but make sure to run the program. It's not shown in the designer since it's linked in the source.