How can I add / remove / edit GUI elements from dialog from within my post processor.
Customising a dialog from a post processor
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
Customising a dialog from a post processor
From a QCAD/CAM user:
Re: Customising a dialog from a post processor
It's possible to adjust dialogs through a post processor. This does require some JavaScript programming knowledge as well as knowledge of the Qt Widgets API.
A post processor can adjust the CAM configuration dialog, the add / edit layer dialog, the tool dialog and the toolpath dialog.
Whenever QCAD/CAM shows one of these dialogs, it calls function "initDialog" of your post processor. Depending on the dialog name, you can detect which dialog type it is. You can use qDebug to output the dialog name and find out the names of the various dialogs. di is the RDocumentInterface and obj is the object the dialog is editing (tool, toolpath, layer).
For a reference of the Qt API, please refer to:
https://doc.qt.io/qt-5/reference-overview.html
A post processor can adjust the CAM configuration dialog, the add / edit layer dialog, the tool dialog and the toolpath dialog.
Whenever QCAD/CAM shows one of these dialogs, it calls function "initDialog" of your post processor. Depending on the dialog name, you can detect which dialog type it is. You can use qDebug to output the dialog name and find out the names of the various dialogs. di is the RDocumentInterface and obj is the object the dialog is editing (tool, toolpath, layer).
Code: Select all
MyPostProcessor.prototype.initDialog = function(dialog, di, obj) {
qDebug("initDialog:", dialog.objectName);
if (dialog.objectName==="LayerDialog") {
// initialize layer dialog
// retrieve layer line edit:
var leLayerName = dialog.findChild("LayerName");
// do something with the layer line edit...
}
if (dialog.objectName==="CamToolDialog") {
// initialize tool dialog
}
// ...
};
https://doc.qt.io/qt-5/reference-overview.html