QGCButtonColumn.qml 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2
import QtPositioning    5.3

import QGroundControl               1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0

ColumnLayout {
    id:         root
    spacing:    ScreenTools.defaultFontPixelWidth * 0.5

    property var    model // list of lists (nested list contains all entries of ENTRY_NAME)
    property string headLine
    property bool   hideOnClicked: true

    enum EntryName  {
       Text = 0,
       Visible = 1,
       Enabled = 2,
       OnClicked = 3
    }

    QGCLabel { text: headLine }

    Repeater{
        model: root.model
        QGCButton {
            text:               modelData[QGCButtonColumn.EntryName.Text]
            visible:            modelData[QGCButtonColumn.EntryName.Visible]
            enabled:            modelData[QGCButtonColumn.EntryName.Enabled]
            Layout.fillWidth:   true

            onClicked: {
                if (hideOnClicked){
                dropPanel.hide()
                }
                root.model[index][QGCButtonColumn.EntryName.OnClicked]()
            }
        }
    }

} // ColumnLayout