Making a C++ class scriptable

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
josh.wu
Newbie Member
Posts: 5
Joined: Sun Jan 19, 2014 10:03 am

Making a C++ class scriptable

Post by josh.wu » Wed Aug 27, 2014 8:06 am

how can i make my c++ class can be use in Script。

like RActionAdapter:
function EAction(guiAction) {
    RActionAdapter.call(this);
    this.guiAction = guiAction;
    if (!isNull(guiAction)) {
        this.setGuiAction(guiAction);
    }

    // Constructor is called without arguments to create prototype
    // for derived class. At this point, includeBasePath is set correctly:
    if (isNull(guiAction)) {
        this.includeBasePath = includeBasePath;
    }

    this.state = undefined;
    this.settingsGroup = undefined;
    this.uiFile = undefined;
    this.splitUiOptions = false;
    this.additionalOptionsToolBars = undefined;
    this.optionsToolBarEnabled = true;
    this.relativeZeroPos = undefined;
}

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

Re: Making a C++ class scriptable

Post by andrew » Wed Aug 27, 2014 9:31 am

You can find a simple example plugin which makes a class called "MyClass" scriptable at:
https://github.com/qcad/qcad/tree/maste ... mpleplugin

The complete documentation from Qt to make classes scriptable can be found at:
http://qt-project.org/doc/qt-4.8/scripting.html

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”