FactComboBox.qml 627 Bytes
Newer Older
1 2
import QtQuick 2.3
import QtQuick.Controls 1.2
3
import QtQuick.Controls.Styles 1.4
Don Gagne's avatar
Don Gagne committed
4 5 6 7 8 9

import QGroundControl.FactSystem 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0

QGCComboBox {
10
    property Fact fact: Fact { }
11 12
    property bool indexModel: true  ///< true: model must be specifed, selected index is fact value, false: use enum meta data

13
    model: fact ? fact.enumStrings : null
14 15 16 17 18 19 20

    currentIndex: indexModel ? fact.value : fact.enumIndex

    onActivated: {
        if (indexModel) {
            fact.value = index
        } else {
Don Gagne's avatar
Don Gagne committed
21
            fact.value = fact.enumValues[index]
22 23
        }
    }
Don Gagne's avatar
Don Gagne committed
24
}