diff --git a/cropeditor/cropeditor.cpp b/cropeditor/cropeditor.cpp index 5f20816..61c3f53 100644 --- a/cropeditor/cropeditor.cpp +++ b/cropeditor/cropeditor.cpp @@ -2,22 +2,22 @@ #include "cropscene.hpp" #include "cropview.hpp" +#include #include #include #include +#include #include #include CropEditor::CropEditor(QPixmap *image, QObject *parent) : QObject(parent) { scene = new CropScene(parent, image); view = new CropView(scene); - QPixmap *scaled = new QPixmap(); - image->scaled(view->width(), view->height()).swap(*scaled); - pixmapItem = new QGraphicsPixmapItem(*scaled); + qreal ratio = QApplication::primaryScreen()->devicePixelRatio(); + pixmapItem = new QGraphicsPixmapItem(image->scaled(image->width() / ratio, image->height() / ratio)); pixmapItem->setZValue(-1); scene->addItem(pixmapItem); scene->setSceneRect(image->rect()); - view->setGeometry(0, 0, image->width(), image->height()); view->showFullScreen(); QTimer::singleShot(0, [&] { view->showFullScreen(); });