My UI widget is not displayed

This forum is for 'Work-in-Progress' 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: andrew, Husky, J-J

Post Reply
plane
Newbie Member
Posts: 8
Joined: Wed Apr 23, 2014 9:33 am

My UI widget is not displayed

Post by 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/develo ... dgets.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/develo ... ete_script

I start QCAD with debugger enabled and I get an error
MyWidgets3.png
MyWidgets3.png (44.6 KiB) Viewed 7819 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 7819 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

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

Re: My UI widget is not displayed

Post by 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.

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

Re: My UI widget is not displayed

Post by 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.

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”