Changeset View
Changeset View
Standalone View
Standalone View
src/controls/Action.qml
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 28 | QtObject { | |||
---|---|---|---|---|---|
135 | * text: "Action1" | 135 | * text: "Action1" | ||
136 | * } | 136 | * } | ||
137 | * Action { | 137 | * Action { | ||
138 | * text: "Action2" | 138 | * text: "Action2" | ||
139 | * } | 139 | * } | ||
140 | * } | 140 | * } | ||
141 | * @endcode | 141 | * @endcode | ||
142 | */ | 142 | */ | ||
143 | | ||||
144 | /** | ||||
145 | * separator: bool | ||||
146 | * Whether the action is is a separator action; defaults to false. | ||||
147 | */ | ||||
148 | property bool separator: false | ||||
149 | | ||||
143 | default property alias children: root.__children | 150 | default property alias children: root.__children | ||
144 | property list<QtObject> __children | 151 | property list<QtObject> __children | ||
145 | property Shortcut __shortcut: Shortcut { | 152 | property Shortcut __shortcut: Shortcut { | ||
146 | property bool checked: false | 153 | property bool checked: false | ||
147 | id: shortcutItem | 154 | id: shortcutItem | ||
148 | enabled: root.enabled | 155 | enabled: root.enabled | ||
149 | onActivated: root.trigger(); | 156 | onActivated: root.trigger(); | ||
150 | } | 157 | } | ||
151 | function trigger(source) { | 158 | function trigger(source) { | ||
152 | if (!enabled) { | 159 | if (!enabled) { | ||
153 | return; | 160 | return; | ||
154 | } | 161 | } | ||
155 | root.triggered(source); | 162 | root.triggered(source); | ||
156 | if (root.checkable) { | 163 | if (root.checkable) { | ||
157 | root.checked = !root.checked; | 164 | root.checked = !root.checked; | ||
158 | root.toggled(root.checked); | 165 | root.toggled(root.checked); | ||
159 | } | 166 | } | ||
160 | } | 167 | } | ||
161 | 168 | | |||
162 | onCheckedChanged: root.toggled(root.checked); | 169 | onCheckedChanged: root.toggled(root.checked); | ||
163 | } | 170 | } | ||
broulik: That function is superfluous, you have the property after all |
That function is superfluous, you have the property after all