diff options
| author | Timotej Lazar <timotej.lazar@araneo.si> | 2021-06-14 19:09:53 +0200 |
|---|---|---|
| committer | Timotej Lazar <timotej.lazar@araneo.si> | 2021-06-14 19:13:14 +0200 |
| commit | 8d57bfb1aef3b71557bc408154ee028751fd688e (patch) | |
| tree | 22ee6eaa22a3cfc7dfd4f938be16a6e28d7eaf1f /Tags.qml | |
First commit
There was history before but now there is no more.
Diffstat (limited to 'Tags.qml')
| -rw-r--r-- | Tags.qml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Tags.qml b/Tags.qml new file mode 100644 index 0000000..7d3f0ce --- /dev/null +++ b/Tags.qml @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: Unlicense + +import QtQuick 2.12 +import QtQuick.Controls 2.13 +import QtQuick.Layouts 1.6 + +import 'util.js' as Util + +// Tag list. +Page { + id: control + + property alias model: tags.model + + signal clicked(string tag, var fields) + + Keys.enabled: enabled + Keys.onPressed: { + for (var i = 0; i < model.length; i++) { + const tag = model[i] + if (tag.key === event.text) { + clicked(tag.tag, tag.fields) + return + } + } + event.accepted = false + } + + RowLayout { + width: parent.width + + Flow { + spacing: 5 + Layout.fillWidth: true + + Repeater { + id: tags + delegate: Button { + text: Util.addShortcut(modelData.tag, modelData.key) + onClicked: control.clicked(modelData.tag, modelData.fields) + focusPolicy: Qt.NoFocus + implicitWidth: implicitContentWidth + 2*padding + } + } + } + } +} |
