Update: Refactored how scaling works across different resolutions.

This commit is contained in:
Keyitdev
2026-07-11 01:11:47 +02:00
parent 60a73a22ef
commit 57f0ae7221
8 changed files with 77 additions and 55 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: root.font.pointSize * 3 font.pointSize: rootFontSize * 3
color: config.HeaderTextColor color: config.HeaderTextColor
renderType: Text.QtRendering renderType: Text.QtRendering
text: config.HeaderText text: config.HeaderText
@@ -28,7 +28,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: root.font.pointSize * 9 font.pointSize: rootFontSize * 9
font.bold: true font.bold: true
color: config.TimeTextColor color: config.TimeTextColor
renderType: Text.QtRendering renderType: Text.QtRendering
@@ -44,7 +44,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: config.DateTextColor color: config.DateTextColor
font.pointSize: root.font.pointSize * 2 font.pointSize: rootFontSize * 2
font.bold: true font.bold: true
renderType: Text.QtRendering renderType: Text.QtRendering
+40 -20
View File
@@ -11,11 +11,13 @@ Column {
id: inputContainer id: inputContainer
Layout.fillWidth: true Layout.fillWidth: true
spacing: 0
property ComboBox exposeSession: sessionSelect.exposeSession property ComboBox exposeSession: sessionSelect.exposeSession
property bool failed property bool failed
readonly property real fontUnit: root.font.pointSize readonly property real passwordFieldTopMargin: (Number(config.PasswordFieldTopMargin) || 0) * rootHeightUnit
readonly property real loginButtonTopMargin: (Number(config.LoginButtonTopMargin) || 0) * rootHeightUnit
property url currentUserIcon: { property url currentUserIcon: {
var typedUser = username.text var typedUser = username.text
@@ -58,7 +60,7 @@ Column {
Item { Item {
id: errorMessageField id: errorMessageField
height: fontUnit * 1.5 height: rootHeightUnit * 1.5
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -70,7 +72,7 @@ Column {
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : "" text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : ""
font.pointSize: root.font.pointSize * 0.8 font.pointSize: rootFontSize
font.italic: true font.italic: true
color: config.WarningColor color: config.WarningColor
opacity: 0 opacity: 0
@@ -107,7 +109,7 @@ Column {
Item { Item {
id: usernameField id: usernameField
height: root.font.pointSize * 4 height: username.height
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -142,7 +144,7 @@ Column {
delegate: ItemDelegate { delegate: ItemDelegate {
// minus padding // minus padding
width: popupHandler.width - (fontUnit * 1.5) width: popupHandler.width - (rootWidthUnit * 1.5)
anchors.horizontalCenter: popupHandler.horizontalCenter anchors.horizontalCenter: popupHandler.horizontalCenter
contentItem: Text { contentItem: Text {
@@ -150,7 +152,7 @@ Column {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: config.UseRealName == "true" ? (model.realName || model.name) : model.name text: config.UseRealName == "true" ? (model.realName || model.name) : model.name
font.pointSize: root.font.pointSize * 0.8 font.pointSize: rootFontSize
font.capitalization: Font.MixedCase font.capitalization: Font.MixedCase
font.family: root.font.family font.family: root.font.family
color: config.DropdownTextColor color: config.DropdownTextColor
@@ -168,10 +170,10 @@ Column {
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0 anchors.leftMargin: selectUser.height * 0.2
icon.height: parent.height * 0.3 icon.height: parent.height * 0.4
icon.width: parent.height * 0.3 icon.width: parent.height * 0.4
enabled: false enabled: false
icon.color: config.UserIconColor icon.color: config.UserIconColor
icon.source: Qt.resolvedUrl("../Assets/User.svg") icon.source: Qt.resolvedUrl("../Assets/User.svg")
@@ -195,10 +197,10 @@ Column {
y: parent.height - username.height / 3 y: parent.height - username.height / 3
x: config.RightToLeftLayout == "true" ? -loginButton.width + selectUser.width : 0 x: config.RightToLeftLayout == "true" ? -loginButton.width + selectUser.width : 0
rightMargin: config.RightToLeftLayout == "true" ? root.padding + usernameField.width / 2 : undefined rightMargin: config.RightToLeftLayout == "true" ? root.padding + usernameField.width / 2 : undefined
padding: fontUnit * 0.75 padding: rootHeightUnit * 0.75
contentItem: ListView { contentItem: ListView {
implicitHeight: contentHeight + (fontUnit * 1.5) implicitHeight: contentHeight + (rootHeightUnit * 1.5)
clip: true clip: true
model: selectUser.popup.visible ? selectUser.delegateModel : null model: selectUser.popup.visible ? selectUser.delegateModel : null
@@ -258,9 +260,12 @@ Column {
id: username id: username
anchors.centerIn: parent anchors.centerIn: parent
height: root.font.pointSize * 3 height: rootHeightUnit * 3
width: parent.width width: parent.width
font.pointSize: rootFontSize
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
leftPadding: selectUser.width
rightPadding: selectUser.width
z: 1 z: 1
text: config.ForceLastUser == "true" ? selectUser.displayText : null text: config.ForceLastUser == "true" ? selectUser.displayText : null
@@ -305,10 +310,16 @@ Column {
} }
} }
Item {
id: passwordFieldSpacer
width: 1
height: passwordFieldTopMargin
}
Item { Item {
id: passwordField id: passwordField
height: root.font.pointSize * 4 height: password.height
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -318,12 +329,12 @@ Column {
height: parent.height height: parent.height
width: selectUser.height * 1 width: selectUser.height * 1
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: selectUser.height * 0 anchors.leftMargin: selectUser.height * 0.2
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
z: 2 z: 2
icon.height: parent.height * 0.3 icon.height: parent.height * 0.4
icon.width: parent.height * 0.3 icon.width: parent.height * 0.4
icon.color: config.PasswordIconColor icon.color: config.PasswordIconColor
icon.source: Qt.resolvedUrl("../Assets/Password2.svg") icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
@@ -389,10 +400,13 @@ Column {
TextField { TextField {
id: password id: password
height: root.font.pointSize * 3 height: rootHeightUnit * 3
width: parent.width width: parent.width
font.pointSize: rootFontSize
anchors.centerIn: parent anchors.centerIn: parent
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
leftPadding: passwordIcon.width
rightPadding: passwordIcon.width
font.bold: true font.bold: true
color: config.PasswordFieldTextColor color: config.PasswordFieldTextColor
@@ -440,10 +454,16 @@ Column {
] ]
} }
Item {
id: loginButtonSpacer
width: 1
height: loginButtonTopMargin
}
Item { Item {
id: login id: login
height: loginButton.implicitHeight + (fontUnit * 3.7) height: loginButton.height
width: parent.width / 2 width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@@ -452,7 +472,7 @@ Column {
Button { Button {
id: loginButton id: loginButton
height: root.font.pointSize * 3 height: rootHeightUnit * 3
implicitWidth: parent.width implicitWidth: parent.width
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -466,7 +486,7 @@ Column {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.bold: true font.bold: true
font.pointSize: root.font.pointSize font.pointSize: rootFontSize
font.family: root.font.family font.family: root.font.family
color: config.LoginButtonTextColor color: config.LoginButtonTextColor
text: parent.text text: parent.text
+14 -16
View File
@@ -9,14 +9,12 @@ Item {
id: formContainer id: formContainer
SDDM.TextConstants { id: textConstants } SDDM.TextConstants { id: textConstants }
readonly property real fontUnit: root.font.pointSize readonly property real clockTopMargin: (Number(config.ClockTopMargin) || 0) * rootHeightUnit
readonly property real profilePictureTopMargin: (Number(config.ProfilePictureTopMargin) || 0) * rootHeightUnit
readonly property real clockTopMargin: (Number(config.ClockTopMargin) || 0) * fontUnit readonly property real loginInputTopMargin: (Number(config.LoginInputTopMargin) || 0) * rootHeightUnit
readonly property real profilePictureTopMargin: (Number(config.ProfilePictureTopMargin) || 0) * fontUnit readonly property real systemButtonsBottomMargin: (Number(config.SystemButtonsBottomMargin) || 0) * rootHeightUnit
readonly property real loginInputTopMargin: (Number(config.LoginInputTopMargin) || 0) * fontUnit readonly property real sessionSelectBottomMargin: (Number(config.SessionSelectBottomMargin) || 0) * rootHeightUnit
readonly property real systemButtonsBottomMargin: (Number(config.SystemButtonsBottomMargin) || 0) * fontUnit readonly property real virtualKeyboardButtonBottomMargin: (Number(config.VirtualKeyboardButtonBottomMargin) || 0) * rootHeightUnit
readonly property real sessionSelectBottomMargin: (Number(config.SessionSelectBottomMargin) || 0) * fontUnit
readonly property real virtualKeyboardButtonBottomMargin: (Number(config.VirtualKeyboardButtonBottomMargin) || 0) * fontUnit
ColumnLayout { ColumnLayout {
id: topGroup id: topGroup
@@ -29,8 +27,8 @@ Item {
color: "transparent" color: "transparent"
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: clockTopMargin Layout.topMargin: clockTopMargin
Layout.preferredHeight: clock.implicitHeight + (fontUnit * 1.5) Layout.preferredHeight: clock.implicitHeight + (rootHeightUnit * 1.5)
implicitWidth: clock.implicitWidth + (fontUnit * 3) implicitWidth: clock.implicitWidth + (rootWidthUnit * 3)
radius: 20 radius: 20
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
Clock { Clock {
@@ -45,14 +43,14 @@ Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: profilePictureTopMargin Layout.topMargin: profilePictureTopMargin
Layout.preferredHeight: profilePicture.height Layout.preferredHeight: profilePicture.height
implicitWidth: profilePicture.width + (fontUnit * 3) implicitWidth: profilePicture.width + (rootWidthUnit * 3)
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
ProfilePicture { ProfilePicture {
id: profilePicture id: profilePicture
visible: config.ShowProfilePicture == "true" ? true : false visible: config.ShowProfilePicture == "true" ? true : false
anchors.centerIn: parent anchors.centerIn: parent
width: fontUnit * 11 width: rootHeightUnit * 11
height: fontUnit * 11 height: rootHeightUnit * 11
} }
} }
Rectangle { Rectangle {
@@ -66,7 +64,7 @@ Item {
Input { Input {
id: input id: input
anchors.centerIn: parent anchors.centerIn: parent
width: fontUnit * 60 width: rootWidthUnit * 65
} }
} }
} }
@@ -102,7 +100,7 @@ Item {
SessionButton { SessionButton {
id: sessionSelect id: sessionSelect
anchors.centerIn: parent anchors.centerIn: parent
width: fontUnit * 30 width: rootWidthUnit * 32.5
} }
} }
Rectangle { Rectangle {
@@ -116,7 +114,7 @@ Item {
VirtualKeyboardButton { VirtualKeyboardButton {
id: virtualKeyboardButton id: virtualKeyboardButton
anchors.centerIn: parent anchors.centerIn: parent
width: fontUnit * 30 width: rootWidthUnit * 32.5
} }
} }
} }
+5 -5
View File
@@ -10,7 +10,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: avatarImage anchors.fill: avatarImage
radius: width / 2 radius: width / 2
color: config.LoginFieldBackgroundColor || "#000000" color: config.ProfilePictureBorderColor
opacity: 0.2 opacity: 0.2
z: -1 z: -1
} }
@@ -33,7 +33,7 @@ Item {
id: circleMask id: circleMask
anchors.fill: avatarImage anchors.fill: avatarImage
radius: width / 2 radius: config.ProfilePictureRoundedCorners || 0
visible: false visible: false
layer.enabled: true layer.enabled: true
} }
@@ -49,9 +49,9 @@ Item {
id: ringBorder id: ringBorder
anchors.fill: parent anchors.fill: parent
radius: width / 2 radius: config.ProfilePictureRoundedCorners || 0
color: "transparent" color: "transparent"
border.width: 3 border.width: config.ProfilePictureBorderWidth || 2
border.color: config.DateTextColor || "#ffffff" border.color: config.ProfilePictureBorderColor
} }
} }
+4 -4
View File
@@ -20,7 +20,7 @@ Item {
ComboBox { ComboBox {
id: selectSession id: selectSession
height: root.font.pointSize height: rootHeightUnit
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
hoverEnabled: true hoverEnabled: true
@@ -44,7 +44,7 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: model.name text: model.name
font.pointSize: root.font.pointSize * 0.8 font.pointSize: rootFontSize
font.family: root.font.family font.family: root.font.family
color: config.DropdownTextColor color: config.DropdownTextColor
} }
@@ -65,7 +65,7 @@ Item {
text: (config.TranslateSessionSelection || "Session") + " (" + selectSession.currentText + ")" text: (config.TranslateSessionSelection || "Session") + " (" + selectSession.currentText + ")"
color: config.SessionButtonTextColor color: config.SessionButtonTextColor
font.pointSize: root.font.pointSize * 0.8 font.pointSize: rootFontSize * 0.8
font.family: root.font.family font.family: root.font.family
Keys.onReleased: parent.popup.open() Keys.onReleased: parent.popup.open()
@@ -83,7 +83,7 @@ Item {
implicitHeight: contentItem.implicitHeight implicitHeight: contentItem.implicitHeight
width: sessionButton.width width: sessionButton.width
y: parent.height - 1 y: parent.height + rootHeightUnit
x: -popupHandler.width/2 + displayedItem.width/2 x: -popupHandler.width/2 + displayedItem.width/2
padding: 10 padding: 10
+3 -3
View File
@@ -27,10 +27,10 @@ RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
text: modelData[1] text: modelData[1]
font.pointSize: root.font.pointSize * 0.8 font.pointSize: rootFontSize * 0.8
icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg") : "" icon.source: modelData ? Qt.resolvedUrl("../Assets/" + modelData[0] + ".svg") : ""
icon.height: 2 * Math.round((root.font.pointSize * 3) / 2) icon.height: 2 * Math.round((rootFontSize * 3) / 2)
icon.width: 2 * Math.round((root.font.pointSize * 3) / 2) icon.width: 2 * Math.round((rootFontSize * 3) / 2)
icon.color: config.SystemButtonsIconsColor icon.color: config.SystemButtonsIconsColor
palette.buttonText: config.SystemButtonsIconsColor palette.buttonText: config.SystemButtonsIconsColor
display: AbstractButton.TextUnderIcon display: AbstractButton.TextUnderIcon
+2 -2
View File
@@ -13,7 +13,7 @@ Item {
Button { Button {
id: virtualKeyboardButton id: virtualKeyboardButton
height: root.font.pointSize height: rootHeightUnit
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
z: 1 z: 1
@@ -37,7 +37,7 @@ Item {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)" text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
font.pointSize: root.font.pointSize * 0.8 font.pointSize: rootFontSize * 0.8
font.family: root.font.family font.family: root.font.family
color: parent.visualFocus ? config.HoverVirtualKeyboardButtonTextColor : config.VirtualKeyboardButtonTextColor color: parent.visualFocus ? config.HoverVirtualKeyboardButtonTextColor : config.VirtualKeyboardButtonTextColor
} }
+6 -2
View File
@@ -15,7 +15,7 @@ Pane {
id: root id: root
height: config.ScreenHeight || Screen.height height: config.ScreenHeight || Screen.height
width: config.ScreenWidth || Screen.ScreenWidth width: config.ScreenWidth || Screen.width
padding: config.ScreenPadding padding: config.ScreenPadding
LayoutMirroring.enabled: config.RightToLeftLayout == "true" ? true : Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.enabled: config.RightToLeftLayout == "true" ? true : Qt.application.layoutDirection === Qt.RightToLeft
@@ -27,7 +27,11 @@ Pane {
palette.buttonText: config.HoverSystemButtonsIconsColor palette.buttonText: config.HoverSystemButtonsIconsColor
font.family: config.Font font.family: config.Font
font.pointSize: config.FontSize !== "" ? config.FontSize : parseInt(height / 80) || 13 // font.pointSize: config.FontSize !== "" ? config.FontSize : parseInt(height / 80) || 13
//
property real rootFontSize: config.FontSize !== "" ? config.FontSize : (height / 90) || 12
property real rootHeightUnit: config.HeightUnit !== "" ? config.HeightUnit : (height / 90) || 12
property real rootWidthUnit: config.WidthUnit !== "" ? config.WidthUnit : (width / 160) || 12
focus: true focus: true