PDA

View Full Version : displaying png image for a given area..



sar_van81
17th January 2007, 14:46
hi everyone,


i have a png image and i have a widget. i had set the size of widget as setMaximumSize(300,300 ).within this area i need to display the image within the coordinated (100,100). can anyone say me how to do that...?

i did as follows:

setPaletteBackgroundPixmap(QPixmap("qtlogo.png"));

the image is displayed in the entire 300x300 area that too in rows and columns.and not within the coordinates i require.

thanks in advance.

camel
17th January 2007, 14:56
Try QImage image(FILENAME) (http://doc.trolltech.com/4.2/qimage.html#QImage-7) and at some point (http://doc.trolltech.com/4.2/qwidget.html#paintEvent) followed by QPainter::drawImage (http://doc.trolltech.com/4.2/qpainter.html#drawImage)

EDIT:
Sorry, did not see your "Qt 3" part...but should be the same for that too ;-)

See:
Try QImage image(FILENAME) (http://doc.trolltech.com/3.3/qimage.html#QImage-4) and at some point (http://doc.trolltech.com/3.3/qwidget.html#paintEvent) followed by QPainter::drawImage (http://doc.trolltech.com/3.3/qpainter.html#drawImage)