Qt Script for Applications · Home · Tutorial · Classes · Functions · Language · QSA Workbench · Qt Documentation · www.trolltech.com

# QSA Workbench Reference

## Preface

This manual presents QSA Workbench, a scripting environment for creating, editing, and running scripts. The scripting environment features a code editor which includes syntax highlighting and completion. In addition, QSA Workbench provides an output window for viewing errors.

QSA Workbench

This manual introduces you to QSA Workbench in the first chapter, by leading you through the development of a short and simple script. The remaining chapters provide reference material that explain QSA Workbench's menu options, toolbars, key bindings, windows and dialogs in detail.

The following links take you directly to each chapter:

Chapter One: Using QSA Workbench (more to come).

Chapter Two: Reference: Key Bindings

Chapter Three: Reference: Menu Options

Chapter Four: Reference: Toolbar Buttons

Chapter Five: Reference: Dialogs

Chapter Six: Reference: Windows

### Feedback

If you have any comments, suggestions or criticisms regarding this manual, please let us know at doc@trolltech.com. Bug reports on Qt or Qt Script for Applications should be sent to qt-bugs@trolltech.com.

## Reference: Key Bindings

(QSA Workbench)

Ctrl+A -- Selects all of the code in the editor.

Ctrl+C -- Copies the selected code to the clipboard.

Ctrl+D -- Removes the active script from the project.

Alt+E -- Pulls down the Edit menu.

Alt+F -- Pulls down the File menu.

Ctrl+F -- Invokes the Find Text dialog.

Alt+G -- Invokes the Goto Line dialog.

Alt+H -- Pulls down the Help menu.

Ctrl+I -- Invokes the Import Script dialog.

Ctrl+N -- Invokes the New Script dialog to add a new script to the project.

Ctrl+F4 -- Closes the tab in the code editor.

Ctrl+R -- Invokes the Replace Text dialog.

Ctrl+E -- Invokes the Export Script dialog.

Ctrl+V -- Pastes the code in the clipboard into the editor.

Ctrl+X -- Cuts the selected code from the editor and places it into the clipboard.

Ctrl+Y -- Redoes the last undo action.

Ctrl+Z -- Undoes the last action.

Del -- Deletes code from the editor.

F5 -- Invokes the Call function dialog.

F6 -- Calls the lasr function specified in the Call Function dialog.

## Reference: Menu Options

### Introduction

QSA Workbench provides menu options that invoke the actions necessary to create applications. Many menu options lead to dialog boxes that provide additional options and functionality. The most commonly used menu options also have corresponding toolbar buttons. This chapter explains each menu option and its use. For menu options that invoke a dialog box or which have a corresponding toolbar button, there is a cross-reference to the detailed explanation that appears in the relevant chapter.

### The File Menu

The File Menu

This menu is invoked with Alt+F, and provides the following options:

- File|New Script Click this menu option (or press Ctrl+N) to invoke the New Script Dialog dialog.
- File|Import Script Click this menu option (or press Ctrl+I) to invoke the Import Script Dialog dialog.
- File|Export Script Click this menu option (or press Ctrl+E) to invoke the Export Script Dialog dialog.
- File|Rename Script Click this menu option (or press Ctrl+R) to rename script in the active editor. Object scripts cannot be renamed.
- File|Remove Script Click this menu option (or press Ctrl+D) to remove the script from the project.
- File|Close Tab Click this menu option (or press Ctrl+F4) to close the tab in the editor.
- File|Print Click this menu option (or press Ctrl+P) to print the contents of the current editor.
- File|Exit Click this menu option to exit QSA Workbench.

### The Edit Menu

The Edit Menu

This menu is invoked with Alt+E, and provides the following options:

- Edit|Undo Click this menu option (or press Ctrl+Z) to undo an action. The name of the last action that was performed appears after the word 'Undo'.
- Edit|Redo Click this menu option (or press Ctrl+Y) to redo an action. The name of the last action that was performed appears after the word 'Redo'.
- Edit|Cut Click this menu option (or press Ctrl+X) to delete the selected item from the current form or file and copy it to the clipboard.
- Edit|Copy Click this menu option (or press Ctrl+C) to copy the selected item from the current form or file to the clipboard.
- Edit|Paste Click this menu option (or press Ctrl+V) to paste the clipboard item (if any) into the current form or file.
- Edit|Select All Click this menu option (or press Ctrl+A) to highlight all the text in the current editor.
- Edit|Preferences Click this menu option to invoke the Preferences Dialog dialog.

### The Search Menu

The Search Menu

