pinoyhoogl.blogg.se

Simple qcad training
Simple qcad training













simple qcad training

Please make sure that if QCAD is run in release mode, your plugin is also compiled in release mode. If your plugin compiles but cannot be loaded by QCAD, please make sure that the same Qt version is used as for QCAD (see Help > About QCAD).

#Simple qcad training code

You can find the complete source code for this example plugin at: There should now be a menu entry "MyTool" at the top of the Misc menu in QCAD. We also need to add the qrc file to the project file (exampleplugin.pro) by adding the following line: RESOURCES = scripts.qrcĪfter editing the file exampleplugin.pro, run qmake and make again and load the plugin. QCAD will find the tool automatically under that path since it scans folder "scripts" as well as ":/scripts" for scripts. As soon as the plugin is loaded, the file will be available under path ":/scripts/MyTool/MyTool.js". The above example means that there is a file on disk under scripts/MyTool/MyTool.js which will be compiled into the plugin. The qrc file lists the paths under which resources are to be made available in Qt's resource system (alias="scripts/MyTool/MyTool.js") and the actual path where the file can be found on disk (used for compilation only). The tool adds itself at the top of the Misc menu and outputs "Hello World" when triggered. Let's assume there's a folder scripts/MyTool with a file MyTool.js which contains a QCAD tool, implemented in ECMAScript.

simple qcad training

Plugins tend to load faster than individual files from disk and take up less disk space. This has the advantage that the code of multiple ECMAScript files can be bundled inside a single, compiled binary file. QCAD plugins may be used to compile a collection of scripts and other resources (ui files, icons, etc.) into a plugin. Compiling Scripts as Resources into a Plugin You might also see an error message in the about dialog. If you cannot see your plugin, please check for errors on in the terminal while starting QCAD. Obviously, the plugin won't do anything useful yet, but you should be able to see your plugin in the QCAD about dialog: To compile in release mode, run make release or nmake release instead. If you run QCAD in release mode, the plugin must be compiled in release mode as well. Note: if you run a QCAD binary compiled in debug mode, the plugin must also be compiled in debug mode. Your plugin can be compiled with these three files, creating the file qcad/plugins/qcadexample.dll or libqcadexample.so or libqcadexample.dylib. As DESTDIR, you may want to choose the plugins folder of a working QCAD installation, so the plugin is compiled in the right place from where it can also be loaded by QCAD. The include on line 3 should point to the file shared.pri of the QCAD source code installation (e.g. LIBS += -lqcadcore -lqcadgui -lqcadecmaapi















Simple qcad training