Extending class RLineEntity

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

Moderator: andrew

Post Reply
saibou
Newbie Member
Posts: 6
Joined: Wed Dec 20, 2017 12:27 pm

Extending class RLineEntity

Post by saibou » Tue Jan 30, 2018 12:26 pm

Hi,

I recently purchased qcad pro licence , and now I want to extend RLineEntity class with new properties, my question have I to purchase C++ licence for doing this, and could you give me an example for doing that ?

Thanks for your orientation.

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

Re: Extending class RLineEntity

Post by andrew » Tue Feb 06, 2018 10:24 pm

You can add custom properties to any entity (line, arc, dimension, etc) or other object (layer, block, etc.) using REntity::setCustomProperty

In the GUI, you can use the property editor to add / inspect custom properties.

You do not need a QCAD C++ Libraries license for this.

saibou
Newbie Member
Posts: 6
Joined: Wed Dec 20, 2017 12:27 pm

Re: Extending class RLineEntity

Post by saibou » Mon Feb 19, 2018 12:07 pm

Hi,

I don't think custom properties feat my neads for these reasons :
-On base, my new properties will be added by applicaion not by user (some of will be presented in property editor and others no).
-New properties with boolean type, list of values, handle value for refercing onther object...
-Can not show a property in the edior.
-Not included in QCAD group.

That's why I think I'll need to add my new properties by C++.
Could you confrm me ?

Thanks.

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

Re: Extending class RLineEntity

Post by andrew » Mon Feb 19, 2018 12:19 pm

saibou wrote:That's why I think I'll need to add my new properties by C++.
There is no difference if you add properties using the ECMAScript interface or C++ (ECMAScript calls into C++).

QCAD supports custom string type properties to be attached to all objects (entities, layers, blocks). If this is not sufficient, you would have to add new properties to RObject or REntity or implement your own property system, i.e. modify RObject or REntity classes.

saibou
Newbie Member
Posts: 6
Joined: Wed Dec 20, 2017 12:27 pm

Re: Extending class RLineEntity

Post by saibou » Mon Feb 19, 2018 1:18 pm

Yes string properties not sufficient for me.
So with your response to add new properties to RObject or REntity, I comeback to my question, have I to purchase C++ licence for doing that ?

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

Re: Extending class RLineEntity

Post by andrew » Mon Feb 19, 2018 2:14 pm

saibou wrote:So with your response to add new properties to RObject or REntity, I comeback to my question, have I to purchase C++ licence for doing that ?
Ideally, you can create all your extensions as a plugin which can be distributed under any license of your choice without the need for a QCAD C++ Libraries license.

If you modify the QCAD sources directly (i.e. change the REntity class or derived classes) you must distribute those changes under the GPLv3 (same as the QCAD source code). Again, you do not need a QCAD C++ Libraries license.

A QCAD C++ Libraries license is only needed if you require access to the source code of the QCAD Professional add-ons (DWG importer / exporter, QCAD Professional tools and algorithms, etc.).

saibou
Newbie Member
Posts: 6
Joined: Wed Dec 20, 2017 12:27 pm

Re: Extending class RLineEntity

Post by saibou » Thu Feb 22, 2018 7:34 pm

Thanks for your response, I saw your plugin example. https://github.com/qcad/qcad/blob/maste ... in.cpp#L58

And what I want o achieve to change "MyClass" to extend from RLineEntity as :

Code: Select all

class MyClass : public RLineEntity {
public:
    MyClass(RDocument* document, const RLineData& data) : RLineEntity(document, data) {}

    virtual int getInt() const {
        return i;
    }

    virtual double getDouble() const {
        return d;
    }

    virtual QString getString() const {
        return s;
    }

    virtual void setInt(int v) {
        i = v;
    }

    virtual void setDouble(int v) {
        d = v;
    }

    virtual void setString(const QString& v) {
        s = v;
    }

private:
    int i;
    double d;
    QString s;
};
How can I change EcmaMyClass::createMyClass in way to retreive document and data from *context for passing them as arguments in instanciation of MyClass ?

Thanks.

Post Reply

Return to “QCAD Developers and Contributors”