You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
562 lines
25 KiB
562 lines
25 KiB
14 years ago
|
'\" t
|
||
|
.TH QAxBase 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
||
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
||
|
.\" license file included in the distribution for a complete license
|
||
|
.\" statement.
|
||
|
.\"
|
||
|
.ad l
|
||
|
.nh
|
||
|
.SH NAME
|
||
|
QAxBase \- Abstract class that provides an API to initalize and access a COM object
|
||
|
.SH SYNOPSIS
|
||
|
This class is part of the \fBQt ActiveQt Extension\fR.
|
||
|
.PP
|
||
|
\fC#include <qaxbase.h>\fR
|
||
|
.PP
|
||
|
Inherited by QAxObject and QAxWidget.
|
||
|
.PP
|
||
|
.SS "Public Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "\fBQAxBase\fR ( IUnknown * iface = 0 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual \fB~QAxBase\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBcontrol\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "long \fBqueryInterface\fR ( const QUuid & uuid, void ** iface ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QVariant \fBdynamicCall\fR ( const QCString & 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 ( ) )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QVariant \fBdynamicCall\fR ( const QCString & function, QValueList<QVariant> & vars )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QAxObject * \fBquerySubObject\fR ( const QCString & name, 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 ( ) )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "PropertyBag \fBpropertyBag\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetPropertyBag\fR ( const PropertyBag & bag )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBgenerateDocumentation\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual bool \fBpropertyWritable\fR ( const char * prop ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetPropertyWritable\fR ( const char * prop, bool ok )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisNull\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QVariant \fBasVariant\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "enum \fBPropertyBag\fR { }"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBclear\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBsetControl\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBdisableMetaObject\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBdisableClassInfo\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBdisableEventSink\fR ()"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Signals"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "void \fBsignal\fR ( const QString & name, int argc, void * argv )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBpropertyChanged\fR ( const QString & name )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBexception\fR ( int code, const QString & source, const QString & desc, const QString & help )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Properties"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "QString \fBcontrol\fR - the name of the COM object wrapped by this QAxBase object"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Protected Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "virtual bool \fBinitialize\fR ( IUnknown ** ptr )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBinitializeRemote\fR ( IUnknown ** ptr )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBinitializeLicensed\fR ( IUnknown ** ptr )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBinitializeActive\fR ( IUnknown ** ptr )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SH DESCRIPTION
|
||
|
This class is defined in the \fBQt ActiveQt Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main Qt API.
|
||
|
.PP
|
||
|
The QAxBase class is an abstract class that provides an API to initalize and access a COM object.
|
||
|
.PP
|
||
|
QAxBase is an abstract class that cannot be used directly, and is instantiated through the subclasses QAxObject and QAxWidget. This class provides the API to access the COM object directly through its IUnknown implementation. If the COM object implements the IDispatch interface, the properties and methods of that object become available as Qt properties and slots.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
connect( buttonBack, SIGNAL(clicked()), webBrowser, SLOT(GoBack()) );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Properties exposed by the object's IDispatch implementation can be read and written through the property system provided by the Qt Object Model (both subclasses are QObjects, so you can use setProperty() and property() as with QObject). Properties with multiple parameters are not supported.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
activeX->setProperty( "text", "some text" );
|
||
|
.br
|
||
|
int value = activeX->property( "value" );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Write-functions for properties and other methods exposed by the object's IDispatch implementation can be called directly using dynamicCall(), or indirectly as slots connected to a signal.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
webBrowser->dynamicCall( "GoHome()" );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Outgoing events supported by the COM object are emitted as standard Qt signals.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
connect( webBrowser, SIGNAL(TitleChanged(const QString&)),
|
||
|
.br
|
||
|
this, SLOT(setCaption(const QString&)) );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
QAxBase transparently converts between COM data types and the equivalent Qt data types. Some COM types have no equivalent Qt data structure.
|
||
|
.PP
|
||
|
Supported COM datatypes are listed in the first column of following table. The second column is the Qt type that can be used with the QObject property functions. The third column is the Qt type that is used in the prototype of generated signals and slots for in-parameters, and the last column is the Qt type that is used in the prototype of signals and slots for out-parameters. <center>.nf
|
||
|
.TS
|
||
|
l - l. COM type Qt property in-parameter out-parameter VARIANT_BOOL bool bool bool& BSTR QString const QString& QString& char, short, int, long int int int& uchar, ushort, uint, ulong uint uint uint& float, double double double double& DATE QDateTime const QDateTime& QDateTime& CY Q_LLONG Q_LLONG Q_LLONG& OLE_COLOR QColor const QColor& QColor& SAFEARRAY(VARIANT) QValueList<QVariant> const QValueList<QVariant>& QValueList<QVariant>& SAFEARRAY(BYTE) QByteArray const QByteArray& QByteArray& SAFEARRAY(BSTR) QStringList const QStringList& QStringList& VARIANT type-dependent const QVariant& QVariant& IFontDisp* QFont const QFont& QFont& IPictureDisp* QPixmap const QPixmap& QPixmap& IDispatch* QAxObject* (read-only) QAxBase::asVariant() QAxObject* (return value) IUnknown* QAxObject* (read-only) QAxBase::asVariant() QAxObject* (return value) SCODE, DECIMAL \fIunsupported\fR \fIunsupported\fR
|
||
|
.TE
|
||
|
.fi
|
||
|
</center>
|
||
|
.PP
|
||
|
Supported are also enumerations, and typedefs to supported types.
|
||
|
.PP
|
||
|
To call the methods of a COM interface described by the following IDL
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
dispinterface IControl
|
||
|
.br
|
||
|
{
|
||
|
.br
|
||
|
properties:
|
||
|
.br
|
||
|
[id(1)] BSTR text;
|
||
|
.br
|
||
|
[id(2)] IFontDisp *font;
|
||
|
.br
|
||
|
.br
|
||
|
methods:
|
||
|
.br
|
||
|
[id(6)] void showColumn( [in] int i );
|
||
|
.br
|
||
|
[id(3)] bool addColumn( [in] BSTR t );
|
||
|
.br
|
||
|
[id(4)] int fillList( [in, out] SAFEARRAY(VARIANT) *list );
|
||
|
.br
|
||
|
[id(5)] IDispatch *item( [in] int i );
|
||
|
.br
|
||
|
};
|
||
|
.br
|
||
|
.fi
|
||
|
use the QAxBase API like this:
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QAxObject object( "<CLSID>" );
|
||
|
.br
|
||
|
.br
|
||
|
QString text = object.property( "text" ).toString();
|
||
|
.br
|
||
|
object.setProperty( "font", QFont( "Times New Roman", 12 ) );
|
||
|
.br
|
||
|
.br
|
||
|
connect( this, SIGNAL(clicked(int)), &object, SLOT(showColumn(int)) );
|
||
|
.br
|
||
|
bool ok = object.dynamicCall( "addColumn(const QString&)", "Column 1" ).toBool();
|
||
|
.br
|
||
|
.br
|
||
|
QValueList<QVariant> varlist;
|
||
|
.br
|
||
|
QValueList<QVariant> parameters;
|
||
|
.br
|
||
|
parameters << QVariant( varlist );
|
||
|
.br
|
||
|
int n = object.dynamicCall( "fillList(QValueList<QVariant>&)", parameters ).toInt();
|
||
|
.br
|
||
|
.br
|
||
|
QAxObject *item = object.querySubItem( "item(int)", 5 );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Note that the QValueList the object should fill has to be provided as an element in the parameter list of QVariants.
|
||
|
.PP
|
||
|
If you need to access properties or pass parameters of unsupported datatypes you must access the COM object directly through its IDispatch implementation or other interfaces. Those interfaces can be retrieved through queryInterface().
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
IUnknown *iface = 0;
|
||
|
.br
|
||
|
activeX->queryInterface( IID_IUnknown, (void**)&iface );
|
||
|
.br
|
||
|
if ( iface ) {
|
||
|
.br
|
||
|
// use the interface
|
||
|
.br
|
||
|
iface->Release();
|
||
|
.br
|
||
|
}
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
To get the definition of the COM interfaces you will have to use the header files provided with the component you want to use. Some compilers can also import type libraries using the #import compiler directive. See the component documentation to find out which type libraries you have to import, and how to use them.
|
||
|
.PP
|
||
|
If you need to react to events that pass parameters of unsupported datatypes you can use the generic signal that delivers the event data as provided by the COM event.
|
||
|
.SS "Member Type Documentation"
|
||
|
.SH "QAxBase::PropertyBag"
|
||
|
A QMap<QString,QVariant> that can store properties as name:value pairs.
|
||
|
.SH MEMBER FUNCTION DOCUMENTATION
|
||
|
.SH "QAxBase::QAxBase ( IUnknown * iface = 0 )"
|
||
|
Creates a QAxBase object that wraps the COM object \fIiface\fR. If \fIiface\fR is 0 (the default), use setControl() to instantiate a COM object.
|
||
|
.SH "QAxBase::~QAxBase ()\fC [virtual]\fR"
|
||
|
Shuts down the COM object and destroys the QAxBase object.
|
||
|
.PP
|
||
|
See also clear().
|
||
|
.SH "QVariant QAxBase::asVariant () const"
|
||
|
Returns a QVariant that wraps the COM object. The variant can then be used as a parameter in e.g. dynamicCall().
|
||
|
.SH "void QAxBase::clear ()\fC [virtual]\fR"
|
||
|
Disconnects and destroys the COM object.
|
||
|
.PP
|
||
|
If you reimplement this function you must also reimplement the destructor to call clear(), and call this implementation at the end of your clear() function.
|
||
|
.SH "QString QAxBase::control () const"
|
||
|
Returns the name of the COM object wrapped by this QAxBase object. See the "control" property for details.
|
||
|
.SH "void QAxBase::disableClassInfo ()"
|
||
|
Disables the class info generation for this ActiveX container. If you don't require any class information about the ActiveX control use this function to speed up the meta object generation.
|
||
|
.PP
|
||
|
Note that this function must be called immediately after construction of the object (without passing an object identifier), and before calling QAxWidget->setControl().
|
||
|
.SH "void QAxBase::disableEventSink ()"
|
||
|
Disables the event sink implementation for this ActiveX container. If you don't intend to listen to the ActiveX control's events use this function to speed up the meta object generation.
|
||
|
.PP
|
||
|
Some ActiveX controls might be unstable when connected to an event sink. To get OLE events you must use standard COM methods to register your own event sink. Use queryInterface() to get access to the raw COM object.
|
||
|
.PP
|
||
|
Note that this function should be called immediately after construction of the object (without passing an object identifier), and before calling QAxWidget->setControl().
|
||
|
.SH "void QAxBase::disableMetaObject ()"
|
||
|
Disables the meta object generation for this ActiveX container. This also disables the event sink and class info generation. If you don't intend to use the Qt meta object implementation call this function to speed up the meta object generation.
|
||
|
.PP
|
||
|
Some ActiveX controls might be unstable when used with OLE automation. Use standard COM methods to use those controls through the COM interfaces provided by queryInterface().
|
||
|
.PP
|
||
|
Note that this function must be called immediately after construction of the object (without passing an object identifier), and before calling QAxWidget->setControl().
|
||
|
.SH "QVariant QAxBase::dynamicCall ( const QCString & 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 the COM object's method \fIfunction\fR, passing the parameters \fIvar1\fR, \fIvar1\fR, \fIvar2\fR, \fIvar3\fR, \fIvar4\fR, \fIvar5\fR, \fIvar6\fR, \fIvar7\fR and \fIvar8\fR, and returns the value returned by the method, or an invalid QVariant if the method does not return a value or when the function call failed.
|
||
|
.PP
|
||
|
If \fIfunction\fR is a method of the object the string must be provided as the full prototype, for example as it would be written in a QObject::connect() call.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
activeX->dynamicCall( "Navigate(const QString&)", "www.trolltech.com" );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Alternatively a function can be called passing the parameters embedded in the string, e.g. above function can also be invoked using
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
activeX->dynamicCall("Navigate(\\"www.trolltech.com\\");
|
||
|
.br
|
||
|
.fi
|
||
|
All parameters are passed as strings; it depends on the control whether they are interpreted correctly, and is slower than using the prototype with correctly typed parameters.
|
||
|
.PP
|
||
|
If \fIfunction\fR is a property the string has to be the name of the property. The property setter is called when \fIvar1\fR is a valid QVariant, otherwise the getter is called.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
activeX->dynamicCall( "Value", 5 );
|
||
|
.br
|
||
|
QString text = activeX->dynamicCall( "Text" ).toString();
|
||
|
.br
|
||
|
.fi
|
||
|
Note that it is faster to get and set properties using QObject::property() and QObject::setProperty().
|
||
|
.PP
|
||
|
It is only possible to call functions through dynamicCall() that have parameters or return values of datatypes supported by QVariant. See the QAxBase class documentation for a list of supported and unsupported datatypes. If you want to call functions that have unsupported datatypes in the parameter list, use queryInterface() to retrieve the appropriate COM interface, and use the function directly.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
IWebBrowser2 *webBrowser = 0;
|
||
|
.br
|
||
|
activeX->queryInterface( IID_IWebBrowser2, (void**)&webBrowser );
|
||
|
.br
|
||
|
if ( webBrowser ) {
|
||
|
.br
|
||
|
webBrowser->Navigate2( pvarURL );
|
||
|
.br
|
||
|
webBrowser->Release();
|
||
|
.br
|
||
|
}
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
This is also more efficient.
|
||
|
.PP
|
||
|
Example: qutlook/centralwidget.cpp.
|
||
|
.SH "QVariant QAxBase::dynamicCall ( const QCString & function, QValueList<QVariant> & vars )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Calls the COM object's method \fIfunction\fR, passing the parameters in \fIvars\fR, and returns the value returned by the method. If the method does not return a value or when the function call failed this function returns an invalid QVariant object.
|
||
|
.PP
|
||
|
The QVariant objects in \fIvars\fR are updated when the method has out-parameters.
|
||
|
.SH "void QAxBase::exception ( int code, const QString & source, const QString & desc, const QString & help )\fC [signal]\fR"
|
||
|
This signal is emitted when the COM object throws an exception while called using the OLE automation interface IDispatch. \fIcode\fR, \fIsource\fR, \fIdesc\fR and \fIhelp\fR provide information about the exception as provided by the COM server and can be used to provide useful feedback to the end user. \fIhelp\fR includes the help file, and the help context ID in brackets, e.g. "filename [id]".
|
||
|
.SH "QString QAxBase::generateDocumentation ()"
|
||
|
Returns a rich text string with documentation for the wrapped COM object. Dump the string to an HTML-file, or use it in e.g. a QTextBrowser widget.
|
||
|
.SH "bool QAxBase::initialize ( IUnknown ** ptr )\fC [virtual protected]\fR"
|
||
|
This virtual function is called by setControl() and creates the requested COM object. \fIptr\fR is set to the object's IUnknown implementation. The function returns TRUE if the object initialization succeeded; otherwise the function returns FALSE.
|
||
|
.PP
|
||
|
The default implementation interprets the string returned by control(), and calls initializeRemote(), initializeLicensed() or initializeActive() if the string matches the respective patterns. If no pattern is matched, or if remote or licensed initialization fails, CoCreateInstance is used directly to create the object.
|
||
|
.PP
|
||
|
See the control property documentation for details about supported patterns.
|
||
|
.PP
|
||
|
The interface returned in \fIptr\fR must be referenced exactly once when this function returns. The interface provided by e.g. CoCreateInstance is already referenced, and there is no need to reference it again.
|
||
|
.SH "bool QAxBase::initializeActive ( IUnknown ** ptr )\fC [protected]\fR"
|
||
|
Returns an active instance running on the current machine, and returns the IUnknown interface to the running object in \fIptr\fR. This function returns TRUE if successful, otherwise returns FALSE.
|
||
|
.PP
|
||
|
This function is called by initialize() if the control string contains the substring "}&".
|
||
|
.PP
|
||
|
See also initialize().
|
||
|
.SH "bool QAxBase::initializeLicensed ( IUnknown ** ptr )\fC [protected]\fR"
|
||
|
Creates an instance of a licensed control, and returns the IUnknown interface to the object in \fIptr\fR. This functions returns TRUE if successful, otherwise returns FALSE.
|
||
|
.PP
|
||
|
This function is called by initialize() if the control string contains the substring "}:". The license key needs to follow this substring.
|
||
|
.PP
|
||
|
See also initialize().
|
||
|
.SH "bool QAxBase::initializeRemote ( IUnknown ** ptr )\fC [protected]\fR"
|
||
|
Creates the instance on a remote server, and returns the IUnknown interface to the object in \fIptr\fR. This function returns TRUE if successful, otherwise returns FALSE.
|
||
|
.PP
|
||
|
This function is called by initialize() if the control string contains the substring "/{". The information about the remote machine needs to be provided in front of the substring.
|
||
|
.PP
|
||
|
See also initialize().
|
||
|
.SH "bool QAxBase::isNull () const"
|
||
|
Returns TRUE if there is no COM object loaded by this wrapper; otherwise return FALSE.
|
||
|
.PP
|
||
|
See also control.
|
||
|
.SH "PropertyBag QAxBase::propertyBag () const"
|
||
|
Returns a name:value map of all the properties exposed by the COM object.
|
||
|
.PP
|
||
|
This is more efficient than getting multiple properties individually if the COM object supports property bags.
|
||
|
.PP
|
||
|
\fBWarning:\fR It is not guaranteed that the property bag implementation of the COM object returns all properties, or that the properties returned are the same as those available through the IDispatch interface.
|
||
|
.SH "void QAxBase::propertyChanged ( const QString & name )\fC [signal]\fR"
|
||
|
If the COM object supports property notification, this signal gets emitted when the property called \fIname\fR is changed.
|
||
|
.SH "bool QAxBase::propertyWritable ( const char * prop ) const\fC [virtual]\fR"
|
||
|
Returns TRUE if the property \fIprop\fR is writable; otherwise returns FALSE. By default, all properties are writable.
|
||
|
.PP
|
||
|
\fBWarning:\fR Depending on the control implementation this setting might be ignored for some properties.
|
||
|
.PP
|
||
|
See also setPropertyWritable() and propertyChanged().
|
||
|
.SH "long QAxBase::queryInterface ( const QUuid & uuid, void ** iface ) const"
|
||
|
Requests the interface \fIuuid\fR from the COM object and sets the value of \fIiface\fR to the provided interface, or to 0 if the requested interface could not be provided.
|
||
|
.PP
|
||
|
Returns the result of the QueryInterface implementation of the COM object.
|
||
|
.PP
|
||
|
See also control.
|
||
|
.SH "QAxObject * QAxBase::querySubObject ( const QCString & name, 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 ( ) )"
|
||
|
Returns a pointer to a QAxObject wrapping the COM object provided by the method or property \fIname\fR, passing passing the parameters \fIvar1\fR, \fIvar1\fR, \fIvar2\fR, \fIvar3\fR, \fIvar4\fR, \fIvar5\fR, \fIvar6\fR, \fIvar7\fR and \fIvar8\fR.
|
||
|
.PP
|
||
|
If \fIname\fR is provided by a method the string must include the full function prototype.
|
||
|
.PP
|
||
|
If \fIname\fR is a property the string must be the name of the property, and \fIvar1\fR, ... \fIvar8\fR are ignored.
|
||
|
.PP
|
||
|
The returned QAxObject is a child of this object (which is either of type QAxObject or QAxWidget), and is deleted when this object is deleted. It is however safe to delete the returned object yourself, and you should do so when you iterate over lists of subobjects.
|
||
|
.PP
|
||
|
COM enabled applications usually have an object model publishing certain elements of the application as dispatch interfaces. Use this method to navigate the hierarchy of the object model, e.g.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QAxWidget outlook( "Outlook.Application" );
|
||
|
.br
|
||
|
QAxObject *session = outlook.querySubObject( "Session" );
|
||
|
.br
|
||
|
if ( session ) {
|
||
|
.br
|
||
|
QAxObject *defFolder = session->querySubObject(
|
||
|
.br
|
||
|
"GetDefaultFolder(OlDefaultFolders)",
|
||
|
.br
|
||
|
"olFolderContacts" );
|
||
|
.br
|
||
|
//...
|
||
|
.br
|
||
|
}
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Example: qutlook/centralwidget.cpp.
|
||
|
.SH "bool QAxBase::setControl ( const QString & )"
|
||
|
Sets the name of the COM object wrapped by this QAxBase object. See the "control" property for details.
|
||
|
.SH "void QAxBase::setPropertyBag ( const PropertyBag & bag )"
|
||
|
Sets the properties of the COM object to the corresponding values in \fIbag\fR.
|
||
|
.PP
|
||
|
\fBWarning:\fR You should only set property bags that have been returned by the propertyBag function, as it cannot be guaranteed that the property bag implementation of the COM object supports the same properties that are available through the IDispatch interface.
|
||
|
.PP
|
||
|
See also propertyBag().
|
||
|
.SH "void QAxBase::setPropertyWritable ( const char * prop, bool ok )\fC [virtual]\fR"
|
||
|
Sets the property \fIprop\fR to writable if \fIok\fR is TRUE, otherwise sets \fIprop\fR to be read-only. By default, all properties are writable.
|
||
|
.PP
|
||
|
\fBWarning:\fR Depending on the control implementation this setting might be ignored for some properties.
|
||
|
.PP
|
||
|
See also propertyWritable() and propertyChanged().
|
||
|
.SH "void QAxBase::signal ( const QString & name, int argc, void * argv )\fC [signal]\fR"
|
||
|
This generic signal gets emitted when the COM object issues the event \fIname\fR. \fIargc\fR is the number of parameters provided by the event (DISPPARAMS.cArgs), and \fIargv\fR is the pointer to the parameter values (DISPPARAMS.rgvarg). Note that the order of parameter values is turned around, ie. the last element of the array is the first parameter in the function.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
void Receiver::slot( const QString &name, int argc, void *argv )
|
||
|
.br
|
||
|
{
|
||
|
.br
|
||
|
VARIANTARG *params = (VARIANTARG*)argv;
|
||
|
.br
|
||
|
if ( name.startsWith( "BeforeNavigate2(" ) ) {
|
||
|
.br
|
||
|
IDispatch *pDisp = params[argc-1].pdispVal;
|
||
|
.br
|
||
|
VARIANTARG URL = *params[argc-2].pvarVal;
|
||
|
.br
|
||
|
VARIANTARG Flags = *params[argc-3].pvarVal;
|
||
|
.br
|
||
|
VARIANTARG TargetFrameName = *params[argc-4].pvarVal;
|
||
|
.br
|
||
|
VARIANTARG PostData = *params[argc-5].pvarVal;
|
||
|
.br
|
||
|
VARIANTARG Headers = *params[argc-6].pvarVal;
|
||
|
.br
|
||
|
bool *Cancel = params[argc-7].pboolVal;
|
||
|
.br
|
||
|
}
|
||
|
.br
|
||
|
}
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
Use this signal if the event has parameters of unsupported data types. Otherwise, connect directly to the signal \fIname\fR.
|
||
|
.SS "Property Documentation"
|
||
|
.SH "QString control"
|
||
|
This property holds the name of the COM object wrapped by this QAxBase object.
|
||
|
.PP
|
||
|
Setting this property initilializes the COM object. Any COM object previously set is shut down.
|
||
|
.PP
|
||
|
The most efficient way to set this property is by using the registered component's UUID, e.g.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
ctrl->setControl( "{8E27C92B-1264-101C-8A2F-040224009C02}" );
|
||
|
.br
|
||
|
.fi
|
||
|
The second fastest way is to use the registered control's class name (with or without version number), e.g.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
ctrl->setControl( "MSCal.Calendar" );
|
||
|
.br
|
||
|
.fi
|
||
|
The slowest, but easiest way to use is to use the control's full name, e.g.
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
ctrl->setControl( "Calendar Control 9.0" );
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
If the component's UUID is used the following patterns can be used to initialize the control on a remote machine, to initialize a licensed control or to connect to a running object:
|
||
|
.TP
|
||
|
To initialize the control on a different machine use the following pattern:
|
||
|
.IP
|
||
|
.nf
|
||
|
.br
|
||
|
<domain/username>:<password>@server/{8E27C92B-1264-101C-8A2F-040224009C02}
|
||
|
.br
|
||
|
.fi
|
||
|
.TP
|
||
|
To initialize a licensed control use the following pattern:
|
||
|
.IP
|
||
|
.nf
|
||
|
.br
|
||
|
{8E27C92B-1264-101C-8A2F-040224009C02}:<LicenseKey>
|
||
|
.br
|
||
|
.fi
|
||
|
.TP
|
||
|
To connect to an already running object use the following pattern:
|
||
|
.IP
|
||
|
.nf
|
||
|
.br
|
||
|
{8E27C92B-1264-101C-8A2F-040224009C02}&
|
||
|
.br
|
||
|
.fi
|
||
|
The first two patterns can be combined, e.g. to initialize a licensed control on a remote machine:
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
ctrl->setControl("DOMAIN/user:password@server/{8E27C92B-1264-101C-8A2F-040224009C02}:LicenseKey");
|
||
|
.br
|
||
|
.fi
|
||
|
.PP
|
||
|
The control's read function always returns the control's UUID, if provided including the license key, and the name of the server, but not including the username, the domain or the password.
|
||
|
.PP
|
||
|
Set this property's value with setControl() and get this property's value with control().
|
||
|
|
||
|
.SH "SEE ALSO"
|
||
|
.BR http://doc.trolltech.com/qaxbase.html
|
||
|
.BR http://www.trolltech.com/faq/tech.html
|
||
|
.SH COPYRIGHT
|
||
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
||
|
license file included in the distribution for a complete license
|
||
|
statement.
|
||
|
.SH AUTHOR
|
||
|
Generated automatically from the source code.
|
||
|
.SH BUGS
|
||
|
If you find a bug in Qt, please report it as described in
|
||
|
.BR http://doc.trolltech.com/bughowto.html .
|
||
|
Good bug reports help us to help you. Thank you.
|
||
|
.P
|
||
|
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.
|
||
|
.P
|
||
|
If you find errors in this manual page, please report them to
|
||
|
.BR qt-bugs@trolltech.com .
|
||
|
Please include the name of the manual page (qaxbase.3qt) and the Qt
|
||
|
version (3.3.8).
|