[INFO] Debugging QCAD C++ plugin using pro features

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
Taygete
Full Member
Posts: 50
Joined: Wed May 14, 2014 8:53 am

[INFO] Debugging QCAD C++ plugin using pro features

Post by Taygete » Wed Apr 01, 2015 2:10 pm

Hi All,

If anyone has wanted to debug their QCAD C++ Plugin using the released Pro version of QCAD then the following may be of interest.

An issue I had was I use custom properties in my plugin that need to be saved out with the file, however if I try loading the file back into QCAD using a debug build of my plugin the pro features no longer work and so I no longer see the custom properties.

The way around this is to build a release version of my plugin with debug info, I can then copy the plugin and associated debug files to the release version of QCAD, start QCAD and use Qt Creator to attach to the version of QCAD that is running. From there I can set breakpoints etc. in my plugins code and debug like normal. Because it is a release build you may see a few issues while debugging such as the debugger appearing to run lines of code which it shouldn't but these are not normally an issue.

Okay so how do we achieve this? Simple, add the following two lines to your plugins .pro file and run qmake then rebuild.

Code: Select all

QMAKE_CXXFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /DEBUG
One thing to remember is to comment out the files before doing a release build to the public.

Hope that is helpful to someone.

Thanks,

Andrew.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”