This menu is invoked with Alt+S, and provides the following options:

- Search|Find Click this menu option (or press Ctrl+F) to invoke the Find Text Dialog.
- Search|Find Next Click this menu option (or press F3) to find the next occurance of the last key word searched for. The Find Text Dialog is shown if this is the first search.
- Search|Find Previous Click this menu option (or press Shift+F3) to find the next occurance of the last key word searched for. The Find Text Dialog is shown if this is the first search.
- Search|Replace Click this menu option (or press Ctrl+R) to invoke the Replace Text Dialog to replace specific words or characters.
- Search|Goto line Click this menu option (or press Alt+G) to invoke the Goto Line Dialog to go to a specific line in the file.

### Project

Project Menu

This menu is invoked with Alt+P, provides the following options:

- Project|Call Function Click this menu option (or press F5) to invoke the Call function dialog.
- Project|Call Function Click this menu option (or press F6) to call the last function specified in the Call Function dialog.
- Project|Evaluate Press this function to force evaluation of the files in the project.

### Window

Window Menu, first submenu.

Window Menu, second submenu.

This menu is invoked with Alt+W, provides the following options:

- Window|Views|Output Click this menu option to enable/disable the output window.
- Window|Views|Project Scripts Click this menu option to enable/disable the project scripts window.
- Window|Views|Line up Click this menu option to line up the dockable windows in the user interface.
- Window|Toolbars|File Click this menu option to enable/disable the file toolbar.
- Window|Toolbars|Edit Click this menu option to enable/disable the edit toolbar.
- Window|Toolbars|Project Click this menu option to enable/disable the project toolbar.
- Window|Toolbars|Line up Click this menu option to line up the dockable windows in the user interface.

### The Help Menu

The Help Menu

This menu is invoked with Alt+H, and provides the following option:

- Help|About Click this menu option to invoke the About QSA Workbench dialog which gives the version number and some licensing information.

## Reference: Toolbar Buttons

### Introduction

QSA Workbench's toolbar buttons provide fast access to common functionality. Toolbar buttons are grouped in several toolbars. Toolbars have a handle at the left hand side which can be clicked to minimize the toolbar. Toolbars that have been minimized have their handle appear just under the menu bar; click the handle to restore the toolbar to the last position it occupied. You can drag a toolbar's handle to move the toolbar to a different position in the toolbar area. Toolbars can be dragged out of the toolbar area entirely and made into stand-alone tool dock windows. To hide a tool dock window click its close button. To restore a hidden tool dock window, right click the tool area, then click the name of the tool dock window you wish to restore.

### The File Toolbar Buttons

File Toolbuttons

Toolbutton {New Script} Click this toolbar button (or press Ctrl+N) to create a new dialog or source file. Clicking File invokes the New Script Dialogdialog.

Toolbutton {Import Script} Click this menu option (or press Ctrl+O) to invoke the Import Script Dialog dialog.

Toolbutton {Export Script} Click this menu option (or press Ctrl+S) to invoke the Export Script Dialog dialog.

Toolbutton {Remove Script} Click this menu option (or press Ctrl+D) to remove the script from the project.

### The Edit Toolbar Buttons

Edit Toolbuttons

Toolbutton Undo Click this toolbar button (or press Ctrl+Z) to undo an action. The name of the last action that was performed appears after the word 'Undo' in this toolbar button's tooltip.

Toolbutton Redo Click this toolbar button (or press Ctrl+Y) to redo an action. The name of the last action that was performed appears after the word 'Redo' in this toolbar button's tooltip.

Toolbutton Cut Click this toolbar button (or press Ctrl+X) to delete the selected item from the current form or file and copy it to the clipboard.

Toolbutton Copy Click this toolbar button (or press Ctrl+C) to copy the selected item from the current form or file to the clipboard.

Toolbutton {Paste} Click this toolbar button (or press Ctrl+V) to paste the selected item (if any) from the clipboard into the current form or file.

### The Project Toolbar Buttons

Project Toolbuttons

This menu is invoked with Alt+O, provides the following options:

Menu{Project|Call Function} Click this menu option (or press F5) to invoke the Call function dialog.

Menu{Project|Call Function} Click this menu option (or press F6) to call the last function specified in the Call Function dialog.

## Reference: Dialogs

### Introduction

This chapter describes and explains every QSA Workbench dialog.

### The Menu Dialogs

#### New Script Dialog

New Script Name

Click File|New Script to invoke the Input Script Name dialog. Use this dialog to name the script file that you want to include in your project.

#### Export Script Dialog

Export Script Dialog

Click File|Export Script As to invoke the Save AS dialog. Use this dialog to save the script file in your project.

#### Import Script Dialog

Import Script Dialog

Click File|Export Script As to invoke the Save AS dialog. Use this dialog to save the script file in your project.

### The Edit Dialogs

#### Preferences Dialog

Preferences Dialog

Click Edit|Preferences to invoke the Preferences dialog.

The 'Syntax Highlighting' section lets you change the way the syntax is viewed in the editor. Click the 'Element' listbox and choose an element. Click the 'Family' listbox to change the font style for that element. Click the 'Size' spinbox to choose a font size. You can change the font to Bold, Italic, or Underline by clicking the corresponding checkbox. Note, that all the fonts used derive from the 'Standard' element, so if you want to change the font used for everything, change the 'Standard' element. Click the Change Color button to invoke the Select Color Dialog. As you make changes to each element, you can view the changes in the 'Preview' line edit.

The 'Options' section has the Wordwrap, Completion, and Parentheses Matching checkboxes checked by default. Click the checkboxes to de-select them.

The Indentation section enables you to set the code intentation on the Qt Script Editor. Select your preferences by clicking the spinboxes for Tab Size and Indent Size. Check the Keep Tabs checkbox so that tabs are used for indentation otherwise, spaces will be used. Check Auto Indent to enable automatic indentation.

### The Search Dialogs

#### Find Text Dialog

Find Text

Click Search|Find (or press Ctrl+F) to invoke the Find Text Dialog. Use this dialog to find specific text in a project file.

To find the text you want in a file, type the text in the 'Find' combobox. You can make the search more specific by checking any or all of the checkboxes in the 'Options' section. Click the 'Whole words only' checkbox to narrow the search to whole words. Click 'Case Sensitive' to search for text that is identical to the text typed in the combobox. Click 'Start at Beginning' to start the search from the beginning of the file. The 'Direction' section offers the 'Forward' radio button and the 'Backward' radio button to specify the direction to perform the search in the file. Click the Find button to start the search. When the text is found, it is highlighted in the file. Continue clicking Find to search for subsequent occurrences of the search text.

Click the Close button to leave the dialog.

#### Replace Text Dialog

Replace Text

Click Search|Replace (or press Ctrl+R) to invoke the Replace Text Dialog. Use this dialog to replace text in a project file.

To replace text, type the text you would like to replace in the 'Find' combobox. Type the new text in the 'Replace' combobox. You can make the search more specific by checking any or all of the checkboxes in the 'Options' section. Click the 'Whole words only' checkbox to narrow the search to whole words. Click 'Case Sensitive' to search for text that identical to the text you typed in the combobox. Click 'Start at Beginning' to start the search from the beginning of the file. The 'Direction' section offers the 'Forward' radio button and the 'Backward' radio button to specify the direction to perform the search in the file.

Click the Replace button to search and replace the text. When the text is found, it is highlighted in the file. Continue clicking Replace button to search and replace each occurrence of the text in the file. Click Replace All button to replace all occurences of the search text in the file at once.

Click the Close button to leave the dialog.

#### Goto Line Dialog

Goto Line

Click Search|Goto line (or press Alt+G) to invoke the Goto Line Dialog. Use this dialog to go to a specific line in the file.

To choose a line number, type the number in the 'Line' spinbox, or click the up and down arrows in the spinbox. Click the Goto button. The cursor is placed at the beginning of the line in the file.

Click the Close button to leave the dialog.

### The Project Dialog

#### Call Function Dialog

Call Function Dialog

Click Project|Call Function (or press F5) to invoke the Call Function Dialog. Use this dialog to select the name of the function to run.

### The Help Dialogs

#### About Qt Designer Dialog

Click Help|About to invoke the About QSA Workbench Dialog. This dialog provides information about QSA Workbench such as the version, the licensing terms, conditions, and disclaimers.

## Reference: Windows

### Introduction

By default QSA Workbench starts up with two windows: the Project Scripts window and the Output window. This chapter explains each window in detail.

### Project Scripts Window

Project Scripts Window

This window lists all the script files associated with the project. To open a form or file single click it in the Files list.

Double-click a file to open its corresponding tab on Editor window if the tab has been previously closed.

Right-click a file to get a context menu of options.

The scripts that are executed within the context of an object are have a small red box in the script icon.

Script running inside the context of an applicationobject.

The scripts that are executed in the global context are displayed as plain scripts.

Script running in the global context.

### Output Window

Ouput Window

This window displays errors that occur when running the script.