SimpleItemEditor.qml 4.44 KB
Newer Older
1 2
import QtQuick                  2.7
import QtQuick.Controls         2.1
3
import QtQuick.Controls.Styles  1.4
4
import QtQuick.Dialogs          1.2
5
import QtQuick.Layouts          1.3
6 7 8 9 10 11 12 13 14 15 16

import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.Controls      1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0

// Editor for Simple mission items
Rectangle {
    id:                 valuesRect
    width:              availableWidth
17
    height:             deferedload.status == Loader.Ready ? (visible ? deferedload.item.height : 0) : 0
18 19 20 21
    color:              qgcPal.windowShadeDark
    visible:            missionItem.isCurrentItem
    radius:             _radius

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
    Loader {
        id:              deferedload
        active:          valuesRect.visible
        asynchronous:    true
        anchors.margins: _margin
        anchors.left:    valuesRect.left
        anchors.right:   valuesRect.right
        anchors.top:     valuesRect.top
        sourceComponent: Component {
            Item {
                id:                 valuesItem
                height:             valuesColumn.height + (_margin * 2)

                Column {
                    id:             valuesColumn
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    anchors.top:    parent.top
                    spacing:        _margin
41 42

                    QGCLabel {
43 44 45
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
46 47 48
                        text:           missionItem.rawEdit ?
                                            qsTr("Provides advanced access to all commands/parameters. Be very careful!") :
                                            missionItem.commandDescription
49 50
                    }

51 52 53 54
                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columns:        2
55

56 57
                        Repeater {
                            model: missionItem.comboboxFacts
58 59

                            QGCLabel {
60 61 62 63
                                text:           object.name
                                visible:        object.name != ""
                                Layout.column:  0
                                Layout.row:     index
64
                            }
65 66 67 68
                        }

                        Repeater {
                            model: missionItem.comboboxFacts
69 70

                            FactComboBox {
71 72 73 74 75 76
                                indexModel:         false
                                model:              object.enumStrings
                                fact:               object
                                Layout.column:      1
                                Layout.row:         index
                                Layout.fillWidth:   true
77 78
                            }
                        }
79 80
                    }

81 82 83 84
                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columns:        2
85

86 87
                        Repeater {
                            model: missionItem.textFieldFacts
88 89

                            QGCLabel {
90 91 92
                                text:           object.name
                                Layout.column:  0
                                Layout.row:     index
93
                            }
94
                        }
95

96 97
                        Repeater {
                            model: missionItem.textFieldFacts
98

99 100
                            FactTextField {
                                showUnits:          true
101
                                fact:               object
102 103 104
                                Layout.column:      1
                                Layout.row:         index
                                Layout.fillWidth:   true
105 106
                            }
                        }
107 108
                    }

109 110 111 112 113 114 115
                    Repeater {
                        model: missionItem.checkboxFacts

                        FactCheckBox {
                            text:   object.name
                            fact:   object
                        }
116
                    }
117 118 119 120
                } // Column
            } // Item
        } // Component
    } // Loader
121
} // Rectangle