Commit 9bca22ef authored by Peter Wu's avatar Peter Wu
Browse files

Make the preview respect devicePixelScale

Make resizeEvent match setScreenshot in the pixmap scaling logic.

REVIEW: 129136
parent af746914
......@@ -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();
}
......@@ -53,6 +53,8 @@ class KSImageWidget : public QLabel
private:
void setScaledPixmap();
QGraphicsDropShadowEffect *mDSEffect;
QPixmap mPixmap;
QPoint mDragStartPosition;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment