[Kst] extragear/graphics/kst/kst/extensions/js

George Staikos staikos at kde.org
Thu May 26 01:39:21 CEST 2005


SVN commit 418231 by staikos:

enhance the script docs


 M  +0 -30     bindings.txt  
 M  +45 -4     scriptgui.html  


--- trunk/extragear/graphics/kst/kst/extensions/js/bindings.txt #418230:418231
@@ -63,37 +63,7 @@
 	actions.
 
 
-_______________________________________________________________________________
 
-Working With The UI
--------------------
-
-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.
-
-	var dialog = Factory.loadui("myuserinterface.ui");
-	var 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:
-
-	var gui = KstUIMerge.loadGUI("myuserinterface.rc");
-	var action = new KAction(gui.actionCollection(), "my_action_name");
-	action.text = "&Name Of My Action";
-	action.connect(action, 'activated()', someobject, 'show');
-	gui.merge();
-_______________________________________________________________________________
-
 Consistency
 -----------
 
--- trunk/extragear/graphics/kst/kst/extensions/js/scriptgui.html #418230:418231
@@ -11,8 +11,8 @@
 
 <code>
 <pre>
-	var dialog = Factory.loadui("myuserinterface.ui");
-	var button = dialog.getElementById('ok');
+	dialog = Factory.loadui("myuserinterface.ui");
+	button = dialog.getElementById('ok');
 	button.connect(button, 'clicked()', someobject, 'okClicked_void');
 </pre>
 </code>
@@ -29,14 +29,55 @@
 
 <code>
 <pre>
-	var gui = KstUIMerge.loadGUI("myuserinterface.rc");
-	var action = new KAction(gui.actionCollection(), "my_action_name");
+	gui = KstUIMerge.loadGUI("myuserinterface.rc");
+	action = new KAction(gui.actionCollection(), "my_action_name");
 	action.text = "&amp;Name Of My Action";
 	action.connect(action, 'activated()', someobject, 'show');
 	gui.merge();
 </pre>
 </code>
 
+<h4>Helper Classes</h4>
+<ul>
+KstUIMerge
+	<ul>
+	Global object used to load XMLUI files for merging.<br/>
+	Method: <code>KstJSUIBuilder loadGUI(String filename);</code>
+		<ul>
+		<p>Loads a XMLUI file for merging with Kst's GUI.  Returns
+		a KstJSUIBuilder instance with the XMLUI loaded and ready to
+		merge.</p>
+		String <b>filename</b> The filename of the .rc file to load.<br/>
+		</ul>
+	</ul>
+	<br/>
+KstJSUIBuilder
+	<ul>
+	Object containing an action collection and XMLUI ready for merging.
+	<br/>
+	Method: <code>KActionCollection actionCollection();</code>
+		<ul>
+		<p>Obtain a reference to the action collection for creating new
+		actions. Returns a KActionCollection instance for storing newly
+		created actions to be merged with Kst's GUI.</p>
+		</ul>
+	Method: <code>void merge();</code>
+		<ul>
+		<p>Merge the action collection with Kst's GUI according to the
+		rules of the loaded XMLUI file.  Must be called after all
+		actions are created as a part of the actionCollection().</p>
+		</ul>
+	</ul>
+	<br/>
+KActionCollection
+	<ul>
+	See C++ documentation for KActionCollection.  Simply a list of
+	actions.
+	</ul>
+	<br/>
+</ul>
+
+
 <h4>Licensing Issues</h4>
 <p>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


More information about the Kst mailing list