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
|
|
|
|
|
|
|
import utils 1.0
|
2020-08-06 07:25:53 +00:00
|
|
|
|
2021-10-14 09:35:59 +00:00
|
|
|
import "../"
|
2021-10-14 13:09:35 +00:00
|
|
|
import "../panels"
|
2021-10-14 12:27:09 +00:00
|
|
|
import "."
|
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
|
|
|
|
|
|
|
|
Select {
|
|
|
|
id: select
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
model: root.sources
|
|
|
|
selectedItemView: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
StyledText {
|
|
|
|
id: selectedTextField
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Invalid source"
|
|
|
|
text: !!root.selectedSource ? root.selectedSource.text : qsTrId("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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
menu.width: dropdownWidth
|
|
|
|
menu.topPadding: 8
|
|
|
|
menu.bottomPadding: 8
|
|
|
|
menu.delegate: Component {
|
|
|
|
MenuItem {
|
|
|
|
id: menuItem
|
|
|
|
height: 40
|
|
|
|
width: parent.width
|
|
|
|
onTriggered: function () {
|
|
|
|
root.selectedSource = root.sources[index]
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: itemText
|
2020-10-28 07:44:09 +00:00
|
|
|
text: root.sources[index].text
|
2020-08-06 07:25:53 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
color: menuItem.highlighted ? Style.current.primaryMenuItemTextHover : Style.current.textColor
|
|
|
|
}
|
|
|
|
background: Rectangle {
|
|
|
|
color: menuItem.highlighted ? Style.current.primaryMenuItemHover : Style.current.transparent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|