status-desktop/ui/shared/AddressSourceSelector.qml
Alexandra Betouni 4ee21ada05 feat(desktop) Added image function in Style
Introduced Style.svg() Style.png() Style.emoji() and
Style.icon() in Style.qml. Those should be used to
set the source in Images instead of using relative
paths. Usage:
Image {
   source: Style.svg("check)
   ....

Also moved all Singletons inside a new "utils"
folder and made it a QML module, to use
import utils 1.0 instead of relative paths

Closes #3678
2021-09-28 15:28:00 -04:00

70 lines
2.1 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import utils 1.0
Item {
id: root
property var sources: []
property var selectedSource: sources.length ? sources[0] : null
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
//% "Invalid source"
text: !!root.selectedSource ? root.selectedSource.text : qsTrId("invalid-source")
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
text: root.sources[index].text
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}
}
##^##*/