2023-03-28 11:07:39 +00:00
import QtQuick 2.15
import QtQuick . Controls 2.15
import QtQuick . Layouts 1.15
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Components 0.1
import utils 1.0
StatusFlowSelector {
id: root
property alias model: repeater . model
2023-04-25 21:24:04 +00:00
readonly property alias count: repeater . count
2023-03-28 11:07:39 +00:00
2023-04-25 21:24:04 +00:00
signal itemClicked ( int index , var mouse , var item )
2023-03-28 11:07:39 +00:00
placeholderText: qsTr ( "Example: 1 SOCK" )
placeholderItem.visible: repeater . count === 0
title: qsTr ( "What" )
icon: Style . svg ( "token" )
QtObject {
id: d
readonly property int commonMargin: 6
readonly property int iconSize: 28
}
Repeater {
id: repeater
Control {
2023-04-25 21:24:04 +00:00
id: delegateRoot
2023-03-28 11:07:39 +00:00
component Icon: StatusRoundedImage {
implicitWidth: d . iconSize
implicitHeight: d . iconSize
2023-04-25 21:24:04 +00:00
image.mipmap: true
2023-03-28 11:07:39 +00:00
}
component Text: StatusBaseText {
Layout.fillWidth: true
2023-04-27 22:13:59 +00:00
font.weight: Font . Medium
color: model . valid ? Theme . palette . primaryColor1
: Theme . palette . dangerColor1
2023-03-28 11:07:39 +00:00
elide: Text . ElideRight
}
implicitHeight: root . placeholderItemHeight
leftPadding: ( root . placeholderItemHeight - d . iconSize ) / 2
rightPadding: d . commonMargin * 2
background: Rectangle {
2023-04-27 22:13:59 +00:00
color: model . valid ? Theme . palette . primaryColor3
: Theme . palette . dangerColor3
2023-03-28 11:07:39 +00:00
radius: root . placeholderItemHeight / 2
MouseArea {
anchors.fill: parent
cursorShape: Qt . PointingHandCursor
2023-04-25 21:24:04 +00:00
onClicked: root . itemClicked ( model . index , mouse , delegateRoot )
2023-03-28 11:07:39 +00:00
}
}
contentItem: RowLayout {
spacing: d . commonMargin
Icon {
image.source: model . tokenImage
}
Text {
text: qsTr ( "%1 on" , "It means that a given token is deployed 'on' a given network, e.g. '2 MCT on Ethereum'. The name of the network is preceded by an icon, so it is not part of this phrase." )
. arg ( model . tokenText )
}
Icon {
image.source: model . networkImage
}
Text {
text: model . networkText
}
}
}
}
}