diff --git a/storybook/src/Storybook/CheckBoxFlowSelector.qml b/storybook/src/Storybook/CheckBoxFlowSelector.qml new file mode 100644 index 0000000000..6710e27f0e --- /dev/null +++ b/storybook/src/Storybook/CheckBoxFlowSelector.qml @@ -0,0 +1,40 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.15 + +import StatusQ.Core.Utils 0.1 + +import utils 1.0 + +Flow { + id: root + + property alias model: repeater.model + + property var selection: [] + property bool initialSelection + + Repeater { + id: repeater + + function update() { + const selection = [] + + for (let i = 0; i < repeater.count; i++) { + const item = repeater.itemAt(i) + if (!!item && item.checked) + selection.push(item.text) + } + + root.selection = selection + } + + CheckBox { + text: modelData + checked: root.initialSelection + onToggled: repeater.update() + } + + onItemAdded: update() + } +} diff --git a/storybook/src/Storybook/qmldir b/storybook/src/Storybook/qmldir index 1721822b27..248a913f78 100644 --- a/storybook/src/Storybook/qmldir +++ b/storybook/src/Storybook/qmldir @@ -1,3 +1,4 @@ +CheckBoxFlowSelector 1.0 CheckBoxFlowSelector.qml CompilationErrorsBox 1.0 CompilationErrorsBox.qml FigmaImagesProxyModel 1.0 FigmaImagesProxyModel.qml FigmaLinksCache 1.0 FigmaLinksCache.qml