Update: Refactored how layout positioning works.

This commit is contained in:
Keyitdev
2026-07-10 19:03:51 +02:00
parent 61e74ac096
commit 60a73a22ef
6 changed files with 170 additions and 115 deletions
+15 -17
View File
@@ -15,8 +15,8 @@ Column {
property ComboBox exposeSession: sessionSelect.exposeSession
property bool failed
// Custom addition: exposes the face icon of the currently typed/selected
// user so it can be shown in ProfilePicture, above the login field
readonly property real fontUnit: root.font.pointSize
property url currentUserIcon: {
var typedUser = username.text
for (var i = 0; i < userRegistry.list.length; i++) {
@@ -58,8 +58,7 @@ Column {
Item {
id: errorMessageField
// change also in selectSession
height: root.font.pointSize * 2
height: fontUnit * 1.5
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -69,7 +68,8 @@ Column {
width: parent.width
horizontalAlignment: Text.AlignHCenter
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : null
text: failed ? config.TranslateLoginFailedWarning || textConstants.loginFailed + "!" : keyboard.capsLock ? config.TranslateCapslockWarning || textConstants.capslockWarning : ""
font.pointSize: root.font.pointSize * 0.8
font.italic: true
color: config.WarningColor
@@ -107,7 +107,7 @@ Column {
Item {
id: usernameField
height: root.font.pointSize * 4.5
height: root.font.pointSize * 4
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -142,7 +142,7 @@ Column {
delegate: ItemDelegate {
// minus padding
width: popupHandler.width - 20
width: popupHandler.width - (fontUnit * 1.5)
anchors.horizontalCenter: popupHandler.horizontalCenter
contentItem: Text {
@@ -170,8 +170,8 @@ Column {
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: selectUser.height * 0
icon.height: parent.height * 0.25
icon.width: parent.height * 0.25
icon.height: parent.height * 0.3
icon.width: parent.height * 0.3
enabled: false
icon.color: config.UserIconColor
icon.source: Qt.resolvedUrl("../Assets/User.svg")
@@ -195,10 +195,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: 10
padding: fontUnit * 0.75
contentItem: ListView {
implicitHeight: contentHeight + 20
implicitHeight: contentHeight + (fontUnit * 1.5)
clip: true
model: selectUser.popup.visible ? selectUser.delegateModel : null
@@ -308,7 +308,7 @@ Column {
Item {
id: passwordField
height: root.font.pointSize * 4.5
height: root.font.pointSize * 4
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
@@ -322,8 +322,8 @@ Column {
anchors.verticalCenter: parent.verticalCenter
z: 2
icon.height: parent.height * 0.25
icon.width: parent.height * 0.25
icon.height: parent.height * 0.3
icon.width: parent.height * 0.3
icon.color: config.PasswordIconColor
icon.source: Qt.resolvedUrl("../Assets/Password2.svg")
@@ -443,9 +443,7 @@ Column {
Item {
id: login
// important
// try 4 or 9 ...
height: root.font.pointSize * 9
height: loginButton.implicitHeight + (fontUnit * 3.7)
width: parent.width / 2
anchors.horizontalCenter: parent.horizontalCenter
+91 -39
View File
@@ -2,70 +2,122 @@
// Copyright (C) 2022-2025 Keyitdev
// Based on https://github.com/MarianArlt/sddm-sugar-dark
// Distributed under the GPLv3+ License https://www.gnu.org/licenses/gpl-3.0.html
import QtQuick 2.15
import QtQuick.Layouts 1.15
import SddmComponents 2.0 as SDDM
ColumnLayout {
Item {
id: formContainer
SDDM.TextConstants { id: textConstants }
property int p: config.ScreenPadding == "" ? 0 : config.ScreenPadding
property string a: config.FormPosition
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
ColumnLayout {
id: topGroup
spacing: 0
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
Rectangle {
id: clockBox
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: clockTopMargin
Layout.preferredHeight: clock.implicitHeight + (fontUnit * 1.5)
implicitWidth: clock.implicitWidth + (fontUnit * 3)
radius: 20
Layout.preferredWidth: implicitWidth
Clock {
anchors.fill: parent
id: clock
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
// important
Layout.preferredHeight: root.height / 3
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
Layout.alignment: Qt.AlignHCenter
}
}
Rectangle {
id: profilePictureBox
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: profilePictureTopMargin
Layout.preferredHeight: profilePicture.height
implicitWidth: profilePicture.width + (fontUnit * 3)
Layout.preferredWidth: implicitWidth
ProfilePicture {
id: profilePicture
visible: false
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: root.height / 7
Layout.preferredHeight: root.height / 7
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
visible: config.ShowProfilePicture == "true" ? true : false
anchors.centerIn: parent
width: fontUnit * 11
height: fontUnit * 11
}
}
Rectangle {
id: inputBox
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: loginInputTopMargin
Layout.preferredHeight: input.implicitHeight
implicitWidth: input.implicitWidth
Layout.preferredWidth: implicitWidth
Input {
id: input
Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: root.height / 10
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
Layout.topMargin: 0
anchors.centerIn: parent
width: fontUnit * 60
}
}
}
ColumnLayout {
id: bottomGroup
spacing: 0
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
Rectangle {
id: systemButtonsBox
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: systemButtonsBottomMargin
Layout.preferredHeight: systemButtons.implicitHeight
implicitWidth: systemButtons.implicitWidth
Layout.preferredWidth: implicitWidth
SystemButtons {
id: systemButtons
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.preferredHeight: root.height / 5
Layout.maximumHeight: root.height / 5
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
exposedSession: input.exposeSession
anchors.centerIn: parent
}
}
Rectangle {
id: sessionSelectBox
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: sessionSelectBottomMargin
Layout.preferredHeight: sessionSelect.height
implicitWidth: sessionSelect.width
Layout.preferredWidth: implicitWidth
SessionButton {
id: sessionSelect
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.preferredHeight: root.height / 54
Layout.maximumHeight: root.height / 54
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
anchors.centerIn: parent
width: fontUnit * 30
}
}
Rectangle {
id: virtualKeyboardButtonBox
color: "transparent"
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: virtualKeyboardButtonBottomMargin
Layout.preferredHeight: virtualKeyboardButton.height
implicitWidth: virtualKeyboardButton.width
Layout.preferredWidth: implicitWidth
VirtualKeyboardButton {
id: virtualKeyboardButton
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.preferredHeight: root.height / 27
Layout.maximumHeight: root.height / 27
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
anchors.centerIn: parent
width: fontUnit * 30
}
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ import QtQuick.Effects
Item {
id: profilePicture
// visible: false
property url userIcon: input.currentUserIcon
property bool hasCustomIcon: userIcon != ""
+2 -4
View File
@@ -9,7 +9,7 @@ import QtQuick.Controls 2.15
Item {
id: sessionButton
height: root.font.pointSize
height: selectSession.height
width: parent.width / 2
property var selectedSession: selectSession.currentIndex
@@ -20,9 +20,7 @@ Item {
ComboBox {
id: selectSession
// important
// change also in errorMessage
height: root.font.pointSize * 2
height: root.font.pointSize
anchors.horizontalCenter: parent.horizontalCenter
hoverEnabled: true
-1
View File
@@ -25,7 +25,6 @@ RowLayout {
RoundButton {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: root.font.pointSize * 6.5
text: modelData[1]
font.pointSize: root.font.pointSize * 0.8
+9 -1
View File
@@ -6,9 +6,14 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
Item {
id: virtualKeyboardButtonRoot
height: virtualKeyboardButton.height
width: parent.width / 2
Button {
id: virtualKeyboardButton
height: root.font.pointSize
anchors.horizontalCenter: parent.horizontalCenter
z: 1
@@ -28,6 +33,9 @@ Item {
contentItem: Text {
id: virtualKeyboardButtonText
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
font.pointSize: root.font.pointSize * 0.8
font.family: root.font.family