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>
bb10
Morten Johan Sørvig 2015-03-17 13:05:03 +01:00 committed by Timur Pocheptsov
parent e7b257c39b
commit bc1796ff5c
1 changed files with 4 additions and 1 deletions

View File

@ -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