You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
747 B

import QtQuick 2.0
import QtQuick.Controls 1.3
Item
{
id: editRoot
10 years ago
property string value
10 years ago
property string defaultValue
property alias readOnly: !boolCombo.enabled
10 years ago
height: 20
width: 150
10 years ago
Rectangle {
anchors.fill: parent
ComboBox
{
10 years ago
property bool inited: false
Component.onCompleted:
{
10 years ago
if (value === "")
10 years ago
currentIndex = parseInt(defaultValue);
else
10 years ago
currentIndex = parseInt(value);
10 years ago
inited = true
}
id: boolCombo
anchors.fill: parent
onCurrentIndexChanged:
{
10 years ago
if (inited)
10 years ago
value = comboModel.get(currentIndex).value;
}
model: ListModel
{
id: comboModel
ListElement { text: qsTr("False"); value: "0" }
ListElement { text: qsTr("True"); value: "1" }
}
}
}
}