Page 1 of 1

My UI widget is not displayed

Posted: Wed Apr 23, 2014 5:51 pm
by plane
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 8762 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 8762 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

Re: My UI widget is not displayed

Posted: Wed Apr 23, 2014 9:02 pm
by andrew
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.

Re: My UI widget is not displayed

Posted: Mon Apr 28, 2014 10:26 am
by plane
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.