Working With The GUI

User interfaces can be created with JavaScript, both manually via QWidget bindings, and with Qt Designer. Using Qt Designer is the preferred method and can be accomplished as follows.

	dialog = Factory.loadui("myuserinterface.ui");
	button = dialog.getElementById('ok');
	button.connect(button, 'clicked()', someobject, 'okClicked_void');

All widgets need to be named appropriately as they are clearly referenced from the XML designer file via DOM methods by their widget name.

It is almost always the case that code that uses widgets or dialogs will want to create a class to organize the data and UI and create slots for the signals generated by the UI elements.

Menu entries can be merged into the Kst menus by creating KActions and loading an appropriate XMLUI rc file:

	gui = KstUIMerge.loadGUI("myuserinterface.rc");
	action = new KAction(gui.actionCollection(), "my_action_name");
	action.text = "&Name Of My Action";
	action.connect(action, 'activated()', someobject, 'show');
	gui.merge();

Helper Classes

Licensing Issues

It is possible, but unclear at this time, that script user-interfaces developed with Trolltech's Qt Designer product must be licensed under one of Trolltech's licensing models. This includes the GPL. This may only apply if such UI files are redistributed.


[Index]
Copyright © 2005-2006 The University of Toronto
Kst http://kst.kde.org/