PDA

View Full Version : To draw images in QLabel



augusbas
11th October 2010, 05:54
Hi all,

I wanna use a QLabel and place two or three images on top of each other. And each image should be transparent to one another. And each image should fit in the label size provided.

So that each image should be able to Zoom in and Zoom out at same ratio.

How do i achieve this? ...I am putting my efforts by using Qpainter & composition mode to do this ...Still results are yet to achieve ...Kindly help me.

tbscope
11th October 2010, 05:58
1. Subclass QWidget to create your own
2. Use QGraphicsView

One label = one pixmap (default)

augusbas
11th October 2010, 06:04
1. Subclass QWidget to create your own
2. Use QGraphicsView

One label = one pixmap (default)


Hi Scope,

Any Example of doing with QGrpahicsView ...

What does Label= Pixmap mean? only one image can be added to a label

tbscope
11th October 2010, 06:08
Any Example of doing with QGrpahicsView ...
http://doc.qt.nokia.com/4.7/examples-graphicsview.html


What does Label= Pixmap mean? only one image can be added to a label
Yes, if you use setPixmap, you can only add one pixmap at a time. Unless you subclass the label, but subclassing a QWidget would be easier.
Or, you need to place three labels on top of eachother.

augusbas
11th October 2010, 06:19
http://doc.qt.nokia.com/4.7/examples-graphicsview.html


Yes, if you use setPixmap, you can only add one pixmap at a time. Unless you subclass the label, but subclassing a QWidget would be easier.
Or, you need to place three labels on top of eachother.

But with image composition example in /examples/painting it is proven of mixing two images and setting through pixmap to a Qlabel.... Am i Right?

tbscope
11th October 2010, 06:27
Then use that example.