My UI widget is not displayed

This forum is for QCAD user developed script Add Ons and Plug-ins.
Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: Clive, andrew, Husky

My UI widget is not displayed

Postby plane » Wed Apr 23, 2014 5:51 pm

Hello Everybody,

I have programming experince but I am new with Qt, JavaScript and QCAD.
So far I was able to replicate all the examples described in the web site.

I am trying to replicate the example PersistentWidgets as described at following link
http://www.qcad.org/doc/qcad/3.0/developer/_persistent_widgets.html
but I cannot get the widget displayed.

I have created the folder structure the Action and the UI file.
In PersistentWidgets.js I have copied and pasted the code from
http://www.qcad.org/doc/qcad/3.0/developer/_persistent_widgets.html#complete_script

I start QCAD with debugger enabled and I get an error
MyWidgets3.png
MyWidgets3.png (44.6 KiB) Viewed 407 times


I have removed the if statement
/*
if (!dialog.exec()) {
// User hit cancel:
this.terminate();
return;
}
*/


and now I can see the following instructions are executed,
// Print the user input to the QCAD console:
var appWin = EAction.getMainWindow();
appWin.handleUserMessage("Position X: " + positionX);
appWin.handleUserMessage("Position Y: " + positionY);
this.terminate();

MyWidgets4.png
MyWidgets4.png (3.17 KiB) Viewed 407 times

but the widget is not displayed.

Did I miss any instruction or anything else, please?
I would be glad if you could give me any suggestion.

Kind regards,
Plane
plane
Newbie Member
 
Posts: 8
Joined: Wed Apr 23, 2014 9:33 am

Re: My UI widget is not displayed

Postby andrew » Wed Apr 23, 2014 9:02 pm

It looks like your widget is not a dialog but probably a normal widget.

Regular widgets can be shown with show:

myWidget.show();


Dialogs are typically executed and only return to the main program once they are closed. Regular widgets can be shown / hidden at any time without influencing the flow of the main application.
User avatar
andrew
Site Admin
 
Posts: 2548
Joined: Fri Mar 30, 2007 6:07 am

Re: My UI widget is not displayed

Postby plane » Mon Apr 28, 2014 10:26 am

Andrew thank you for your reply.

it works with following statement
// Display and execute the dialog:
dialog.show();
in
MyWidgets.prototype.beginEvent = function()

My next step is now how to capture events from my dialog.
Thank you again for your prompt answer.
plane
Newbie Member
 
Posts: 8
Joined: Wed Apr 23, 2014 9:33 am


Return to QCAD 3 ' script Add-On & Plug-in challenge '

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron