aboutsummaryrefslogtreecommitdiffstats
path: root/examples/demos/documentviewer/doc/imageviewer.py.rstinc
blob: 2aeaaf4a43b3f82cff424b05e76ddf22da98a685 (plain)
1
2
3
4
5
6
7
8
9
10
11
``ImageViewer`` displays images as supported by ``QImageReader``, using
a QLabel.

In the constructor, we increase the allocation limit of ``QImageReader`` to
allow for larger photos.

In the ``openFile()`` function, we load the image and determine its size.
If it is larger than the screen, we downscale it to screen size, maintaining
the aspect ratio. This calculation has to be done in native pixels, and
the device pixel ratio needs to be set on the resulting pixmap for it to
appear crisp.