1QAxScript(3qt) QAxScript(3qt)
2
3
4
6 QAxScript - Wrapper around script code
7
9 This class is part of the Qt ActiveQt Extension.
10
11 #include <qaxscript.h>
12
13 Inherits QObject.
14
15 Public Members
16 enum FunctionFlags { FunctionNames = 0, FunctionSignatures }
17 QAxScript ( const QString & name, QAxScriptManager * manager )
18 ~QAxScript ()
19 bool load ( const QString & code, const QString & language =
20 QString::null )
21 QStringList functions ( FunctionFlags flags = FunctionNames ) const
22 QString scriptCode () const
23 QString scriptName () const
24 QAxScriptEngine * scriptEngine () const
25 QVariant call ( const QString & function, const QVariant & var1 =
26 QVariant ( ), const QVariant & var2 = QVariant ( ), const QVariant
27 & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ), const
28 QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant (
29 ), const QVariant & var7 = QVariant ( ), const QVariant & var8 =
30 QVariant ( ) )
31 QVariant call ( const QString & function, QValueList<QVariant> &
32 arguments )
33
34 Signals
35 void entered ()
36 void finished ()
37 void finished ( const QVariant & result )
38 void finished ( int code, const QString & source, const QString &
39 description, const QString & help )
40 void stateChanged ( int state )
41 void error ( int code, const QString & description, int sourcePosition,
42 const QString & sourceText )
43
45 This class is defined in the Qt ActiveQt Extension, which can be found
46 in the qt/extensions directory. It is not included in the main Qt API.
47
48 The QAxScript class provides a wrapper around script code.
49
50 Every instance of the QAxScript class represents a piece of scripting
51 code in a particular scripting language. The code is loaded into the
52 script engine using load(). Functions declared in the code can be
53 called using call().
54
55 The script provides scriptEngine() provides feedback to the application
56 through signals. The most important signal is the error() signal.
57 Direct access to the QAxScriptEngine is provided through the
58 scriptEngine() function.
59
60 Warning: This class is not available with the bcc5.5 and MingW
61 compilers.
62
63 Member Type Documentation
65 This FunctionFlags enum describes formatting for function
66 introspection.
67
68 QAxScript::FunctionNames - Only function names are returned.
69
70 QAxScript::FunctionSignatures - Returns the functions with signatures.
71
74 Constructs a QAxScript object called name and registers it with the
75 QAxScriptManager manager. This is usually done by the QAxScriptManager
76 class when loading a script.
77
78 A script should always have a name. A manager is necessary to allow the
79 script code to reference objects in the application. The manager takes
80 ownership of the object.
81
83 Destroys the object, releasing all allocated resources.
84
86 QVariant ( ), const QVariant & var2 = QVariant ( ), const QVariant &
87 var3 = QVariant ( ), const QVariant & var4 = QVariant ( ), const
88 QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant ( ),
89 const QVariant & var7 = QVariant ( ), const QVariant & var8 = QVariant
90 ( ) )
91 Calls function, passing the parameters var1, var1, var2, var3, var4,
92 var5, var6, var7 and var8 as arguments and returns the value returned
93 by the function, or an invalid QVariant if the function does not return
94 a value or when the function call failed.
95
96 See QAxScriptManager::call() for more information about how to call
97 script functions.
98
100 arguments )
101 This is an overloaded member function, provided for convenience. It
102 behaves essentially like the above function.
103
104 Calls function passing arguments as parameters, and returns the result.
105 Returns when the script's execution has finished.
106
107 See QAxScriptManager::call() for more information about how to call
108 script functions.
109
111 This signal is emitted when a script engine has started executing code.
112
114 sourcePosition, const QString & sourceText ) [signal]
115 This signal is emitted when an execution error occured while running a
116 script.
117
118 code, description, sourcePosition and sourceText contain information
119 about the execution error.
120
122 This signal is emitted when a script engine has finished executing
123 code.
124
126 This is an overloaded member function, provided for convenience. It
127 behaves essentially like the above function.
128
129 result contains the script's result. This will be an invalid QVariant
130 if the script has no return value.
131
133 description, const QString & help ) [signal]
134 This is an overloaded member function, provided for convenience. It
135 behaves essentially like the above function.
136
137 code, source, description and help contain exception information when
138 the script terminated.
139
141
142 Returns a list of all the functions in this script if the respective
143 script engine supports introspection; otherwise returns an empty list.
144 The functions are either provided with full prototypes or only as
145 names, depending on the value of flags.
146
147 See also QAxScriptEngine::hasIntrospection().
148
150 QString::null )
151 Loads the script source code written in language language into the
152 script engine. Returns TRUE if code was successfully entered into the
153 script engine; otherwise returns FALSE.
154
155 If language is empty (the default) it will be determined heuristically.
156 If code contains the string End Sub it will be interpreted as VBScript,
157 otherwise as JScript. Additional scripting languages can be registered
158 using QAxScript::registerEngine().
159
160 This function can only be called once for each QAxScript object, which
161 is done automatically when using QAxScriptManager::load().
162
164 Returns the script's code, or the null-string if no code has been
165 loaded yet.
166
167 See also load().
168
170 Returns a pointer to the script engine.
171
172 You can use the object returned to connect signals to the script
173 functions, or to access the script engine directly.
174
176 Returns the name of the script.
177
179 This signal is emitted when a script engine changes state. state can
180 be any value in the QAxScriptEngineState enumeration.
181
182
184 http://doc.trolltech.com/qaxscript.html
185 http://www.trolltech.com/faq/tech.html
186
188 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
189 license file included in the distribution for a complete license
190 statement.
191
193 Generated automatically from the source code.
194
196 If you find a bug in Qt, please report it as described in
197 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
198 help you. Thank you.
199
200 The definitive Qt documentation is provided in HTML format; it is
201 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
202 web browser. This man page is provided as a convenience for those users
203 who prefer man pages, although this format is not officially supported
204 by Trolltech.
205
206 If you find errors in this manual page, please report them to qt-
207 bugs@trolltech.com. Please include the name of the manual page
208 (qaxscript.3qt) and the Qt version (3.3.8).
209
210
211
212Trolltech AS 2 February 2007 QAxScript(3qt)