Start keyboard navigation

Now a room can be opened with the keyboard only and be scrolled.
This commit is contained in:
Carl Schwan
2020-11-16 10:38:45 +01:00
parent 76728cb3f9
commit 6abe7cab57
2 changed files with 14 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ Kirigami.ScrollablePage {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
onTextChanged: sortFilterRoomListModel.filterText = text onTextChanged: sortFilterRoomListModel.filterText = text
KeyNavigation.tab: listView
} }
ListView { ListView {
@@ -79,9 +80,19 @@ Kirigami.ScrollablePage {
} }
delegate: Kirigami.AbstractListItem { delegate: Kirigami.AbstractListItem {
id: roomListItem
visible: model.categoryVisible visible: model.categoryVisible
topPadding: Kirigami.Units.largeSpacing topPadding: Kirigami.Units.largeSpacing
bottomPadding: Kirigami.Units.largeSpacing bottomPadding: Kirigami.Units.largeSpacing
focus: true
action: Kirigami.Action {
id: enterRoomAction
onTriggered: {
var roomItem = roomManager.enterRoom(currentRoom)
roomListItem.KeyNavigation.right = roomItem
roomItem.focus = true;
}
}
contentItem: Item { contentItem: Item {
implicitHeight: roomLayout.implicitHeight implicitHeight: roomLayout.implicitHeight
@@ -127,6 +138,7 @@ Kirigami.ScrollablePage {
} }
} }
} }
MouseArea { MouseArea {
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent anchors.fill: parent

View File

@@ -39,8 +39,9 @@ Kirigami.ApplicationWindow {
currentRoom = null; currentRoom = null;
pageStack.removePage(pageStack.lastItem); pageStack.removePage(pageStack.lastItem);
} }
pageStack.push(roomPage, { 'currentRoom': room, }); var item = pageStack.push(roomPage, { 'currentRoom': room, });
currentRoom = room; currentRoom = room;
return item;
} }
} }