DetailsView.qml 2.06 KB
Newer Older
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
1
/*
2
 * SPDX-FileCopyrightText: 2018 Friedrich W. H. Kossebau <kossebau@kde.org>
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
3
 *
4
 * SPDX-License-Identifier: GPL-2.0-or-later
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
5 6
 */

7 8 9
import QtQuick 2.9

import QtQuick.Layouts 1.3
10

11
import org.kde.plasma.core 2.0 as PlasmaCore
12
import org.kde.plasma.components 3.0 as PlasmaComponents
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
13

14
ColumnLayout {
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
15 16
    id: root

17
    property var model
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
18

19
    GridLayout {
20 21
        Layout.alignment: Qt.AlignTop | Qt.AlignHCenter

22
        rowSpacing: PlasmaCore.Units.smallSpacing
23 24

        Repeater {
25 26 27
            id: labelRepeater

            model: root.model
28 29

            delegate: Loader {
30 31
                readonly property int rowIndex: index
                readonly property var rowData: modelData
32 33 34 35 36 37

                Layout.minimumWidth: item.Layout.minimumWidth
                Layout.minimumHeight: item.Layout.minimumHeight
                Layout.alignment: item.Layout.alignment
                Layout.preferredWidth: item.Layout.preferredWidth
                Layout.preferredHeight: item.Layout.preferredHeight
38 39 40 41 42 43 44 45 46 47 48 49 50
                Layout.row: rowIndex
                Layout.column: 0

                sourceComponent: PlasmaComponents.Label {
                    Layout.alignment: Qt.AlignVCenter | Qt.AlignRight

                    text: rowData.label
                }
            }
        }

        Repeater {
            id: repeater
51

52
            model: root.model
53

54 55 56 57 58 59 60 61 62 63 64
            delegate: Loader {
                readonly property int rowIndex: index
                readonly property var rowData: modelData

                Layout.minimumWidth: item.Layout.minimumWidth
                Layout.minimumHeight: item.Layout.minimumHeight
                Layout.alignment: item.Layout.alignment
                Layout.preferredWidth: item.Layout.preferredWidth
                Layout.preferredHeight: item.Layout.preferredHeight
                Layout.row: rowIndex
                Layout.column: 1
65

66 67
                sourceComponent: PlasmaComponents.Label {
                    Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
68

69
                    text: rowData.text
70 71 72 73
                }
            }
        }
    }
Luís Gabriel Lima's avatar
Luís Gabriel Lima committed
74
}