QToolButton customization / skinning
Hi,
I use some QToolButtons (text under icon) in my program. Now I want to do two things:
1. specify a different icon over stylesheet
2. draw a colored rounded, filled rectangle only as text background (not the image)
Has somebody an idea, how to achieve this or has a link to a code snippet?
Thanks in advance.
Re: QToolButton customization / skinning
Quote:
Originally Posted by
Treggie
1. specify a different icon over stylesheet
use qproperty-icon.
Re: QToolButton customization / skinning
Hey man, thanks for the info! Learned a "trick" more again :)
Now I'm only searching for a way to paint only behind the text. I thought, that I could use a gradient (can I draw rounded reactangles this way?), which leaves the image area free and starts somewhere in the middle of the button. But all attempts until now don't work :(
Re: QToolButton customization / skinning
Quote:
Originally Posted by
Treggie
I'm only searching for a way to paint only behind the text. I thought, that I could use a gradient (can I draw rounded reactangles this way?), which leaves the image area free and starts somewhere in the middle of the button. But all attempts until now don't work :(
I don't know a way to do that with style sheets. I would say you have to subclass and do some painting by yourown.
Re: QToolButton customization / skinning
Quote:
Now I'm only searching for a way to paint only behind the text.
Do you mean the background? Read about background in Qt style sheets
Re: QToolButton customization / skinning
Correct ... I mean the background. Have already read the stylesheet docu, but haven't found a way to draw only half the background with a Gradient and keep the other half part transparent or as it is.
Re: QToolButton customization / skinning
hi
for setting a image using stylesheet
Code:
t->setStyleSheet("background-image: url(computer.gif)");
for setting a transparent in a stylesheet
Code:
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6666FF, stop: 0.7 #99CCFF , stop: 1 #CCCCFF);
work it around, u may find a solution. (im not sure ,it helps or not)
hope it helps
Bala
Re: QToolButton customization / skinning
Quote:
Originally Posted by
Treggie
Correct ... I mean the background.
than write it next time....
Quote:
Have already read the stylesheet docu, but haven't found a way to draw only half the background with a Gradient and keep the other half part transparent or as it is.
Then use a gradient which is from 0.0 to 0.5 transparent and for 0.500000000000000000000000000000000000000000000000 000000000000000000000001 to 1.0 make your colours. How to use gradient has BalaQt written and all that are wounderfull explained in the docus.
Re: QToolButton customization / skinning
Hi Lykurg ... why so aggressive? You helped me with the first part of the question (the hint to the qproperty was helpful indeed). For the second part (as noted ... and written) in my initial question I will try the gradient (which I already know).