Warning, /rolisteam/rolisteam/src/libraries/charactersheet/qml/Rolisteam/CheckBoxField.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick
0002 import QtQuick.Controls
0003 import QtQuick.Controls.Styles
0004 import Rolisteam
0005 
0006 CheckBox {
0007     id:root
0008     text : ""
0009     property color borderColor: "black"
0010     property Field field: null
0011     property int hAlign: 0
0012     property int vAlign: 0
0013     property bool clippedText: false
0014     property bool readOnly: false
0015     property alias radius: indic.radius
0016     property alias color: indic.color
0017     property string tooltip: ""
0018     leftPadding: 0
0019     rightPadding: 0
0020     topPadding: 0
0021     spacing: 0
0022     bottomPadding:0
0023     checkState: (root.text === "0") ? Qt.Unchecked : (root.text === "1" && root.tristate) ? Qt.PartiallyChecked : Qt.Checked
0024     onCheckStateChanged: console.log("state:"+checkState)
0025     enabled: !root.readOnly
0026     checked: root.checkState === Qt.Checked  ? true :false
0027     onCheckedChanged: console.log("checked:"+checked)
0028     ToolTip.text: root.tooltip
0029     ToolTip.visible: root.tooltip.length >0 && checkbox.pressed
0030 
0031     indicator: Rectangle {
0032         id: indic
0033         border.color: root.borderColor
0034         border.width: 1
0035         width: root.width
0036         height: root.height
0037         Rectangle {
0038             id: filler
0039             anchors.fill: parent
0040             scale: 0.7
0041             radius: root.radius
0042             color: root.borderColor
0043             visible: root.checkState != Qt.Unchecked
0044             opacity: root.checkState == Qt.PartiallyChecked ? 0.5 : 1.0
0045         }
0046     }
0047 
0048     contentItem: Item {
0049     }
0050 
0051     onClicked: {
0052         console.log("toggled")
0053         if(root.tristate)
0054             field.value = checkState == Qt.Unchecked ? "0" : checkState == Qt.PartiallyChecked ? "1" : "2"
0055         else
0056             field.value = checked ? "1": "0"
0057     }
0058 }
0059