Refresh a widget
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Refresh a widget
I removed some layers by a script and they are still visible in the layer list. How can I refresh/update the widget manually?
Arch Linux, QCad 3.22.0 Prof.
Re: Refresh a widget
If you remove the layers using RDeleteObjectOperation, the layer list will be updated. See RemoveLayer for an example:
https://github.com/qcad/qcad/blob/maste ... veLayer.js
https://github.com/qcad/qcad/blob/maste ... veLayer.js
Re: Refresh a widget
I found out, that it works only when I set undoable to true. Is there any workaround?
This is my code:
This is my code:
Code: Select all
var op = new RDeleteObjectsOperation(false);
layers.forEach(function (name) {
var lay = doc.queryLayer(name);
op.deleteObject(lay);
});
di.applyOperation(op);
Arch Linux, QCad 3.22.0 Prof.
Re: Refresh a widget
Making operations not undoable (argument false) means transactions are not recorded. However, the layer list and other widgets are rely on transactions to update themselves. Not undoable operations should only be used for offscreen documents that don't offer any form of user interaction at all.