Import keyboard navigation
* Aggressively set focus to message input box and fix #37 * Improve room switching #66
This commit is contained in:
@@ -34,6 +34,10 @@ ToolBar {
|
|||||||
|
|
||||||
position: ToolBar.Footer
|
position: ToolBar.Footer
|
||||||
|
|
||||||
|
function addText(text) {
|
||||||
|
inputField.insert(inputField.length, text)
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
id: layout
|
id: layout
|
||||||
spacing: 0
|
spacing: 0
|
||||||
@@ -235,6 +239,7 @@ ToolBar {
|
|||||||
room: currentRoom ?? null
|
room: currentRoom ?? null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
|
||||||
@@ -296,13 +301,34 @@ ToolBar {
|
|||||||
|
|
||||||
Keys.onEscapePressed: closeAll()
|
Keys.onEscapePressed: closeAll()
|
||||||
|
|
||||||
|
Keys.onPressed: {
|
||||||
|
if (event.key === Qt.Key_PageDown) {
|
||||||
|
switchRoomDown();
|
||||||
|
} else if (event.key === Qt.Key_PageUp) {
|
||||||
|
switchRoomUp();
|
||||||
|
} else if (!(event.modifiers & Qt.ControlModifier)) {
|
||||||
|
event.accepted = true;
|
||||||
|
chatTextInput.addText(event.text);
|
||||||
|
chatTextInput.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Keys.onBacktabPressed: {
|
Keys.onBacktabPressed: {
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
switchRoomUp();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (isAutoCompleting) {
|
if (isAutoCompleting) {
|
||||||
autoCompleteListView.decrementCurrentIndex();
|
autoCompleteListView.decrementCurrentIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onTabPressed: {
|
Keys.onTabPressed: {
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
switchRoomDown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!isAutoCompleting) {
|
if (!isAutoCompleting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ Kirigami.ScrollablePage {
|
|||||||
switchRoomDown();
|
switchRoomDown();
|
||||||
} else if (event.key === Qt.Key_PageUp) {
|
} else if (event.key === Qt.Key_PageUp) {
|
||||||
switchRoomUp();
|
switchRoomUp();
|
||||||
|
} else if (!(event.modifiers & Qt.ControlModifier)) {
|
||||||
|
event.accepted = true;
|
||||||
|
chatTextInput.addText(event.text);
|
||||||
|
chatTextInput.focus();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user