2020-08-06 07:25:53 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-10-28 11:03:20 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2020-08-06 07:25:53 +00:00
|
|
|
|
2021-10-28 11:03:20 +00:00
|
|
|
import utils 1.0
|
2021-10-14 09:35:59 +00:00
|
|
|
|
2020-08-06 07:25:53 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
property var sources: []
|
2020-10-28 07:44:09 +00:00
|
|
|
property var selectedSource: sources.length ? sources[0] : null
|
2020-08-06 07:25:53 +00:00
|
|
|
property int dropdownWidth: 220
|
|
|
|
height: select.height
|
|
|
|
|
2021-10-28 11:03:20 +00:00
|
|
|
StatusSelect {
|
2020-08-06 07:25:53 +00:00
|
|
|
id: select
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
model: root.sources
|
2021-10-28 11:03:20 +00:00
|
|
|
selectedItemComponent: Item {
|
2020-08-06 07:25:53 +00:00
|
|
|
anchors.fill: parent
|
2021-10-28 11:03:20 +00:00
|
|
|
StatusBaseText {
|
2020-08-06 07:25:53 +00:00
|
|
|
id: selectedTextField
|
2022-04-04 11:26:30 +00:00
|
|
|
text: !!root.selectedSource ? root.selectedSource.text : qsTr("Invalid source")
|
2020-08-06 07:25:53 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 15
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
height: 24
|
2021-10-28 11:03:20 +00:00
|
|
|
color: Theme.palette.directColor1
|
2020-08-06 07:25:53 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-28 11:03:20 +00:00
|
|
|
selectMenu.delegate: StatusMenuItemDelegate {
|
|
|
|
statusPopupMenu: select
|
|
|
|
action: StatusMenuItem {
|
|
|
|
text: root.sources[index].text
|
2020-08-06 07:25:53 +00:00
|
|
|
onTriggered: function () {
|
|
|
|
root.selectedSource = root.sources[index]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|