Page 1 of 1

Customising a dialog from a post processor

Posted: Wed Sep 25, 2019 10:33 am
by andrew
From a QCAD/CAM user:
How can I add / remove / edit GUI elements from dialog from within my post processor.

Re: Customising a dialog from a post processor

Posted: Wed Sep 25, 2019 10:37 am
by andrew
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).

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
    }
    // ...
};
For a reference of the Qt API, please refer to:
https://doc.qt.io/qt-5/reference-overview.html