Customising a dialog from a post processor

Discussions around the CAM Add-On of QCAD.

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.

Post Reply
User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Customising a dialog from a post processor

Post by andrew » Wed Sep 25, 2019 10:33 am

From a QCAD/CAM user:
How can I add / remove / edit GUI elements from dialog from within my post processor.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Customising a dialog from a post processor

Post by andrew » Wed Sep 25, 2019 10:37 am

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

Post Reply

Return to “QCAD/CAM”