From e234861ee6f8ccfa173186b3bd8c663b2d317300 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Sat, 1 May 2021 13:31:09 +0300 Subject: [PATCH] feat: add command completion UI component --- .../Component/ChatBox/CompletionMenu.qml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/imports/NeoChat/Component/ChatBox/CompletionMenu.qml b/imports/NeoChat/Component/ChatBox/CompletionMenu.qml index 39367d363..d9280dbd9 100644 --- a/imports/NeoChat/Component/ChatBox/CompletionMenu.qml +++ b/imports/NeoChat/Component/ChatBox/CompletionMenu.qml @@ -109,4 +109,29 @@ Popup { onClicked: completeTriggered(); } } + + Component { + id: commandDelegate + Kirigami.BasicListItem { + id: commandItem + width: ListView.view.width ?? implicitWidth + property string displayName: modelData.command + text: modelData.help + + leading: Label { + id: commandLabel + Layout.preferredHeight: Kirigami.Units.gridUnit + Layout.preferredWidth: textMetrics.tightBoundingRect.width + text: modelData.command + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + TextMetrics { + id: textMetrics + text: modelData.command + font: commandLabel.font + } + onClicked: completeTriggered(); + } + } }