Patch Qt scaling issue when using pixmaps in QLabels
This commit is contained in:
parent
fbb5e895ab
commit
e15c36f53f
2 changed files with 25 additions and 1 deletions
23
patches/qt5/QTBUG-46846.patch
Normal file
23
patches/qt5/QTBUG-46846.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
|
||||
index 83e94c4..80957e6 100644
|
||||
--- a/src/widgets/widgets/qlabel.cpp
|
||||
+++ b/src/widgets/widgets/qlabel.cpp
|
||||
@@ -1076,14 +1076,16 @@ void QLabel::paintEvent(QPaintEvent *)
|
||||
if (d->pixmap && !d->pixmap->isNull()) {
|
||||
QPixmap pix;
|
||||
if (d->scaledcontents) {
|
||||
- if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) {
|
||||
+ QSize scaledSize = cr.size() * devicePixelRatio();
|
||||
+ if (!d->scaledpixmap || d->scaledpixmap->size() != scaledSize) {
|
||||
if (!d->cachedimage)
|
||||
d->cachedimage = new QImage(d->pixmap->toImage());
|
||||
delete d->scaledpixmap;
|
||||
QImage scaledImage =
|
||||
- d->cachedimage->scaled(cr.size() * devicePixelRatio(),
|
||||
+ d->cachedimage->scaled(scaledSize,
|
||||
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage));
|
||||
+ d->scaledpixmap->setDevicePixelRatio(devicePixelRatio());
|
||||
}
|
||||
pix = *d->scaledpixmap;
|
||||
} else
|
||||
|
|
@ -223,7 +223,8 @@ build_qt5()
|
|||
curl -O -L http://download.qt-project.org/official_releases/qt/${v[0]}.${v[1]}/$version/single/qt-everywhere-opensource-src-$version.tar.gz
|
||||
fi
|
||||
tar xzf qt-everywhere-opensource-src-$version.tar.gz
|
||||
cd qt-everywhere-opensource-src-$version
|
||||
cd qt-everywhere-opensource-src-$version
|
||||
patch -d qtbase -p1 < $OPENSCADDIR/patches/qt5/QTBUG-46846.patch
|
||||
if ! $USING_CXX11; then
|
||||
QT_EXTRA_FLAGS="-no-c++11"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue