Add multiple background images to a button
-
wrote on 24 Mar 2011, 08:36 last edited by
Lets say that I have 3 images and I want to put them on a button( QToolButton ) one on left, one on center and one on right. How can I do this? Can I do it with stylesheets?
Thanks!
-
wrote on 24 Mar 2011, 09:01 last edited by
A button has one background image. You can combine them by code and ad the combined image. But I know no way to put several images in specific places in the background.
-
wrote on 24 Mar 2011, 09:12 last edited by
... so loading images into pixmaps and after that painter.drawPixmap( x,y,w,h ) ...
-
wrote on 24 Mar 2011, 09:23 last edited by
yep
load the images into QPIxmap or QImage, create a new QPixmap
@
QPixmap newPix(x,y);
QPainter paint(&newPix);paint.drawPixmap(..., pix1); paint.drawPixmap(..., pix2); paint.drawPixmap(..., pix3); // use newPix as background
@
3/4