summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-10-09 17:48:31 (GMT)
committerPeter Wu <peter@lekensteyn.nl>2016-10-11 21:01:17 (GMT)
commit9bca22ef6689728facf3a0ea3eded845b91b2e8e (patch)
tree983357d5baf7d68cad882f9e8f4502affe2fe7d8
parentaf7469148e15ae11c48e6e6fba7019ea8397a58b (diff)
Make the preview respect devicePixelScale
Make resizeEvent match setScreenshot in the pixmap scaling logic. REVIEW: 129136
-rw-r--r--src/Gui/KSImageWidget.cpp9
-rw-r--r--src/Gui/KSImageWidget.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Gui/KSImageWidget.cpp b/src/Gui/KSImageWidget.cpp
index 462f4b7..365a5f3 100644
--- a/src/Gui/KSImageWidget.cpp
+++ b/src/Gui/KSImageWidget.cpp
@@ -38,7 +38,12 @@ void KSImageWidget::setScreenshot(const QPixmap &pixmap)
{
mPixmap = pixmap;
setToolTip(i18n("Image Size: %1x%2 pixels", mPixmap.width(), mPixmap.height()));
- setPixmap(mPixmap.scaled(size() * pixmap.devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ setScaledPixmap();
+}
+
+void KSImageWidget::setScaledPixmap()
+{
+ setPixmap(mPixmap.scaled(size() * mPixmap.devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
}
// drag handlers
@@ -77,6 +82,6 @@ void KSImageWidget::mouseMoveEvent(QMouseEvent *event)
void KSImageWidget::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event);
- setPixmap(mPixmap.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
+ setScaledPixmap();
}
diff --git a/src/Gui/KSImageWidget.h b/src/Gui/KSImageWidget.h
index aa6f73a..0433698 100644
--- a/src/Gui/KSImageWidget.h
+++ b/src/Gui/KSImageWidget.h
@@ -53,6 +53,8 @@ class KSImageWidget : public QLabel
private:
+ void setScaledPixmap();
+
QGraphicsDropShadowEffect *mDSEffect;
QPixmap mPixmap;
QPoint mDragStartPosition;