2023-03-10 09:39:05 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-06-27 10:51:12 +00:00
|
|
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
2024-10-15 19:26:12 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-06-27 10:51:12 +00:00
|
|
|
|
2023-03-10 09:39:05 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: 20
|
2023-03-10 09:39:05 +00:00
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
StatusItemSelector {
|
|
|
|
id: selector
|
2023-03-10 09:39:05 +00:00
|
|
|
|
2024-10-15 19:26:12 +00:00
|
|
|
icon: Theme.png("tokens/SNT")
|
2022-06-27 10:51:12 +00:00
|
|
|
title: "Item Selector Title"
|
2022-09-08 09:06:25 +00:00
|
|
|
|
2023-03-13 10:02:41 +00:00
|
|
|
placeholderText: "Example: Empty items"
|
|
|
|
|
|
|
|
model: ListModel {
|
2022-09-08 09:06:25 +00:00
|
|
|
id: model
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusDropdown {
|
2022-06-27 10:51:12 +00:00
|
|
|
id: dropdown
|
2022-09-08 09:06:25 +00:00
|
|
|
|
|
|
|
parent: selector.addButton
|
2022-06-27 10:51:12 +00:00
|
|
|
width: 200
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
spacing: 10
|
2023-03-10 09:39:05 +00:00
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
StatusInput {
|
|
|
|
id: input
|
2022-09-08 09:06:25 +00:00
|
|
|
text: "Sample"
|
2022-06-27 10:51:12 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2023-03-10 09:39:05 +00:00
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
StatusButton {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2023-03-10 09:39:05 +00:00
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
text: "Add element"
|
|
|
|
onClicked: {
|
2022-09-08 09:06:25 +00:00
|
|
|
model.append({
|
|
|
|
text: input.text,
|
2024-10-15 19:26:12 +00:00
|
|
|
imageSource: Theme.png("tokens/SNT"),
|
2023-03-27 11:51:58 +00:00
|
|
|
isIcon: false,
|
2023-03-10 09:39:05 +00:00
|
|
|
operator: model.count > 0 ? OperatorsUtils.Operators.Or
|
|
|
|
: OperatorsUtils.Operators.None
|
2022-09-08 09:06:25 +00:00
|
|
|
})
|
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
dropdown.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-08 09:06:25 +00:00
|
|
|
|
|
|
|
addButton.onClicked: {
|
|
|
|
dropdown.x = mouse.x
|
|
|
|
dropdown.y = mouse.y
|
|
|
|
dropdown.open()
|
|
|
|
}
|
2022-06-27 10:51:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2023-03-10 09:39:05 +00:00
|
|
|
|
2022-06-27 10:51:12 +00:00
|
|
|
text: "Clear list"
|
2023-03-13 10:02:41 +00:00
|
|
|
onClicked: model.clear()
|
2022-06-27 10:51:12 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Components
|