diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-03 14:09:17 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-15 20:49:12 +0000 |
commit | 8eccd1b0ad4073a548d8ee6343659525c0ccc5bb (patch) | |
tree | c290d8d89053e6ec8e2799ea1676ba2092de99a6 /examples/widgets/doc/src/tablet.qdoc | |
parent | 92a07c6289b3d0a0ac1a19346782d701faa8b50a (diff) |
tablet example: enable high-DPI rendering
Change-Id: Ie03867208902fdc9cf794de16d7249c8994351f4
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'examples/widgets/doc/src/tablet.qdoc')
-rw-r--r-- | examples/widgets/doc/src/tablet.qdoc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/widgets/doc/src/tablet.qdoc b/examples/widgets/doc/src/tablet.qdoc index 88fdefa68f..2b11020c07 100644 --- a/examples/widgets/doc/src/tablet.qdoc +++ b/examples/widgets/doc/src/tablet.qdoc @@ -206,8 +206,7 @@ \snippet widgets/tablet/tabletcanvas.cpp 0 - In the constructor we initialize our class variables. We need - to draw the background of our pixmap, as the default is gray. + In the constructor we initialize most of our class variables. Here is the implementation of \c saveImage(): @@ -247,7 +246,15 @@ \snippet widgets/tablet/tabletcanvas.cpp 4 - We simply draw the pixmap to the top left of the widget. + The first time Qt calls paintEvent(), m_pixmap is default-constructed, so + QPixmap::isNull() returns \c true. Now that we know which screen we will be + rendering to, we can create a pixmap with the appropriate resolution. + The size of the pixmap with which we fill the window depends on the screen + resolution, as the example does not support zoom; and it may be that one + screen is \l {High DPI Displays}{high DPI} while another is not. We need to + draw the background too, as the default is gray. + + After that, we simply draw the pixmap to the top left of the widget. Here is the implementation of \c paintPixmap(): |