From 889886a70bfbe6e1b186bd5fd659a3e34b1e0a94 Mon Sep 17 00:00:00 2001 From: Tarulia Date: Wed, 18 Sep 2019 23:09:10 +0200 Subject: [PATCH] added (configurable) auto-focus of input fields; see also 3ximus/aerial-sddm-theme#13 --- Main.qml | 20 ++++++++++++++++++-- theme.conf | 1 + theme.conf.user | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Main.qml b/Main.qml index 4f73cfa..a33f0a2 100644 --- a/Main.qml +++ b/Main.qml @@ -67,7 +67,15 @@ Rectangle { id: mouseArea1 anchors.fill: parent; //onPressed: {playlist1.shuffle(); playlist1.next();} - onPressed: { fader1.state = fader1.state == "off" ? "on" : "off" ; } + onPressed: { + fader1.state = fader1.state == "off" ? "on" : "off" ; + if (config.autofocusInput == "true") { + if (username_input_box.text == "") + username_input_box.focus = true + else + password_input_box.focus = true + } + } } Keys.onPressed: { fader1.state = "on"; @@ -106,7 +114,15 @@ Rectangle { id: mouseArea2 enabled: false anchors.fill: parent; - onPressed: { fader2.state = fader2.state == "off" ? "on" : "off" ; } + onPressed: { + fader1.state = fader1.state == "off" ? "on" : "off" ; + if (config.autofocusInput == "true") { + if (username_input_box.text == "") + username_input_box.focus = true + else + password_input_box.focus = true + } + } } Behavior on opacity { enabled: true diff --git a/theme.conf b/theme.conf index fcf35b0..e0c74d0 100644 --- a/theme.conf +++ b/theme.conf @@ -9,3 +9,4 @@ usernameLeftMargin=15 relativePositionX=0.3 relativePositionY=0.7 showTopBar=true +autofocusInput=true diff --git a/theme.conf.user b/theme.conf.user index 3bf7c1f..30a50f5 100644 --- a/theme.conf.user +++ b/theme.conf.user @@ -9,3 +9,4 @@ showLoginButton=false type=color usernameLeftMargin=15 showTopBar=true +autofocusInput=true