diff --git a/Components/Input.qml b/Components/Input.qml index b81d1ed..6bbe75b 100644 --- a/Components/Input.qml +++ b/Components/Input.qml @@ -73,7 +73,7 @@ Column { anchors.left: parent.left property var popkey: config.RightToLeftLayout == "true" ? Qt.Key_Right : Qt.Key_Left - Keys.onPressed: { + Keys.onPressed: function(event) { if (event.key == Qt.Key_Down && !popup.opened) username.forceActiveFocus(); if ((event.key == Qt.Key_Up || event.key == popkey) && !popup.opened) @@ -92,8 +92,9 @@ Column { } delegate: ItemDelegate { - width: parent.width - anchors.horizontalCenter: parent.horizontalCenter + // minus padding + width: popupHandler.width - 20 + anchors.horizontalCenter: popupHandler.horizontalCenter contentItem: Text { text: model.name font.pointSize: root.font.pointSize * 0.8 @@ -103,7 +104,7 @@ Column { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } - highlighted: parent.highlightedIndex === index + // highlighted: parent.highlightedIndex === index background: Rectangle { color: selectUser.highlightedIndex === index ? config.DropdownSelectedBackgroundColor : "transparent" } @@ -134,6 +135,7 @@ Column { } popup: Popup { + id: popupHandler 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 diff --git a/Components/LoginForm.qml b/Components/LoginForm.qml index 871b671..d44b9c4 100644 --- a/Components/LoginForm.qml +++ b/Components/LoginForm.qml @@ -33,10 +33,21 @@ ColumnLayout { SystemButtons { id: systemButtons Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - Layout.preferredHeight: root.height / 4 - Layout.maximumHeight: root.height / 4 + 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 } + SessionButton { + id: sessionSelect + // anchors.bottom: parent.bottom + // anchors.bottomMargin: parent.height/16 + // Layout.bottomMargin: parent.height/16 + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + Layout.preferredHeight: root.height / 14 + Layout.maximumHeight: root.height / 14 + Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 + } + } diff --git a/Components/SessionButton.qml b/Components/SessionButton.qml index 4591519..2502192 100644 --- a/Components/SessionButton.qml +++ b/Components/SessionButton.qml @@ -10,7 +10,7 @@ Item { id: sessionButton height: root.font.pointSize width: parent.width / 2 - anchors.horizontalCenter: parent.horizontalCenter + // anchors.horizontalCenter: parent.horizontalCenter property var selectedSession: selectSession.currentIndex property string textConstantSession property int loginButtonWidth @@ -23,21 +23,25 @@ Item { height: root.font.pointSize * 2 hoverEnabled: true anchors.horizontalCenter: parent.horizontalCenter - Keys.onPressed: { - if (event.key == Qt.Key_Up && loginButton.state != "enabled" && !popup.opened) - revealSecret.focus = true, - revealSecret.state = "focused", - currentIndex = currentIndex + 1; - if (event.key == Qt.Key_Up && loginButton.state == "enabled" && !popup.opened) - loginButton.focus = true, - loginButton.state = "focused", - currentIndex = currentIndex + 1; - if (event.key == Qt.Key_Down && !popup.opened) - systemButtons.children[0].focus = true, - systemButtons.children[0].state = "focused", - currentIndex = currentIndex - 1; - if ((event.key == Qt.Key_Left || event.key == Qt.Key_Right) && !popup.opened) - popup.open(); + Keys.onPressed: function(event) { + if (event.key == Qt.Key_Up && loginButton.state != "enabled" && !popup.opened) { + revealSecret.focus = true; + revealSecret.state = "focused"; + currentIndex = currentIndex + 1; + } + if (event.key == Qt.Key_Up && loginButton.state == "enabled" && !popup.opened) { + loginButton.focus = true; + loginButton.state = "focused"; + currentIndex = currentIndex + 1; + } + if (event.key == Qt.Key_Down && !popup.opened) { + systemButtons.children[0].focus = true; + systemButtons.children[0].state = "focused"; + currentIndex = currentIndex - 1; + } + if ((event.key == Qt.Key_Left || event.key == Qt.Key_Right) && !popup.opened) { + popup.open(); + } } model: sessionModel @@ -45,8 +49,9 @@ Item { textRole: "name" delegate: ItemDelegate { - width: parent.width - anchors.horizontalCenter: parent.horizontalCenter + // minus padding + width: popupHandler.width - 20 + anchors.horizontalCenter: popupHandler.horizontalCenter contentItem: Text { text: model.name font.pointSize: root.font.pointSize * 0.8 @@ -55,7 +60,7 @@ Item { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter } - highlighted: parent.highlightedIndex === index + // highlighted: parent.highlightedIndex === index background: Rectangle { color: selectSession.highlightedIndex === index ? config.DropdownSelectedBackgroundColor : "transparent" } @@ -77,13 +82,11 @@ Item { background: Rectangle { color: "transparent" - border.width: parent.visualFocus ? 1 : 0 - border.color: "transparent" height: parent.visualFocus ? 2 : 0 width: displayedItem.implicitWidth - anchors.top: parent.bottom - anchors.left: parent.left - anchors.leftMargin: 3 + // anchors.top: parent.bottom + // anchors.left: parent.left + // anchors.leftMargin: 3 } popup: Popup { @@ -91,7 +94,6 @@ Item { width: sessionButton.width y: parent.height - 1 x: -popupHandler.width/2 + displayedItem.width/2 - // x: config.RightToLeftLayout == "true" ? -loginButtonWidth + displayedItem.width : 0 implicitHeight: contentItem.implicitHeight padding: 10 @@ -122,10 +124,6 @@ Item { target: displayedItem color: Qt.darker(config.HoverSessionButtonTextColor, 1.1) } - PropertyChanges { - target: selectSession.background - border.color: Qt.darker(config.HoverSessionButtonTextColor, 1.1) - } }, State { name: "hovered" @@ -134,10 +132,6 @@ Item { target: displayedItem color: Qt.lighter(config.HoverSessionButtonTextColor, 1.1) } - PropertyChanges { - target: selectSession.background - border.color: Qt.lighter(config.HoverSessionButtonTextColor, 1.1) - } }, State { name: "focused" @@ -146,17 +140,13 @@ Item { target: displayedItem color: config.HoverSessionButtonTextColor } - PropertyChanges { - target: selectSession.background - border.color: config.HoverSessionButtonTextColor - } } ] transitions: [ Transition { PropertyAnimation { - properties: "color, border.color" + properties: "color" duration: 150 } } diff --git a/Main.qml b/Main.qml index 88e9d34..59388cd 100644 --- a/Main.qml +++ b/Main.qml @@ -26,7 +26,8 @@ Pane { palette.buttonText: config.HoverSystemButtonsIconsColor font.family: config.Font - font.pointSize: config.FontSize !== "" ? config.FontSize : parseInt(height / 80) + font.pointSize: config.FontSize !== "" ? config.FontSize : parseInt(height / 80) || 13 + focus: true property bool leftleft: config.HaveFormBackground == "true" && @@ -83,12 +84,6 @@ Pane { anchors.left: config.FormPosition == "left" ? parent.left : undefined anchors.right: config.FormPosition == "right" ? parent.right : undefined z: 1 - - SessionButton { - id: sessionSelect - anchors.bottom: parent.bottom - anchors.bottomMargin: parent.height/16 - } } Button {