QAxScriptManager(3qt)
๐ธ NAME ๐ธ
QAxScriptManager โ the bridge between application objects and script code ๐ (yes bestie, this is the QAxScriptManager(3qt) manual page, and it's about to be your fave)
โจ SYNOPSIS โจ
This class is part of the Qt ActiveQt Extension ๐ซถ
#include <qaxscript.h>
Inherits QObject.
๐ Public Members
QAxScriptManager ( QObject * parent = 0, const char * name = 0 )~QAxScriptManager ()void addObject ( QAxBase * object )void addObject ( QObject * object )QStringList functions ( QAxScript::FunctionFlags flags = QAxScript::FunctionNames ) constQStringList scriptNames () constQAxScript * script ( const QString & name ) constQAxScript * load ( const QString & code, const QString & name, const QString & language )QAxScript * load ( const QString & file, const QString & name )QVariant call ( const QString & function, const QVariant & var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ), const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 = QVariant ( ) )QVariant call ( const QString & function, QValueList<QVariant> & arguments )
๐ Signals
void error ( QAxScript * script, int code, const QString & description, int sourcePosition, const QString & sourceText )
๐ Static Public Members
bool registerEngine ( const QString & name, const QString & extension, const QString & code = QString ( ) )QString scriptFileFilter ()
๐ DESCRIPTION ๐
So first thing's first, bestie: this class is defined in the Qt ActiveQt Extension, which lives in the qt/extensions directory. It is not included in the main Qt API. Just so we're clear. ๐ซถ
The QAxScriptManager class provides a bridge between application objects and script code. That's the whole vibe. That's the assignment. โจ
Here's the tea ๐ โ QAxScriptManager acts as a bridge between the COM objects embedded in the Qt application through QAxObject or QAxWidget, and the scripting languages available through the Windows Script technologies, which are usually JScript and VBScript.
The move is this: create one QAxScriptManager for each separate document in your application, then add the COM objects your scripts need to access using addObject(). After that you load() the script sources and invoke the functions using call(). Iconic pipeline, honestly. ๐
โ ๏ธ Warning: This class is not available with thebcc5.5andMingWcompilers. Not me gatekeeping compilers ๐ญ
๐ฆ MEMBER FUNCTION DOCUMENTATION ๐ฆ
QAxScriptManager::QAxScriptManager ( QObject * parent = 0, const char * name = 0 )
Creates a QAxScriptManager object ๐ parent and name get passed on to the QObject constructor.
And yeah, the usual ritual: it is usual to create one QAxScriptManager for each document in an application. One per document, no cap. ๐
QAxScriptManager::~QAxScriptManager ()
Destroys the objects, releasing all allocated resources. Clean up after yourself, queen ๐
void QAxScriptManager::addObject ( QAxBase * object )
Adds object to the manager. Scripts handled by this manager can access the object in the code using the object's name property.
๐ฅ Real talk: you must add all the necessary objects before loading any scripts. Order matters, bestie.
void QAxScriptManager::addObject ( QObject * object )
This is an overloaded member function, provided for convenience ๐ซถ It behaves essentially like the above function.
Adds a generic COM wrapper for object to the manager. object must be exposed as a COM object using the functionality provided by the QAxServer module.. Applications using this function you must link against the qaxserver library. (Yes, that double period is in the source, I'm just the messenger ๐ญ)
QVariant QAxScriptManager::call ( const QString & function, const QVariant & var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ), const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 = QVariant ( ) )
Calls function, passing the parameters var1, var1, var2, var3, var4, var5, var6, var7 and var8 as arguments and returns the value returned by the function, or an invalid QVariant if the function does not return a value or when the function call failed. The call returns when the script's execution has finished. โณ
In most script engines the only supported parameter type is "const QVariant&". For example, to call a JavaScript function
function setNumber(number)
{
n = number;
}
use
QValueList args;
args << 5;
script->call("setNumber(const QVariant&)", args);
As with dynamicCall the parameters can directly be embedded in the function string.
script->call("setNumber(5)");
However, this is slower. ๐ข
Functions provided by script engines that don't support introspection are not available and must be called directly using QAxScript::call() on the respective script object.
๐ Note that calling this function can be significantely slower than usingcall()on the respectiveQAxScriptdirectly.
QVariant QAxScriptManager::call ( const QString & function, QValueList<QVariant> & arguments )
This is an overloaded member function, provided for convenience ๐ It behaves essentially like the above function.
Calls function passing arguments as parameters, and returns the result. Returns when the script's execution has finished. โจ
void QAxScriptManager::error ( QAxScript * script, int code, const QString & description, int sourcePosition, const QString & sourceText ) [signal]
This signal is emitted when an execution error occured while running script. ๐ญ
code, description, sourcePosition and sourceText contain information about the execution error. Everything you need to figure out what went wrong, bestie ๐ซถ
QStringList QAxScriptManager::functions ( QAxScript::FunctionFlags flags = QAxScript::FunctionNames ) const
Returns a list with all the functions that are available. ๐ Functions provided by script engines that don't support introspection are not included in the list. The functions are either provided with full prototypes or only as names, depending on the value of flags. Your choice, your vibe. ๐
QAxScript * QAxScriptManager::load ( const QString & code, const QString & name, const QString & language )
Loads the script source code using the script engine for language. The script can later be referred to using its name which should not be empty. ๐
The function returns a pointer to the script for the given code if the code was loaded successfully; otherwise it returns 0. ๐
If language is empty it will be determined heuristically. If code contains the string "End Sub" it will be interpreted as VBScript, otherwise as JScript. Additional script engines can be registered using registerEngine(). ๐ฎ
โ ๏ธ You must add all the objects necessary (usingaddObject()) before loading any scripts. Ifcodedeclares a function that is already available (no matter in which language) the first function is overloaded and can no longer be called viacall(); but it will still be available by calling its script directly. ๐ซ
See also addObject(), scriptNames(), and functions().
QAxScript * QAxScriptManager::load ( const QString & file, const QString & name )
This is an overloaded member function, provided for convenience ๐ It behaves essentially like the above function.
Loads the source code from the file. The script can later be referred to using its name which should not be empty. ๐
The function returns a pointer to the script engine for the code in file if file was loaded successfully; otherwise it returns 0. ๐
The script engine used is determined from the file's extension. By default ".js" files are interpreted as JScript files, and ".vbs" and ".dsm" files are interpreted as VBScript. Additional script engines can be registered using registerEngine(). ๐ฎ
bool QAxScriptManager::registerEngine ( const QString & name, const QString & extension, const QString & code = QString ( ) ) [static]
Registers the script engine called name and returns TRUE if the engine was found; otherwise does nothing and returns FALSE. โ
โ
The script engine will be used when loading files with the given extension, or when loading source code that contains the string code.
QAxScript * QAxScriptManager::script ( const QString & name ) const
Returns the script called name. ๐
You can use the returned pointer to call functions directly through QAxScript::call(), to access the script engine directly, or to delete and thus unload the script. So much power in one pointer, honestly ๐
QString QAxScriptManager::scriptFileFilter () [static]
Returns a file filter listing all the supported script languages. This filter string is convenient for use with QFileDialog. ๐๏ธ
QStringList QAxScriptManager::scriptNames () const
Returns a list with the names of all the scripts. ๐
๐ SEE ALSO ๐
๐ COPYRIGHT ๐
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
๐ง AUTHOR ๐ง
Generated automatically from the source code. (No human author to thank, bestie, it just โจappearedโจ)
๐ BUGS ๐
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. ๐ซถ
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. (iykyk ๐ญ)
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qaxscriptmanager.3qt) and the Qt version (3.3.8).
okay that's the whole page bestie, no notes ๐
this was QAxScriptManager(3qt) from Trolltech AS, dated 2 February 2007, and it ate fr fr. go forth and bridge your objects to your scripts ๐ธโจ๐ฆ
๐ฆ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 ยท QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 ยท QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms