HiDPI Fixes

Fix various downscaled icons by removing undeeded multiplications by devicePixelRatio in sourceSize.

Fix downscaled PL indicator in the timeline by using the actual size as sourceSize.

Fix various blurry icons by specifying sourceSize.
This commit is contained in:
q234rty 2024-02-15 22:57:07 +08:00
parent 86796edae8
commit 7b07548b77
No known key found for this signature in database
GPG key ID: D7E83C63C8CC4545
7 changed files with 34 additions and 16 deletions

View file

@ -64,8 +64,16 @@ AbstractButton {
} else { } else {
return ""; return "";
} }
sourceSize.height: avatar.height * Screen.devicePixelRatio sourceSize.height: if (!avatar.url.startsWith('image://MxcImage/') && avatar.url.endsWith('.svg')){
sourceSize.width: avatar.width * Screen.devicePixelRatio return avatar.height
} else {
return avatar.height * Screen.devicePixelRatio
}
sourceSize.width: if (!avatar.url.startsWith('image://MxcImage/') && avatar.url.endsWith('.svg')){
return avatar.width
} else {
return avatar.width * Screen.devicePixelRatio
}
} }
Rectangle { Rectangle {
id: onlineIndicator id: onlineIndicator

View file

@ -40,8 +40,8 @@ RowLayout {
ToolTip.text: qsTr("Edited") ToolTip.text: qsTr("Edited")
ToolTip.visible: editHovered.hovered ToolTip.visible: editHovered.hovered
source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((metadata.eventId == metadata.room.edit) ? palette.highlight : palette.buttonText) source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((metadata.eventId == metadata.room.edit) ? palette.highlight : palette.buttonText)
sourceSize.height: parent.iconSize * Screen.devicePixelRatio sourceSize.height: parent.iconSize
sourceSize.width: parent.iconSize * Screen.devicePixelRatio sourceSize.width: parent.iconSize
visible: metadata.isEdited || metadata.eventId == metadata.room.edit visible: metadata.isEdited || metadata.eventId == metadata.room.edit
HoverHandler { HoverHandler {
id: editHovered id: editHovered
@ -66,8 +66,8 @@ RowLayout {
Layout.preferredHeight: parent.iconSize Layout.preferredHeight: parent.iconSize
Layout.preferredWidth: parent.iconSize Layout.preferredWidth: parent.iconSize
encrypted: metadata.isEncrypted encrypted: metadata.isEncrypted
sourceSize.height: parent.iconSize * Screen.devicePixelRatio sourceSize.height: parent.iconSize
sourceSize.width: parent.iconSize * Screen.devicePixelRatio sourceSize.width: parent.iconSize
trust: metadata.trustlevel trust: metadata.trustlevel
visible: metadata.room.isEncrypted visible: metadata.room.isEncrypted
} }

View file

@ -92,8 +92,8 @@ Column {
height: fontMetrics.ascent height: fontMetrics.ascent
width: height width: height
sourceSize.width: fontMetrics.lineSpacing sourceSize.width: width
sourceSize.height: fontMetrics.lineSpacing sourceSize.height: height
permissions: room ? room.permissions : null permissions: room ? room.permissions : null
visible: isAdmin || isModerator visible: isAdmin || isModerator

View file

@ -141,8 +141,8 @@ AbstractButton {
source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + palette.buttonText) source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + palette.buttonText)
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.width: parent.width * Screen.devicePixelRatio sourceSize.width: blurhash ? parent.width * Screen.devicePixelRatio : Math.min(parent.width, parent.height)
sourceSize.height: parent.height * Screen.devicePixelRatio sourceSize.height: blurhash ? parent.height * Screen.devicePixelRatio : Math.min(parent.width, parent.height)
anchors.fill: parent anchors.fill: parent
} }

View file

@ -162,6 +162,10 @@ ApplicationWindow {
} }
PowerlevelIndicator { PowerlevelIndicator {
Layout.preferredWidth: fontMetrics.lineSpacing * 2
Layout.preferredHeight: fontMetrics.lineSpacing * 2
sourceSize.width: width
sourceSize.height: height
powerlevel: model.powerlevel powerlevel: model.powerlevel
permissions: room.permissions permissions: room.permissions
} }
@ -169,8 +173,10 @@ ApplicationWindow {
EncryptionIndicator { EncryptionIndicator {
id: encryptInd id: encryptInd
Layout.preferredWidth: 16 Layout.preferredWidth: fontMetrics.lineSpacing * 2
Layout.preferredHeight: 16 Layout.preferredHeight: fontMetrics.lineSpacing * 2
sourceSize.width: width
sourceSize.height: height
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
visible: room.isEncrypted visible: room.isEncrypted
encrypted: room.isEncrypted encrypted: room.isEncrypted

View file

@ -232,6 +232,8 @@ ApplicationWindow {
EncryptionIndicator { EncryptionIndicator {
Layout.preferredHeight: 32 Layout.preferredHeight: 32
Layout.preferredWidth: 32 Layout.preferredWidth: 32
sourceSize.width: width
sourceSize.height: height
encrypted: profile.userVerificationEnabled encrypted: profile.userVerificationEnabled
trust: profile.userVerified trust: profile.userVerified
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -364,8 +366,8 @@ ApplicationWindow {
Layout.preferredHeight: 16 Layout.preferredHeight: 16
Layout.preferredWidth: 16 Layout.preferredWidth: 16
visible: profile.isSelf && verificationStatus != VerificationStatus.NOT_APPLICABLE visible: profile.isSelf && verificationStatus != VerificationStatus.NOT_APPLICABLE
sourceSize.height: 16 * Screen.devicePixelRatio sourceSize.height: height
sourceSize.width: 16 * Screen.devicePixelRatio sourceSize.width: width
source: { source: {
switch (verificationStatus) { switch (verificationStatus) {
case VerificationStatus.VERIFIED: case VerificationStatus.VERIFIED:
@ -446,6 +448,8 @@ ApplicationWindow {
Image { Image {
Layout.preferredHeight: 16 Layout.preferredHeight: 16
Layout.preferredWidth: 16 Layout.preferredWidth: 16
sourceSize.height: height
sourceSize.width: width
visible: !profile.isSelf && verificationStatus != VerificationStatus.NOT_APPLICABLE visible: !profile.isSelf && verificationStatus != VerificationStatus.NOT_APPLICABLE
source: { source: {
switch (verificationStatus) { switch (verificationStatus) {

View file

@ -112,8 +112,8 @@ Item {
visible: regis.usernameAvailable || regis.usernameUnavailable visible: regis.usernameAvailable || regis.usernameUnavailable
ToolTip.visible: ma.hovered ToolTip.visible: ma.hovered
ToolTip.text: qsTr("Back") ToolTip.text: qsTr("Back")
sourceSize.height: height * Screen.devicePixelRatio sourceSize.height: height
sourceSize.width: width * Screen.devicePixelRatio sourceSize.width: width
HoverHandler { HoverHandler {
id: ma id: ma
} }