How do I go about recalling a method from an event

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
pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

How do I go about recalling a method from an event

Post by pietro_72_ » Mon Nov 04, 2019 10:13 am

Hello
Sorry, I confess I have some difficulty with object-oriented programming

If instead of using the function:
     operativeModePres = function () {
         ......
I use the method:
     OrthogonalProjections.prototype.operativeModePres = function () {

As I have to do to recall this method from an event I tried a few ways but it does not go:
     // operativeMode ['currentIndexChanged (int)']. connect (function () {operativeModePres ();});
     // operativeMode ['currentIndexChanged (int)']. connect (function () {this.operativeModePres;});
     operativeMode ['currentIndexChanged (int)']. connect (function () {operativeModePres.call (operativeModePres);});

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: How do I go about recalling a method from an event

Post by pietro_72_ » Mon Nov 04, 2019 9:31 pm

Searching for solutions on https://github.com/qcad/qcad/ have managed to solve this problem as follows:

operativeMode ['currentIndexChanged (int)']. connect (this, "operativeModePres");

From here maybe I can solve the previous problem:
"Loss of script operation after using snaps"

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”