Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/ActionButton.qml
Show All 24 Lines | |||||
25 | PlasmaCore.ToolTipArea { | 25 | PlasmaCore.ToolTipArea { | ||
26 | id: button | 26 | id: button | ||
27 | 27 | | |||
28 | location: PlasmaCore.Types.LeftEdge | 28 | location: PlasmaCore.Types.LeftEdge | ||
29 | mainText: action !== undefined ? action.text : "" | 29 | mainText: action !== undefined ? action.text : "" | ||
30 | mainItem: toolTipDelegate | 30 | mainItem: toolTipDelegate | ||
31 | 31 | | |||
32 | //API | 32 | //API | ||
33 | property QtObject svg | 33 | property PlasmaCore.Svg svg | ||
34 | property alias elementId: icon.elementId | 34 | property alias elementId: icon.elementId | ||
35 | property QtObject action | 35 | property QtObject action | ||
36 | property bool backgroundVisible: false | 36 | property bool backgroundVisible: false | ||
37 | property int iconSize: 32 | 37 | property int iconSize: 32 | ||
38 | property int pressedOffset: 1 | 38 | property int pressedOffset: 1 | ||
39 | property bool checked: false | 39 | property bool checked: false | ||
40 | property bool toggle: false | 40 | property bool toggle: false | ||
41 | property string text | 41 | property string text | ||
42 | signal clicked | 42 | signal clicked | ||
43 | 43 | | |||
44 | width: buttonRow.width | 44 | implicitWidth: buttonRow.implicitWidth | ||
45 | height: buttonRow.height | 45 | implicitHeight: buttonRow.implicitHeight | ||
46 | 46 | | |||
47 | opacity: action==undefined||action.enabled?1:0.6 | 47 | opacity: action==undefined||action.enabled?1:0.6 | ||
48 | 48 | | |||
49 | Behavior on opacity { | 49 | Behavior on opacity { | ||
50 | NumberAnimation { | 50 | NumberAnimation { | ||
51 | duration: units.longDuration | 51 | duration: units.longDuration | ||
52 | easing.type: Easing.InOutQuad | 52 | easing.type: Easing.InOutQuad | ||
53 | } | 53 | } | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 128 | onReleased: { | |||
137 | button.y = button.y - button.pressedOffset; | 137 | button.y = button.y - button.pressedOffset; | ||
138 | } | 138 | } | ||
139 | onClicked: { | 139 | onClicked: { | ||
140 | if (action) { | 140 | if (action) { | ||
141 | action.trigger() | 141 | action.trigger() | ||
142 | } else { | 142 | } else { | ||
143 | button.clicked() | 143 | button.clicked() | ||
144 | } | 144 | } | ||
145 | appletContainer.editMode = false; | ||||
145 | } | 146 | } | ||
146 | } | 147 | } | ||
147 | } | 148 | } |