Share my state between different scripts

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
Active Member
Posts: 47
Joined: Mon Aug 28, 2017 4:39 pm

Share my state between different scripts

Post by sarlaa » Fri Mar 16, 2018 12:46 pm


Could you tell me how can I share my state, that contains data related to document with format json, with all scripts as data global ?

I saw this reference viewtopic.php?f=30&t=3187&p=11338&hilit ... ble#p11338
but it seems that works just for primitifs type variables.


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

Re: Share my state between different scripts

Post by andrew » Fri Mar 16, 2018 2:04 pm

The approach for application wide, non-persistent data should work fine also for JSON:

Code: Select all

var appWin = RMainWindowQt.getMainWindow();
appWin.setProperty("MyProperty", {"a":3, "b":7, ...});

var value ="MyProperty")["a"];

Post Reply

Return to “QCAD Developers and Contributors”