SafeAreaEditor.qml 1.24 KB
Newer Older
1
import QtQuick 2.3
2
import QtQuick.Controls 1.2
3
import QtQuick.Layouts 1.2
4

5 6 7 8
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
9

10
GridLayout {
11
    id: editorColumn
12 13 14
    columns: 2
    columnSpacing: _margin
    rowSpacing: _margin
15
    width: availableWidth
16

17 18 19 20 21 22
    property var geoArea: undefined
    property int availableWidth

    property real _margin: ScreenTools.defaultFontPixelWidth / 2

    Component.onCompleted: {
23 24
        console.assert(geoArea !== undefined,
                       "please set the areaItem property")
25 26 27
    }

    SectionHeader {
28 29
        id: statsHeader
        text: qsTr("Statistics")
30 31 32 33 34 35 36 37
        Layout.fillWidth: true
        Layout.columnSpan: 2
    }

    GridLayout {
        columns: 2
        columnSpacing: _margin
        rowSpacing: _margin
38
        visible: statsHeader.checked
39 40 41
        Layout.fillWidth: true
        Layout.columnSpan: 2

42 43 44 45 46 47 48 49
        QGCLabel {
            text: qsTr("Area")
        }
        QGCLabel {
            text: QGroundControl.unitsConversion.squareMetersToAppSettingsAreaUnits(
                      geoArea.area).toFixed(
                      2) + " " + QGroundControl.unitsConversion.appSettingsAreaUnitsString
        }
50 51
    }
}