Skip to content

Commit

Permalink
Focus on frame when selected by mouse
Browse files Browse the repository at this point in the history
When you click Users, Power, or Sessions, it now will select that frame

Fixes #10
  • Loading branch information
m-wynn committed Jul 20, 2019
1 parent 01dff10 commit 2edfe01
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ Rectangle {
onClicked: {
root.state = "stateSession"
sessionFrame.focus = true
sessionFrame.currentItem.forceActiveFocus()
}
onEnterPressed: sessionFrame.currentItem.forceActiveFocus()

Expand All @@ -311,6 +312,7 @@ Rectangle {
onClicked: {
root.state = "stateUser"
userFrame.focus = true
userFrame.currentItem.forceActiveFocus()
}
onEnterPressed: userFrame.currentItem.forceActiveFocus()
KeyNavigation.backtab: shutdownButton
Expand All @@ -336,6 +338,7 @@ Rectangle {
onClicked: {
root.state = "statePower"
powerFrame.focus = true
powerFrame.currentItem.forceActiveFocus()
}
onEnterPressed: powerFrame.shutdown.focus = true
KeyNavigation.backtab: loginFrame.button
Expand Down
1 change: 1 addition & 0 deletions PowerFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Item {
signal needSuspend()

property alias shutdown: shutdownButton
property alias currentItem: shutdownButton

Row {
spacing: 70
Expand Down
18 changes: 12 additions & 6 deletions UserFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,31 @@ Item {

UserAvatar {
id: iconButton
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: 100
height: 100
source: icon
onClicked: item.select()
anchors {
top: parent.top
topMargin: 10
horizontalCenter: parent.horizontalCenter
}
}

Text {
id: nameText
width: parent.width
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 10
horizontalAlignment: Text.AlignHCenter
text: name
font.family: config.font
font.pointSize: 15
color: "white"
wrapMode: Text.WordWrap
elide: Text.ElideRight
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
bottomMargin: 10
}
}

Keys.onLeftPressed: {
Expand Down

0 comments on commit 2edfe01

Please sign in to comment.