Although the answer has already been selected, I would like to express my opinion.
I do not like the selected answer, especially due to the use of timers. Pixmaps unload timer? Say that the user really wants to take a good look at the image, and after a couple of seconds - bam, the image will be uploaded, he will have to do something to make the image appear again. Or maybe you put another timer that loads pixmaps in a couple of seconds? Or will you check among your thousands of items if they are visible? This is not very annoying and not so, but it means that your program will constantly use resources. Say that the user minimizes your program and plays in the movies, he wonders why on earth my film freezes every couple of seconds ...
Well, if I misunderstood the suggested idea of using timers, try me.
In fact, the idea suggested by Muttz is better. It reminded me of Mandelbrot’s example . Take a look at this. Instead of deciding what to do, you can rewrite this part to download the part of the image that you need to show.
In conclusion, I propose another solution using QGraphicsView is much simpler:
1) check image size without loading image (use QImageReader)
2) make your scene size equal to image size
3) instead of using pixmap elements, override the DrawBackground () function. One of the parameters will give you a new open rectangle - this means that if the user scrolls a bit, you will download and draw only this new part (to load only part of the image, use setClipRect (), and then the read () methods of the QImageReader class). If there are some transformations, you can get them from another parameter (which is a QPainter) and apply them to the image before drawing it.
In my opinion, the best solution would be to combine my solution with the flow shown in the Mandelbrot example .
The only problem I can think of right now is that the user is scaled with a large scale factor. Then you will need a lot of resources for some time to load and scale a huge image. Well, now I see that there is some QImageReader function that I have not tried yet - setScaledSize (), which, perhaps, does exactly what we need - if you set the scale size and then load the image, it may not load first all image - try. Another way is to limit the scale factor - the thing you should do anyway if you stick with the pixmap method.
Hope this helps.