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.

60 lines
965 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
10 years ago
property bool readOnly: !boolCombo.enabled
10 years ago
height: 20
width: 150
10 years ago
10 years ago
onReadOnlyChanged: {
boolCombo.enabled = !readOnly;
}
function init()
{
value = value === true ? "1" : value
value = value === false ? "0" : value;
value = value === "true" ? "1" : value
value = value === "false" ? "0" : value;
var setValue = "1"
10 years ago
if (value === "")
setValue = parseInt(defaultValue);
10 years ago
else
setValue = parseInt(value);
boolCombo.checked = setValue === "1" ? true: false
10 years ago
boolCombo.enabled = !readOnly;
}
Rectangle {
color: "transparent"
anchors.fill: parent
CheckBox
{
10 years ago
property bool inited;
Component.onCompleted:
{
10 years ago
init();
inited = true;
}
id: boolCombo
anchors.fill: parent
onCheckedChanged:
{
10 years ago
if (inited)
value = checked ? "1" : "0"
}
text: qsTr("True")
}
}
}