join images together without merging
hi friends,
I want to know how to join 4 images together without overlapping one above the other in Qt 4.7. Consider i have image1.png(200x200), image2.png(200x200), image3.png(200x200),image4.png(200x200) where 200x200 is the dimension of the image.now these 4 images should be join in such a manner they look distinct and there should not be overlapping,overlayering or no stacking of images.so that 4 images should behaves as single image,and later if i add any zoom effect it should scaled accordingly.
Thanks
Re: join images together without merging
For four images source1, ... source4 of size WxH create an image target of size 2*W x 2*H, setup QPainter on the target and paint the source images to four corners of target using one of the QPainter::drawImage method.
Quote:
4 images should behaves as single image,and later if i add any zoom effect it should scaled accordingly
If you want the merged image later to be passed to other methods that accepts a QImage, it must be one QImage. I don't think I understand what you mean in this sentence.
Re: join images together without merging
Currently i have used QFrame which is inside MainWindow.i have to use 4 images of equal size within this frame.lets consider my frame size is 500x500,these 4 images should be joined or stitched in such a manner,so that they should not overlap one above the other.Moreover,they should behave as one single image.so if in later stage i want to add zoom effect those 4 images also get zoomed like a normal image.But can u suggest me suppose we create
QPainter painter;
QPixmap pixmap;
now how we can pass the pixmap to a label that we have created through QPainter. bcoz we cant pass painter object to QLabel,if u have any idea please let me know
Re: join images together without merging
Don't worry about the frame size, first join the images and then you can resize the merged image to whatever size you need.
Quote:
But can u suggest me suppose we create
QPainter painter;
QPixmap pixmap;
now how we can pass the pixmap to a label that we have created through QPainter
Read the QPainter docs, there is an example how to use it:
Code:
QPixmap mergedImg
( width, height
);
//... do the painting
painter.end();
// and then assign mergedImg for label