95 lines
2.5 KiB
QML
95 lines
2.5 KiB
QML
// SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
import magpie
|
|
import magpie.Components as Components
|
|
|
|
Item {
|
|
ColumnLayout {
|
|
id: column
|
|
anchors.fill: parent
|
|
|
|
Label {
|
|
id: label
|
|
text: "Currencies"
|
|
Layout.alignment: Qt.AlignHCenter
|
|
font {
|
|
pixelSize: 24
|
|
bold: true
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
spacing: 5
|
|
Label {
|
|
text: "Main currency:"
|
|
Layout.alignment: Qt.AlignVCenter
|
|
}
|
|
|
|
ComboBox {
|
|
property int currency: 1
|
|
id: currencyField
|
|
|
|
textRole: "code"
|
|
valueRole: "id"
|
|
|
|
model: Magpie.currencies
|
|
|
|
Component.onCompleted: currentIndex = indexOfValue(currency)
|
|
onActivated: index => currency = currentValue
|
|
}
|
|
}
|
|
|
|
ListView {
|
|
id: listView
|
|
Layout.fillHeight: true
|
|
Layout.fillWidth: true
|
|
model: Magpie.currencies
|
|
spacing: 5
|
|
delegate: Item {
|
|
required property string title
|
|
required property string code
|
|
required property double value
|
|
|
|
id: line
|
|
|
|
height: 40
|
|
width: listView.width
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
|
|
Label {
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
text: code
|
|
verticalAlignment: Text.AlignVCenter
|
|
horizontalAlignment: Text.AlignHCenter
|
|
font.bold: true
|
|
}
|
|
|
|
Label {
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
text: value
|
|
verticalAlignment: Text.AlignVCenter
|
|
font.bold: true
|
|
font.underline: true
|
|
}
|
|
|
|
Label {
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
text: title
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|