Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, March 2007
how can i set the QPixmap object to the background image in QWidget?


Message 1 in thread

except overwriting the QWidget::paintEvent, I want to set the QPixmap object to the widget, I find using stylesheet may be useful, but the stylesheet have to specify an url like this:
QWidget {
  background-image: url(":\Pic");
}
how can i set my qpixmap object to the widget?
Best Regards,
Reimand.zhu
  

Message 2 in thread

I'm not sure I have understood your problem. you want to use a custom
pixmap as background for a widget?
Well, you have a few ways (ordered from the most easy and flexible to
the IMHO worst solution ;)

1) stylesheets in qt >= 4.2
2) subclass that widget and reimplement the paintEvent() method to
draw your own pixmapped background
3) create your custom QStyle subclass

Hope this helps as no other solution comes to my mind right now

On Fri, 2 Mar 2007 14:08:26 +0800 (CST), reimand zhu
<llzhu1984@xxxxxxx> wrote:

>except overwriting the QWidget::paintEvent, I want to set the QPixmap object to the widget, I find using stylesheet may be useful, but the stylesheet have to specify an url like this:
>QWidget {
>  background-image: url(":\Pic");
>}
>how can i set my qpixmap object to the widget?
>Best Regards,
>Reimand.zhu
>  

--
 [ signature omitted ]