PDA

View Full Version : displayin' many images on a scence



peace_comp
30th April 2008, 22:09
Hi..
I would like to know if there is way to display many images in a same graphicsScene..
as a grid that contains images ..each one besides the other :


*****************
* pic1 * pic3 *
*****************
* pic2 * pic4 *
*****************
I guess it could be done via rect .. but how can I define n rect one beides the other as grid ?!!

NB> I need that to zoom on a map ..I will display first only 4x4 images .. then depending on the zoom (in or out) I may display or hide other images...

if someone has an idea !!
thanks

aamer4yu
1st May 2008, 09:57
why do you need GraphicsScene for such functionality ??
You can very well do it with layouts and labels. Except for zoom part, it will little more effort i guess.

Without graphicsscene -
You can display images in a QLabel objects, and arrange the labels using QGridLayout. For zooming in and out, u can change the size of Qlabel and adjust the grid layout accordingly.


With graphicsscene-
u need to manipulate the positions urself, because u gonna be placing items in the scene.
For this a a simple calculation can help-
nth_item->setPos((n/no_of_columns)*height , (n-1)*width);

am not sure if this will work, but i hope u got the idea. In this scene case, zooming will zoom into the scene, it wont arrange the images for u.


Depending on the functionality u want to achieve, u can choose either of the solution

Also u can refer puzzles examples in Qt demo, it may help u :)