From 9ba04742771370f59740e32e11c5f3a1e6a1b70a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 5 Dec 2011 15:55:57 -0600 Subject: Initial TQt conversion --- kjsembed/docs/tutorial/kjsembed.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'kjsembed/docs/tutorial/kjsembed.html') diff --git a/kjsembed/docs/tutorial/kjsembed.html b/kjsembed/docs/tutorial/kjsembed.html index dc769dc3..7e2c38fd 100644 --- a/kjsembed/docs/tutorial/kjsembed.html +++ b/kjsembed/docs/tutorial/kjsembed.html @@ -38,7 +38,7 @@ pre { been designed with this in mind thanks to a KParts plugin. In addition, KJSEmbed provides a command line tool for running scripts so users can easily create simple applications of their own in Javascript. KJSEmbed scripts are surprisingly - powerful because they access the properties and slots of QObjects, and can even + powerful because they access the properties and slots of TQObjects, and can even load widgets and dialogs created with Qt's graphical dialog editor.

Features

To give you an idea of what KJSEmbed provides, here is a brief summary of the @@ -51,16 +51,16 @@ pre { X server if you don't need to display a GUI).

  • Define new KActions using XML.
  • Scripts can connect signals to slots.
  • -
  • Scripts can access the properties and slots of QObjects as if they were +
  • Scripts can access the properties and slots of TQObjects as if they were normal Javascript properties and methods.
  • Scripts can load dialogs and widgets created with Qt Designer.
  • -
  • Scripts can create instances of anu TQWidget subclass supported by TQWidgetFactory.
  • -
  • Making your own QObjects/QWidgets available for scripting is one-liner.
  • +
  • Scripts can create instances of anu TTQWidget subclass supported by TTQWidgetFactory.
  • +
  • Making your own TQObjects/TQWidgets available for scripting is one-liner.
  • Scripts can traverse the widget tree, so your entire application can be made scriptable without explicitly binding every object.
  • First Steps - The Console Dialog

    -

    The quickest way to see what KJSEmbed can do is with kjscmd, a tool for running +

    The tquickest way to see what KJSEmbed can do is with kjscmd, a tool for running scripts from the command line. To begin, we'll run kjscmd without any parameters which brings up the KJSEmbed console dialog. The console provides an easy way to run short (one line) scripts, as you can see in figure 1 the scripts have @@ -88,11 +88,11 @@ JSConsoleWidget (KJSEmbed::JSConsoleWidget) kjs> console.childCount() 4 kjs> console.child(1) -CmdEdit (TQComboBox) +CmdEdit (TTQComboBox) kjs> console.child(2) -RunButton (TQPushButton) +RunButton (TTQPushButton) kjs> console.child("RunButton") -RunButton (TQPushButton) +RunButton (TTQPushButton) kjs> console.child("RunButton").text = "Go!" Go! kjs> console.caption = "Different Title" @@ -149,12 +149,12 @@ print( cmd );

    Listing 1: A Script That Displays the Grep Dialog

    In order to find out what the user asked us to search for we need to extract the contents of the various fields in our dialog. We know that the field for - entering the text to be searched for is a TQLineEdit called 'search_edit', so + entering the text to be searched for is a TTQLineEdit called 'search_edit', so we can use the child() method to get hold of it (this method searches through the children of an object until it finds one with a matching name). Once we've - found the right object getting hold of the text is easy because all QLineEdits + found the right object getting hold of the text is easy because all TQLineEdits make their contents available as a property called 'text'. The code that gets - the value of the check boxes is almost identical, except that these are QCheckBoxes + the value of the check boxes is almost identical, except that these are TQCheckBoxes so it's the 'checked' property we're interested in.

    Grep Dialog Screenshot

    Figure 3: The Grep Dialog

    -- cgit v1.2.1