-
Notifications
You must be signed in to change notification settings - Fork 48
feat(lockscreen): add keyboard focus navigation for power buttons #1139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master-backup-20260717
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,10 @@ FocusScope { | |
| id: root | ||
|
|
||
| signal switchUser() | ||
| Component.onCompleted: { | ||
| lockBtn.forceActiveFocus() | ||
| } | ||
|
Comment on lines
+12
to
+14
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 锁屏状态打开关机界面时,只会创建PowerList,不会创建ShutdownView(ShutdownView包含一个PowerList和三个单独的按钮),不会被抢焦点,见ControlAction.qml中修改部分 |
||
|
|
||
|
|
||
| MouseArea { | ||
| anchors.fill: parent | ||
|
|
@@ -17,6 +21,10 @@ FocusScope { | |
| } | ||
|
|
||
| PowerList { | ||
| id:powerList | ||
| onTabOutForward: lockBtn.forceActiveFocus() | ||
| onTabOutBackward: logoutBtn.forceActiveFocus() | ||
|
Comment on lines
+24
to
+26
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 跟上面哪个一样,已锁定状态下不会加载ShutdownView这个界面,不会出现焦点推送到不可见对象的情况。 |
||
|
|
||
| width: parent.width | ||
| height: 140 | ||
| anchors { | ||
|
|
@@ -27,23 +35,32 @@ FocusScope { | |
|
|
||
| modelChildren: [ | ||
| ShutdownButton { | ||
| id:lockBtn | ||
| visible: !GreeterProxy.isLocked | ||
| text: qsTr("lock") | ||
| icon.name: "login_lock" | ||
| onClicked: GreeterProxy.lock() | ||
| KeyNavigation.tab: switchBtn | ||
| KeyNavigation.backtab: powerList.listHibernateBtn | ||
| }, | ||
| ShutdownButton { | ||
| id:switchBtn | ||
| visible: !GreeterProxy.isLocked | ||
| text: qsTr("switch user") | ||
| icon.name: "login_switchuser" | ||
| enabled: UserModel.count > 1 | ||
| onClicked: root.switchUser() | ||
| KeyNavigation.tab: logoutBtn | ||
| KeyNavigation.backtab: lockBtn | ||
| }, | ||
| ShutdownButton { | ||
| id:logoutBtn | ||
| visible: !GreeterProxy.isLocked | ||
| text: qsTr("Logout") | ||
| icon.name: "login_logout" | ||
| onClicked: GreeterProxy.logout() | ||
| KeyNavigation.tab: powerList.listPowerOffBtn | ||
| KeyNavigation.backtab: switchBtn | ||
| } | ||
| ] | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.