LinearGeneratorEditor.qml 1.65 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
import QtQuick 2.0

import QtQuick.Layouts 1.11

import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools   1.0

GridLayout {

11 12
    property var generator: undefined // LinearGenerator
    property var availableWidth: 300
13 14
    property real   _margin: ScreenTools.defaultFontPixelWidth / 2

15
    width:      availableWidth
16 17 18 19
    columnSpacing:  _margin
    rowSpacing:     _margin
    columns:        2

20 21 22 23
    Component.onCompleted: {
        console.assert(generator !== undefined, "please set the generator property")
    }

24 25 26 27 28 29
    QGCLabel { text: qsTr("Distance") }
    FactTextField {
        fact:                   generator.distance
        Layout.fillWidth:       true
    }

30 31 32 33 34 35 36 37
    QGCLabel {
        text: qsTr("Alpha: ")
        Layout.fillWidth: true
    }
    FactTextField {
        fact:                   generator.alpha
        Layout.fillWidth:       true
    }
38 39 40 41 42 43 44 45 46
    QGCSlider {
        id:                     rSlider
        minimumValue:           0
        maximumValue:           180
        stepSize:               0.1
        tickmarksEnabled:       false
        Layout.fillWidth:       true
        Layout.columnSpan:      2
        Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5
47 48 49 50 51
        onValueChanged:         {
            generator.alpha.value = value
            value = Qt.binding(function(){return generator.alpha.value})
        }
        Component.onCompleted:  value = generator.alpha.value
52 53 54 55 56 57 58 59 60
        updateValueWhileDragging: true
    }

    QGCLabel { text: qsTr("Min. Length") }
    FactTextField {
        fact:                   generator.minLength
        Layout.fillWidth:       true
    }
}