Hi Andrew,
just to make sure: I'm trying to set / get custom properties from C++. I recognize that they are only available in the pro version - as documented. However, I compile / link my sources against the source code of the opensource version (which I compiled as debug). Compile / link works ok; as result, my plugin dll does not set custom properties in the pro version. However, using my plugin in the pro environment getting of custom properties works fine...
Is the behaviour which I figured out as desired? What do I need / can I do to be able to compile / link code with complete custom property acces?
Environment: QCAD 3.8.1 under OpenSuse 13.2; g++ etc.
Thanks in advance!
Ulrch
[SOLVED] Assign custom properties to entities
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Assign custom properties to entities
You can explicitely enable custom properties in your plugin using:
RSettings::setXDataEnabled(true);The Teigha Plugin for DXF/DWG support does that, so whenever that plugin is loaded, custom properties should be available. Without this plugin, you won't be able to save custom properties.
Re: Assign custom properties to entities
Hi Andrew,
thanks for your answer. The call of the setting in my plugins init() now shows the custom property widgets in the property editor. However, assigning custom properties from my c++ code has problems. Here is my code snipplet (not as long as in my other post :
and the corresponding debug output:
However, the expected custom property does not show in the property editor.
Any idea what might be wrong?
As I want to be able to debug, I built debug binaries from the opensource 3.8.1 sources. I copied the Teigha shared lib from the pro (relase) distribution into the debug plugin directory; as expected, it does not load (not shown in the Help about plugin tab). Am I right that I need the c++ qcad libraries to be able to use all pro features in a debug version?
(NB: for my opinion the description of the c++ qcad libraries is too cryptic ...)
Regards,
Ulrich
thanks for your answer. The call of the setting in my plugins init() now shows the custom property widgets in the property editor. However, assigning custom properties from my c++ code has problems. Here is my code snipplet (not as long as in my other post :
Code: Select all
nHighestSeamsectionNumber++;
qDebug() << "buildSeamsequences4Circles set property to " << nHighestSeamsectionNumber;
QString qsTitle = DACADGlobals::getCusPropNmTitle();
QString qsKey = DACADGlobals::getCusPropNmSewingSectionId();
QVariant qvValue(nHighestSeamsectionNumber);
qDebug() << "qsTitle = " << qsTitle << "qsKey = " << qsKey << " qvValue = " << qvValue;
entityPtr->setCustomProperty(qsTitle, qsKey, qvValue);
Code: Select all
Debug: buildSeamsequences4Circles set property to 1
Debug: qsTitle = "QCAD" qsKey = "DASewingSectionId" qvValue = QVariant(int, 1)
Any idea what might be wrong?
As I want to be able to debug, I built debug binaries from the opensource 3.8.1 sources. I copied the Teigha shared lib from the pro (relase) distribution into the debug plugin directory; as expected, it does not load (not shown in the Help about plugin tab). Am I right that I need the c++ qcad libraries to be able to use all pro features in a debug version?
(NB: for my opinion the description of the c++ qcad libraries is too cryptic ...)
Regards,
Ulrich
Re: Assign custom properties to entities
I have to apologize.
I obviously made a mistake in transaction handling. The custom property was added to the entity, and then i tried to add it to a transaction with "addAffectedObject (RObject::Id objectId)". After using addObject, everything works fine (as least in the release version I alternatively tried).
Please close this post.
Regards,
Ulrich
I obviously made a mistake in transaction handling. The custom property was added to the entity, and then i tried to add it to a transaction with "addAffectedObject (RObject::Id objectId)". After using addObject, everything works fine (as least in the release version I alternatively tried).
Please close this post.
Regards,
Ulrich