Give timerConstraints a default value of false. true will make the timer always disabled
[harmattan/cameraplus] / qml / Selector.qml
1 // -*- qml -*-
2 import QtQuick 1.1
3 import com.nokia.meego 1.1
4 import QtCamera 1.0
5
6 Button {
7         id: button
8         width: 64
9         height: 64
10
11         property alias widget: __widget.children
12         property bool timerConstraints: false
13
14         checkable: true
15
16         function close() {
17                 button.checked = false;
18         }
19
20         Timer {
21                 interval: 2000
22                 running: mouse.enabled && !button.timerConstraints
23                 repeat: false
24                 onTriggered: button.close();
25         }
26
27         MouseArea {
28                 id: mouse
29                 parent: button.parent
30                 anchors.fill: parent
31                 enabled: button.checked
32                 onClicked: button.close();
33
34                 Item {
35                         id: __widget
36                         y: button.y
37                         x: button.x + button.width + 20
38                         visible: button.checked
39                 }
40         }
41 }