diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2015-03-17 13:05:03 +0100 |
---|---|---|
committer | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2015-03-19 16:46:42 +0000 |
commit | bc1796ff5c34d3dfe0fb20026602bbe4e4aacfad (patch) | |
tree | b3da4e43ea8e2a7b429cdc1b7878d06307e66869 /src/widgets | |
parent | e7b257c39b3af3a54f458614e7697d71d52d3dc8 (diff) |
Fix high-dpi scaledContents QLabel
Scale to device pixel size.
Change-Id: I9da089f1a3cafdc7f31f57cca504249b00508192
Task-number: QTBUG-42503
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qlabel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 09a1e7983a..83e94c4128 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -1080,7 +1080,10 @@ void QLabel::paintEvent(QPaintEvent *) if (!d->cachedimage) d->cachedimage = new QImage(d->pixmap->toImage()); delete d->scaledpixmap; - d->scaledpixmap = new QPixmap(QPixmap::fromImage(d->cachedimage->scaled(cr.size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation))); + QImage scaledImage = + d->cachedimage->scaled(cr.size() * devicePixelRatio(), + Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage)); } pix = *d->scaledpixmap; } else |