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
font.pointSize: root.font.pointSize * 3
font.pointSize: rootFontSize * 3
color: config.HeaderTextColor
renderType: Text.QtRendering
text: config.HeaderText
@@ -28,7 +28,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: root.font.pointSize * 9
font.pointSize: rootFontSize * 9
font.bold: true
color: config.TimeTextColor
renderType: Text.QtRendering
@@ -44,7 +44,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter
color: config.DateTextColor
font.pointSize: root.font.pointSize * 2
font.pointSize: rootFontSize * 2
font.bold: true
renderType: Text.QtRendering
+40 -20
View File
@@ -11,11 +11,13 @@ Column {
id: inputContainer
Layout.fillWidth: true
spacing: 0
property ComboBox exposeSession: sessionSelect.exposeSession
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: {
var typedUser = username.text
@@ -58,7 +60,7 @@ Column {
Item {
id: errorMessageField
height: fontUnit * 1.5
height: rootHeightUnit * 1.5
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -70,7 +72,7 @@ Column {
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
color: config.WarningColor
opacity: 0
@@ -107,7 +109,7 @@ Column {
Item {
id: usernameField
height: root.font.pointSize * 4
height: username.height
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -142,7 +144,7 @@ Column {
delegate: ItemDelegate {
// minus padding
width: popupHandler.width - (fontUnit * 1.5)
width: popupHandler.width - (rootWidthUnit * 1.5)
anchors.horizontalCenter: popupHandler.horizontalCenter
contentItem: Text {
@@ -150,7 +152,7 @@ Column {
horizontalAlignment: Text.AlignHCenter
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.family: root.font.family
color: config.DropdownTextColor
@@ -168,10 +170,10 @@ Column {
height: parent.height
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0
anchors.leftMargin: selectUser.height * 0.2
icon.height: parent.height * 0.3
icon.width: parent.height * 0.3
icon.height: parent.height * 0.4
icon.width: parent.height * 0.4
enabled: false
icon.color: config.UserIconColor
icon.source: Qt.resolvedUrl("../Assets/User.svg")
@@ -195,10 +197,10 @@ Column {
y: parent.height - username.height / 3
x: config.RightToLeftLayout == "true" ? -loginButton.width + selectUser.width : 0
rightMargin: config.RightToLeftLayout == "true" ? root.padding + usernameField.width / 2 : undefined
padding: fontUnit * 0.75
padding: rootHeightUnit * 0.75
contentItem: ListView {
implicitHeight: contentHeight + (fontUnit * 1.5)
implicitHeight: contentHeight + (rootHeightUnit * 1.5)
clip: true
model: selectUser.popup.visible ? selectUser.delegateModel : null
@@ -258,9 +260,12 @@ Column {
id: username
anchors.centerIn: parent
height: root.font.pointSize * 3
height: rootHeightUnit * 3
width: parent.width
font.pointSize: rootFontSize
horizontalAlignment: TextInput.AlignHCenter
leftPadding: selectUser.width
rightPadding: selectUser.width
z: 1
text: config.ForceLastUser == "true" ? selectUser.displayText : null
@@ -305,10 +310,16 @@ Column {
}
}
Item {
id: passwordFieldSpacer
width: 1
height: passwordFieldTopMargin
}
Item {
id: passwordField
height: root.font.pointSize * 4
height: password.height
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -318,12 +329,12 @@ Column {
height: parent.height
width: selectUser.height * 1
anchors.left: parent.left
anchors.leftMargin: selectUser.height * 0
anchors.leftMargin: selectUser.height * 0.2
anchors.verticalCenter: parent.verticalCenter
z: 2
icon.height: parent.height * 0.3
icon.width: parent.height * 0.3
icon.height: parent.height * 0.4
icon.width: parent.height * 0.4
icon.color: config.PasswordIconColor
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
@@ -389,10 +400,13 @@ Column {
TextField {
id: password
height: root.font.pointSize * 3
height: rootHeightUnit * 3
width: parent.width
font.pointSize: rootFontSize
anchors.centerIn: parent
horizontalAlignment: TextInput.AlignHCenter
leftPadding: passwordIcon.width
rightPadding: passwordIcon.width
font.bold: true
color: config.PasswordFieldTextColor
@@ -440,10 +454,16 @@ Column {
]
}
Item {
id: loginButtonSpacer
width: 1
height: loginButtonTopMargin
}
Item {
id: login
height: loginButton.implicitHeight + (fontUnit * 3.7)
height: loginButton.height
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -452,7 +472,7 @@ Column {
Button {
id: loginButton
height: root.font.pointSize * 3
height: rootHeightUnit * 3
implicitWidth: parent.width
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
@@ -466,7 +486,7 @@ Column {
verticalAlignment: Text.AlignVCenter
font.bold: true
font.pointSize: root.font.pointSize
font.pointSize: rootFontSize
font.family: root.font.family
color: config.LoginButtonTextColor
text: parent.text
+14 -16
View File
@@ -9,14 +9,12 @@ Item {
id: formContainer
SDDM.TextConstants { id: textConstants }
readonly property real fontUnit: root.font.pointSize
readonly property real clockTopMargin: (Number(config.ClockTopMargin) || 0) * fontUnit
readonly property real profilePictureTopMargin: (Number(config.ProfilePictureTopMargin) || 0) * fontUnit
readonly property real loginInputTopMargin: (Number(config.LoginInputTopMargin) || 0) * fontUnit
readonly property real systemButtonsBottomMargin: (Number(config.SystemButtonsBottomMargin) || 0) * fontUnit
readonly property real sessionSelectBottomMargin: (Number(config.SessionSelectBottomMargin) || 0) * fontUnit
readonly property real virtualKeyboardButtonBottomMargin: (Number(config.VirtualKeyboardButtonBottomMargin) || 0) * fontUnit
readonly property real clockTopMargin: (Number(config.ClockTopMargin) || 0) * rootHeightUnit
readonly property real profilePictureTopMargin: (Number(config.ProfilePictureTopMargin) || 0) * rootHeightUnit
readonly property real loginInputTopMargin: (Number(config.LoginInputTopMargin) || 0) * rootHeightUnit
readonly property real systemButtonsBottomMargin: (Number(config.SystemButtonsBottomMargin) || 0) * rootHeightUnit
readonly property real sessionSelectBottomMargin: (Number(config.SessionSelectBottomMargin) || 0) * rootHeightUnit
readonly property real virtualKeyboardButtonBottomMargin: (Number(config.VirtualKeyboardButtonBottomMargin) || 0) * rootHeightUnit
ColumnLayout {
id: topGroup
@@ -29,8 +27,8 @@ Item {
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: clockTopMargin
Layout.preferredHeight: clock.implicitHeight + (fontUnit * 1.5)
implicitWidth: clock.implicitWidth + (fontUnit * 3)
Layout.preferredHeight: clock.implicitHeight + (rootHeightUnit * 1.5)
implicitWidth: clock.implicitWidth + (rootWidthUnit * 3)
radius: 20
Layout.preferredWidth: implicitWidth
Clock {
@@ -45,14 +43,14 @@ Item {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: profilePictureTopMargin
Layout.preferredHeight: profilePicture.height
implicitWidth: profilePicture.width + (fontUnit * 3)
implicitWidth: profilePicture.width + (rootWidthUnit * 3)
Layout.preferredWidth: implicitWidth
ProfilePicture {
id: profilePicture
visible: config.ShowProfilePicture == "true" ? true : false
anchors.centerIn: parent
width: fontUnit * 11
height: fontUnit * 11
width: rootHeightUnit * 11
height: rootHeightUnit * 11
}
}
Rectangle {
@@ -66,7 +64,7 @@ Item {
Input {
id: input
anchors.centerIn: parent
width: fontUnit * 60
width: rootWidthUnit * 65
}
}
}
@@ -102,7 +100,7 @@ Item {
SessionButton {
id: sessionSelect
anchors.centerIn: parent
width: fontUnit * 30
width: rootWidthUnit * 32.5
}
}
Rectangle {
@@ -116,7 +114,7 @@ Item {
VirtualKeyboardButton {
id: virtualKeyboardButton
anchors.centerIn: parent
width: fontUnit * 30
width: rootWidthUnit * 32.5
}
}
}
+5 -5
View File
@@ -10,7 +10,7 @@ Item {
Rectangle {
anchors.fill: avatarImage
radius: width / 2
color: config.LoginFieldBackgroundColor || "#000000"
color: config.ProfilePictureBorderColor
opacity: 0.2
z: -1
}
@@ -33,7 +33,7 @@ Item {
id: circleMask
anchors.fill: avatarImage
radius: width / 2
radius: config.ProfilePictureRoundedCorners || 0
visible: false
layer.enabled: true
}
@@ -49,9 +49,9 @@ Item {
id: ringBorder
anchors.fill: parent
radius: width / 2
radius: config.ProfilePictureRoundedCorners || 0
color: "transparent"
border.width: 3
border.color: config.DateTextColor || "#ffffff"
border.width: config.ProfilePictureBorderWidth || 2
border.color: config.ProfilePictureBorderColor
}
}
+4 -4
View File
@@ -20,7 +20,7 @@ Item {
ComboBox {
id: selectSession
height: root.font.pointSize
height: rootHeightUnit
anchors.horizontalCenter: parent.horizontalCenter
hoverEnabled: true
@@ -44,7 +44,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
text: model.name
font.pointSize: root.font.pointSize * 0.8
font.pointSize: rootFontSize
font.family: root.font.family
color: config.DropdownTextColor
}
@@ -65,7 +65,7 @@ Item {
text: (config.TranslateSessionSelection || "Session") + " (" + selectSession.currentText + ")"
color: config.SessionButtonTextColor
font.pointSize: root.font.pointSize * 0.8
font.pointSize: rootFontSize * 0.8
font.family: root.font.family
Keys.onReleased: parent.popup.open()
@@ -83,7 +83,7 @@ Item {
implicitHeight: contentItem.implicitHeight
width: sessionButton.width
y: parent.height - 1
y: parent.height + rootHeightUnit
x: -popupHandler.width/2 + displayedItem.width/2
padding: 10
+3 -3
View File
@@ -27,10 +27,10 @@ RowLayout {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
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.height: 2 * Math.round((root.font.pointSize * 3) / 2)
icon.width: 2 * Math.round((root.font.pointSize * 3) / 2)
icon.height: 2 * Math.round((rootFontSize * 3) / 2)
icon.width: 2 * Math.round((rootFontSize * 3) / 2)
icon.color: config.SystemButtonsIconsColor
palette.buttonText: config.SystemButtonsIconsColor
display: AbstractButton.TextUnderIcon
+2 -2
View File
@@ -13,7 +13,7 @@ Item {
Button {
id: virtualKeyboardButton
height: root.font.pointSize
height: rootHeightUnit
anchors.horizontalCenter: parent.horizontalCenter
z: 1
@@ -37,7 +37,7 @@ Item {
horizontalAlignment: Text.AlignHCenter
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
font.pointSize: root.font.pointSize * 0.8
font.pointSize: rootFontSize * 0.8
font.family: root.font.family
color: parent.visualFocus ? config.HoverVirtualKeyboardButtonTextColor : config.VirtualKeyboardButtonTextColor
}