Fix: Fixed virtual keyboard.

This commit is contained in:
Keyitdev
2024-09-11 22:12:36 +02:00
parent 3ff1700f92
commit e630cce6a8
5 changed files with 61 additions and 17 deletions
+1 -4
View File
@@ -13,9 +13,6 @@ ColumnLayout {
property int p: config.ScreenPadding property int p: config.ScreenPadding
property string a: config.FormPosition property string a: config.FormPosition
property alias systemButtonVisibility: systemButtons.visible
property alias clockVisibility: clock.visible
property bool virtualKeyboardActive
Clock { Clock {
id: clock id: clock
@@ -30,7 +27,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.preferredHeight: root.height / 10 Layout.preferredHeight: root.height / 10
Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0 Layout.leftMargin: p != "0" ? a == "left" ? -p : a == "right" ? p : 0 : 0
Layout.topMargin: virtualKeyboardActive ? -height * 1.5 : 0 Layout.topMargin: 0
} }
SystemButtons { SystemButtons {
+28 -11
View File
@@ -81,25 +81,35 @@ Pane {
LoginForm { LoginForm {
id: form id: form
height: virtualKeyboard.state == "visible" ? parent.height - virtualKeyboard.implicitHeight : parent.height height: parent.height
width: parent.width / 2.5 width: parent.width / 2.5
anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined anchors.horizontalCenter: config.FormPosition == "center" ? parent.horizontalCenter : undefined
anchors.left: config.FormPosition == "left" ? parent.left : undefined anchors.left: config.FormPosition == "left" ? parent.left : undefined
anchors.right: config.FormPosition == "right" ? parent.right : undefined anchors.right: config.FormPosition == "right" ? parent.right : undefined
virtualKeyboardActive: virtualKeyboard.state == "visible" ? true : false
z: 1 z: 1
} }
Button { Button {
id: vkb id: vkb
checkable: true
onClicked: virtualKeyboard.switchState() onClicked: virtualKeyboard.switchState()
Keys.onReturnPressed: {
toggle();
virtualKeyboard.switchState();
}
Keys.onEnterPressed: {
toggle();
virtualKeyboard.switchState();
}
visible: virtualKeyboard.status == Loader.Ready && config.ForceHideVirtualKeyboardButton == "false" visible: virtualKeyboard.status == Loader.Ready && config.ForceHideVirtualKeyboardButton == "false"
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: implicitHeight anchors.bottomMargin: implicitHeight
anchors.horizontalCenter: form.horizontalCenter anchors.horizontalCenter: form.horizontalCenter
z: 1 z: 1
contentItem: Text { contentItem: Text {
text: config.TranslateVirtualKeyboardButton || "Virtual Keyboard" id: buttonVirtualKeyboard
text: config.TranslateVirtualKeyboardButtonOff || "Virtual Keyboard (off)"
color: parent.visualFocus ? palette.highlight : palette.text color: parent.visualFocus ? palette.highlight : palette.text
font.pointSize: root.font.pointSize * 0.8 font.pointSize: root.font.pointSize * 0.8
} }
@@ -107,6 +117,16 @@ Pane {
id: vkbbg id: vkbbg
color: "transparent" color: "transparent"
} }
states: [
State {
name: "checked"
when: vkb.checked
PropertyChanges {
target: buttonVirtualKeyboard
text: config.TranslateVirtualKeyboardButtonOn || "Virtual Keyboard (on)"
}
}
]
} }
Loader { Loader {
@@ -114,18 +134,14 @@ Pane {
source: "Components/VirtualKeyboard.qml" source: "Components/VirtualKeyboard.qml"
state: "hidden" state: "hidden"
property bool keyboardActive: item ? item.active : false property bool keyboardActive: item ? item.active : false
onKeyboardActiveChanged: keyboardActive ? state = "visible" : state = "hidden" // x * 0.4 = x / 2.5
width: parent.width width: config.KeyboardSize == "" ? parent.width * 0.4 : parent.width * config.KeyboardSize
anchors.horizontalCenter: parent.horizontalCenter
z: 1 z: 1
function switchState() { state = state == "hidden" ? "visible" : "hidden" } function switchState() { state = state == "hidden" ? "visible" : "hidden"}
states: [ states: [
State { State {
name: "visible" name: "visible"
PropertyChanges {
target: form
systemButtonVisibility: false
clockVisibility: false
}
PropertyChanges { PropertyChanges {
target: virtualKeyboard target: virtualKeyboard
y: root.height - virtualKeyboard.height y: root.height - virtualKeyboard.height
@@ -186,6 +202,7 @@ Pane {
} }
ScriptAction { ScriptAction {
script: { script: {
virtualKeyboard.item.activated = false;
Qt.inputMethod.hide(); Qt.inputMethod.hide();
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 791 KiB

+28 -1
View File
@@ -17,8 +17,17 @@ Here are some examples:
### Dependencies ### Dependencies
#### Arch, Void
```sh ```sh
qt6-declarative qt6-svg sddm sddm qt6-svg
```
#### Fedora
```sh
sddm qt6-qtsvg
```
#### OpenSUSE
```sh
sddm-qt6 qt6-svg
``` ```
### Install ### Install
@@ -37,6 +46,24 @@ qt6-declarative qt6-svg sddm
Current=sddm-astronaut-theme" | sudo tee /etc/sddm.conf Current=sddm-astronaut-theme" | sudo tee /etc/sddm.conf
``` ```
### Virtual keyboard
![Preview](./Previews/preview5.png)
#### Arch
1. Install package.
```sh
sddm qt6-virtualkeyboard
```
2. Then edit `/etc/sddm.conf.d/virtualkbd.conf`, so that it looks like this:
```sh
[General]
InputMethod=qtvirtualkeyboard
```
### Credits ### Credits
Based on the theme [`Sugar Dark for SDDM`](https://github.com/MarianArlt/sddm-sugar-dark) by **MarianArlt**. Based on the theme [`Sugar Dark for SDDM`](https://github.com/MarianArlt/sddm-sugar-dark) by **MarianArlt**.
+4 -1
View File
@@ -78,6 +78,8 @@ FontSize=""
HideLoginButton="true" HideLoginButton="true"
## Hides login button if set to true. ## Hides login button if set to true.
KeyboardSize=""
## Default 0.4.
## [Interface Behavior] ## [Interface Behavior]
@@ -136,5 +138,6 @@ TranslateSuspend=""
TranslateHibernate="" TranslateHibernate=""
TranslateReboot="" TranslateReboot=""
TranslateShutdown="" TranslateShutdown=""
TranslateVirtualKeyboardButton="" TranslateVirtualKeyboardButtonOn=""
TranslateVirtualKeyboardButtonOff=""
## These don't necessarily need to translate anything. You can enter whatever you want here. ## These don't necessarily need to translate anything. You can enter whatever you want here.