PDA

View Full Version : checkBox



mickey
30th March 2006, 23:15
Hi, I'm trying to set background to my cheack box; I'd like set it to a png; is it possible?
This below compile but the background is gray....Thanks


mycheck->setBackgroundPixmap(QPixmap::fromMimeSource("face.png"));

SkripT
30th March 2006, 23:57
Have you try it this way:

mycheck->setBackgroundPixmap(QPixmap("face.png"));

In other way, is the path of the image correct?

mickey
31st March 2006, 06:00
sorry but don't happen nothing...

mickey
1st April 2006, 17:14
nothing hint for this?

wysota
1st April 2006, 17:20
But is the path correct or not? Can you display the pixmap on a QLabel?

mickey
1st April 2006, 20:24
yes I have in .pro the line /images/face.png, because it is also a pixmap on a button. I haven't any error of path...

wysota
1st April 2006, 21:49
The attached app works fine for me. I think you have a problem with the pixmap image path. Does it start with "/"? I guess it shouldn't. Are you sure you load the pixmap to the button exactly the same way?

mickey
1st April 2006, 22:58
Sorry; we didn't understand! I'd like set the face.png inside the square of checkBox where, when I click, apper the "V". Are you understand? Is it possible?
Thanks for all.

wysota
1st April 2006, 23:05
You'd have to subclass QCheckBox to do that. Or implement your own QStyle.