Changeset View
Changeset View
Standalone View
Standalone View
plasmoid/package/contents/ui/PrinterItem.qml
Show All 24 Lines | 232 | MouseArea { | |||
---|---|---|---|---|---|
251 | } | 251 | } | ||
252 | } | 252 | } | ||
253 | } | 253 | } | ||
254 | } | 254 | } | ||
255 | } | 255 | } | ||
256 | } | 256 | } | ||
257 | 257 | | |||
258 | Component.onCompleted: { | 258 | Component.onCompleted: { | ||
259 | isPaused = printerState === 5 | 259 | isPaused = Qt.binding(function() { | ||
broulik: Can you see if assigning a binding here works instead?
```
isPaused = Qt.binding(function() {… | |||||
260 | return printerState === 5; | ||||
261 | }); | ||||
260 | } | 262 | } | ||
261 | 263 | | |||
262 | states: [ | 264 | states: [ | ||
263 | State { | 265 | State { | ||
264 | name: "NORMAL" | 266 | name: "NORMAL" | ||
265 | when: !isPaused | 267 | when: !isPaused | ||
266 | }, | 268 | }, | ||
267 | 269 | | |||
Show All 24 Lines | |||||
292 | function toggleSelection() { | 294 | function toggleSelection() { | ||
293 | if (isPaused) { | 295 | if (isPaused) { | ||
294 | if (printerState === 5) { | 296 | if (printerState === 5) { | ||
295 | printersModel.resumePrinter(printerName) | 297 | printersModel.resumePrinter(printerName) | ||
296 | } | 298 | } | ||
297 | } else { | 299 | } else { | ||
298 | printersModel.pausePrinter(printerName) | 300 | printersModel.pausePrinter(printerName) | ||
299 | } | 301 | } | ||
300 | isPaused = !isPaused | | |||
301 | } | 302 | } | ||
302 | } | 303 | } | ||
Context not available. |
Can you see if assigning a binding here works instead?
Ideally, this was done entirely declaratively, i.e. assign the property
but I don't know the code enough to tell why it was done imperatively originally