blob: 87bfd52a8667859c9d3235bd9fb49c96d61c2a1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import QtQuick 2.9
import QtQuick.Controls 1.4
ToolButton
{
property string image
property int tool: 0
implicitHeight: parent.height - 2
implicitWidth: parent.height - 2
z: 20
Image
{
source: image
anchors { fill: parent; margins: 4 }
}
checkable: (tool !== 0)
checked: (window.tool === tool)
onClicked:
{
if ( tool )
{
window.tool = tool // clicking button seems to break binding
checked = Qt.binding(function() { return (window.tool === tool) })
}
}
}
|