fix: handle hidpi properly
This commit is contained in:
parent
6777ad0a2d
commit
dea8efcc97
3 changed files with 13 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Caelestia.Images
|
||||
|
||||
Image {
|
||||
|
|
@ -9,5 +10,8 @@ Image {
|
|||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: IUtils.urlForPath(path, fillMode)
|
||||
sourceSize: Qt.size(width, height)
|
||||
sourceSize: {
|
||||
const dpr = (QsWindow.window as QsWindow)?.devicePixelRatio ?? 1;
|
||||
return Qt.size(width * dpr, height * dpr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Caelestia.Config
|
||||
import Caelestia.Models
|
||||
import qs.components
|
||||
|
|
@ -66,7 +67,10 @@ Item {
|
|||
anchors.fill: parent
|
||||
path: root.modelData.path
|
||||
smooth: !root.PathView.view.moving
|
||||
sourceSize: Qt.size(image.implicitWidth, image.implicitHeight)
|
||||
sourceSize: {
|
||||
const dpr = (QsWindow.window as QsWindow)?.devicePixelRatio ?? 1;
|
||||
return Qt.size(image.implicitWidth * dpr, image.implicitHeight * dpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ IUtils* IUtils::create(QQmlEngine* engine, QJSEngine* jsEngine) {
|
|||
}
|
||||
|
||||
QUrl IUtils::urlForPath(const QString& path, int fillMode) {
|
||||
if (path.isEmpty())
|
||||
return QUrl();
|
||||
|
||||
QString prefix;
|
||||
switch (fillMode) {
|
||||
case 1: // Image.PreserveAspectFit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue