[Prev: Creating Scripts Using Qt Script for Applications] [Home]
To get access to the QSA Input Dialog framework in the interpreter you need to instanciate the QSInputDialogFactory and add it to the interpreter, using the function QSInterpreter::addObjectFactory(QSObjectFactory *).
QSProject project; QSInputDialogFactory inputDialogFactory; QSInterpreter *interpreter = project.interpreter(); interpreter->addObjectFactory( &inputDialogFactory );
The following is a list of QSA's public classes and their properties:
The CheckBox widget provides a checkbox with a text label. CheckBox is an option button; it can be switched on (checked) or off (unchecked).
text : String - This property holds the text shown on the button.
checked : Boolean - This property holds whether the checkbox is checked.
The default is unchecked, i.e. false.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The ComboBox widget is a combined button and popup list. A combobox is a selection widget which displays the current item and can pop up a list of items. A combobox may be editable in which case the user can enter arbitrary strings.
editable : Boolean - This property holds whether the combobox is editable. This property's default is false.
itemList : Array - The list of items in a combobox.
currentItem : String - This property is used in two ways: To specify the default selected item in the combobox; and to get the value the user selected in the combobox when the dialog is closed.
The default is the first item in the list.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The DateEdit class provides a date editor. DateEdit allows the user to edit dates by using the keyboard or the arrow keys to increase/decrease date values. The arrow keys can be used to move from section to section within the DateEdit box. Dates appear in accordance with the local date/time settings or in year, month, day order if the system doesn't provide this information.
date : Date - This property holds the editor's date value. The default is now.
order : Order - This property holds the order in which the year, month and day appear. The default order is locale dependent.
maximum : Date- This property holds the editor's maximum value. The default maximum date is 8000-12-31.
minimum : Date- This property holds the editor's minimum value. The default minimum date is 1752-09-14.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The Dialog class is the base class of dialog windows.A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user. Dialogs may be modal or modeless.
caption : String - This property holds the window caption (title). The default is the application's name.
cancelButtonText : String - This property holds the text shown on the cancel button.
okButtonText: String - This property holds the text shown on the ok button.
width : Number - This property holds the width of the widget excluding any window frame. The default is set by the lay out of the widgets.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The Input class provides a simple convenience dialog to get a single value from the user.
caption : String - This property holds the window caption (title).
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The GroupBox widget provides a group box frame with a title and it displays various other widgets inside itself.
title : String - This property holds the group box title text.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The QLineEdit widget is a one-line text editor.
text : String - This property holds the selected text.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The NumberEdit class provides range checking of floating-point numbers. NumberEdit provides an upper bound, a lower bound and a limit on the number of digits after the decimal point.
decimals : Number - This property holds the number edits's maximum number of digits after the decimal point. the default is 0.
maximum : Number - This property holds the number edit's maximum acceptable value. The default is 2.147.483.647.
minimum : Number -This property holds the number edit's minimum acceptable value. The default is 2.147.483.647.
number : Number- This property holds the number edit's input value. The default is 0.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The RadioButton widget provides a radio button with a text label. RadioButton is an option button; it can be switched on (checked) or off (unchecked).
text : String - This property holds the text shown on the button. The default value is unchecked (false). default is no text.
checked : Boolean - This property holds whether the radio button is checked.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The SpinBox class provides a spin box widget (spin button). SpinBox allows the user to choose a value either by clicking the up/down buttons to increase/decrease the value currently displayed or by typing the value directly into the spin box. If the value is entered directly into the spin box, Enter (or Return) must be pressed to apply the new value. The value is usually an integer.
maximum : Number - This property holds the maximum value of the spin box. The default value is 2.147.483.647.
minimum : Number - This property holds the minimum value of the spin box. The default value is 2.147.483.647.
number : Number - This property holds the value of the spin box. The default is 0.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The QTextEdit widget provides a multi-line text editor.
text : String - This property returns the text of the TextEdit.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
The TimeEdit class provides a time editor. TimeEdit allows the user to edit times by using the keyboard or the arrow keys to increase/decrease time values. The arrow keys can be used to move from section to section within the TimeEdit box.
maximum : Time - This property holds the maximum time value.
minimum : Time - This property holds the minimum time value.
showAMPM : Boolean - This property holds the AM/PM section that is displayed in the time edit. The default is false.
showSeconds : Boolean - This property holds the seconds section that is displayed in the time edit. The default is true.
time : Time - This property holds the editor's time value.
tooltip : - This property holds tool tips (balloon help) for any widget or rectangular part of a widget.
whatsThis : - This property holds a simple description of any widget, i.e. answering the question "What's this?"
Convenience classes with static functions provide a means of getting a value from the user without using any complex widget hierarchies.
This class provides a simple way of popping up a message box window for the user. The following lines of code present a pop up messagebox with a warning and query the user to click Yes or No.
MessageBox.warning( "Do you wish to abort!", MessageBox.Yes, MessageBox.No );
caption : String - Describes the caption of all message boxes. Uses application name if no name is specified.
The button types are used to describe what the text of the buttons should be. The following are available.
NoButton - No button is displayed.
Ok - Displays a 'Ok' button.
Cancel - Displays a 'Cancel' button.
Yes - Displays a 'Yes' button.
No - Displays a 'No' button.
Abort - Displays an 'Abort' button.
Retry - Displays a 'Retry' button.
Ignore- Displays an 'Ignore' button.
The following is a list of message box functions. Each function returns the button type corresponding to the one that the user pressed.
information( label : String, button1 : ButtonType, button2 : ButtonType, button3 : ButtonType ) - Displays an information dialog with the content described in label.
warning( label : String, button1 : ButtonType, button2 : ButtonType, button3 : ButtonType )
critical( label : String, button1 : ButtonType, button2 : ButtonType, button3 : ButtonType )
This class provides dialogs that allow users to select files or directories.
caption : String - Describes the captions of all file dialogs. Uses application name if no name is specified.
getOpenFileName( filter : String ) - Opens an "Open file" dialog. If filter is specified ( e.g. "textfiles (*.txt)" ) it is used to filter out invalid file types. The function returns a string with the filename selected.
getSaveFileName( filter : String ) - Opens an "Save file" dialog. If filter is specified ( e.g. "textfiles (*.txt)" ) it is used to filter out invalid file types. The function returns a string with the filename selected.
getExistingDirectory( dir : String ) - Opens a dialog for the user to select an existing directory. The parameter dir can be used to specify the starting directory.
getOpenFileNames( dir : String, filter : String ) - Opens an "Open files" dialog for the user to select and open an existing file. If dir is specified it describes the directory the dialog opens in. If filter is specified it describes the file name filter.
This class provides convenience functions for getting simple input from the user.
caption : String - Describes the captions of all input dialogs. Uses application name if no name is specified.
getText( label : String, text : String ) - Queries the user for a text. label describes the label and text describes the default value if set. The function returns the value typed in by the user or undefined if the user cancels the operation.
getNumber( label : String, value : Number, decimals : Number, minValue : Number, maxValue : Number ) - Queries the user for a number. label describes the label, value describes the default value, decimals describes the number of decimals allowed, minValue describes the minimum value and maxValue describes the maximum value. The function returns the value selected by the user or undefined if the user cancels the dialog.
getItem( label : String, itemList : Array, current : String, editable : Boolean ) - Opens a dialog with a list of predefined values described by itemList. The label is specified with label. current describes the value that is selected when the item opens. If editable is true, the user is allowed to input a value that is not specified by itemList. The function returns the value selected by the user or undefined if the user cancels the dialog.