1QAxObject(3qt)                                                  QAxObject(3qt)
2
3
4

NAME

6       QAxObject - QObject that wraps a COM object
7

SYNOPSIS

9       This class is part of the Qt ActiveQt Extension.
10
11       #include <qaxobject.h>
12
13       Inherits QObject and QAxBase.
14
15       Inherited by QAxScriptEngine.
16
17   Public Members
18       QAxObject ( QObject * parent = 0, const char * name = 0 )
19       QAxObject ( const QString & c, QObject * parent = 0, const char * name
20           = 0 )
21       QAxObject ( IUnknown * iface, QObject * parent = 0, const char * name =
22           0 )
23       ~QAxObject ()
24
25   Important Inherited Members
26       QVariant dynamicCall ( const QCString & function, const QVariant & var1
27           = QVariant ( ), const QVariant & var2 = QVariant ( ), const
28           QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant (
29           ), const QVariant & var5 = QVariant ( ), const QVariant & var6 =
30           QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant
31           & var8 = QVariant ( ) )
32       QVariant dynamicCall ( const QCString & function, QValueList<QVariant>
33           & vars )
34       QAxObject * querySubObject ( const QCString & name, const QVariant &
35           var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
36           QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant (
37           ), const QVariant & var5 = QVariant ( ), const QVariant & var6 =
38           QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant
39           & var8 = QVariant ( ) )
40

DESCRIPTION

42       This class is defined in the Qt ActiveQt Extension, which can be found
43       in the qt/extensions directory. It is not included in the main Qt API.
44
45       The QAxObject class provides a QObject that wraps a COM object.
46
47       A QAxObject can be instantiated as an empty object, with the name of
48       the COM object it should wrap, or with a pointer to the IUnknown that
49       represents an existing COM object. If the COM object implements the
50       IDispatch interface, the properties, methods and events of that object
51       become available as Qt properties, slots and signals. The base class,
52       QAxBase, provides an API to access the COM object directly through the
53       IUnknown pointer.
54
55       QAxObject is a QObject and can be used as such, e.g. it can be
56       organized in an object hierarchy, receive events and connect to signals
57       and slots.
58
59       Warning: You can subclass QAxObject, but you cannot use the Q_OBJECT
60       macro in the subclass (the generated moc-file will not compile), so you
61       cannot add further signals, slots or properties. This limitation is due
62       to the metaobject information generated in runtime. To work around this
63       problem, aggregate the QAxObject as a member of the QObject subclass.
64

MEMBER FUNCTION DOCUMENTATION

QAxObject::QAxObject ( QObject * parent = 0, const char * name = 0 )

67       Creates an empty COM object and propagates parent and name to the
68       QObject constructor. To initialize the object, call setControl.
69

QAxObject::QAxObject ( const QString & c, QObject * parent = 0, const char *

71       name = 0 )
72       Creates a QAxObject that wraps the COM object c. parent and name are
73       propagated to the QWidget contructor.
74
75       See also control.
76

QAxObject::QAxObject ( IUnknown * iface, QObject * parent = 0, const char *

78       name = 0 )
79       Creates a QAxObject that wraps the COM object referenced by iface.
80       parent and name are propagated to the QObject contructor.
81

QAxObject::~QAxObject ()

83       Releases the COM object and destroys the QAxObject, cleaning up all
84       allocated resources.
85

QVariant QAxBase::dynamicCall ( const QCString & function, const QVariant &

87       var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
88       QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ),
89       const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant
90       ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 =
91       QVariant ( ) )
92       Calls the COM object's method function, passing the parameters var1,
93       var1, var2, var3, var4, var5, var6, var7 and var8, and returns the
94       value returned by the method, or an invalid QVariant if the method does
95       not return a value or when the function call failed.
96
97       If function is a method of the object the string must be provided as
98       the full prototype, for example as it would be written in a
99       QObject::connect() call.
100
101           activeX->dynamicCall( "Navigate(const QString&)", "www.trolltech.com" );
102
103       Alternatively a function can be called passing the parameters embedded
104       in the string, e.g. above function can also be invoked using
105
106           activeX->dynamicCall("Navigate(\"www.trolltech.com\");
107       All parameters are passed as strings; it depends on the control whether
108       they are interpreted correctly, and is slower than using the prototype
109       with correctly typed parameters.
110
111       If function is a property the string has to be the name of the
112       property. The property setter is called when var1 is a valid QVariant,
113       otherwise the getter is called.
114
115           activeX->dynamicCall( "Value", 5 );
116           QString text = activeX->dynamicCall( "Text" ).toString();
117       Note that it is faster to get and set properties using
118       QObject::property() and QObject::setProperty().
119
120       It is only possible to call functions through dynamicCall() that have
121       parameters or return values of datatypes supported by QVariant. See the
122       QAxBase class documentation for a list of supported and unsupported
123       datatypes. If you want to call functions that have unsupported
124       datatypes in the parameter list, use queryInterface() to retrieve the
125       appropriate COM interface, and use the function directly.
126
127           IWebBrowser2 *webBrowser = 0;
128           activeX->queryInterface( IID_IWebBrowser2, (void**)&webBrowser );
129           if ( webBrowser ) {
130               webBrowser->Navigate2( pvarURL );
131               webBrowser->Release();
132           }
133
134       This is also more efficient.
135
136       Example: qutlook/centralwidget.cpp.
137

QVariant QAxBase::dynamicCall ( const QCString & function,

139       QValueList<QVariant> & vars )
140       This is an overloaded member function, provided for convenience. It
141       behaves essentially like the above function.
142
143       Calls the COM object's method function, passing the parameters in vars,
144       and returns the value returned by the method. If the method does not
145       return a value or when the function call failed this function returns
146       an invalid QVariant object.
147
148       The QVariant objects in vars are updated when the method has out-
149       parameters.
150

QAxObject * QAxBase::querySubObject ( const QCString & name, const QVariant &

152       var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
153       QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ),
154       const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant
155       ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 =
156       QVariant ( ) )
157       Returns a pointer to a QAxObject wrapping the COM object provided by
158       the method or property name, passing passing the parameters var1, var1,
159       var2, var3, var4, var5, var6, var7 and var8.
160
161       If name is provided by a method the string must include the full
162       function prototype.
163
164       If name is a property the string must be the name of the property, and
165       var1, ... var8 are ignored.
166
167       The returned QAxObject is a child of this object (which is either of
168       type QAxObject or QAxWidget), and is deleted when this object is
169       deleted. It is however safe to delete the returned object yourself, and
170       you should do so when you iterate over lists of subobjects.
171
172       COM enabled applications usually have an object model publishing
173       certain elements of the application as dispatch interfaces. Use this
174       method to navigate the hierarchy of the object model, e.g.
175
176           QAxWidget outlook( "Outlook.Application" );
177           QAxObject *session = outlook.querySubObject( "Session" );
178           if ( session ) {
179               QAxObject *defFolder = session->querySubObject(
180                                       "GetDefaultFolder(OlDefaultFolders)",
181                                       "olFolderContacts" );
182               //...
183           }
184
185       Example: qutlook/centralwidget.cpp.
186
187

SEE ALSO

189       http://doc.trolltech.com/qaxobject.html
190       http://www.trolltech.com/faq/tech.html
191
193       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
194       license file included in the distribution for a complete license
195       statement.
196

AUTHOR

198       Generated automatically from the source code.
199

BUGS

201       If you find a bug in Qt, please report it as described in
202       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
203       help you. Thank you.
204
205       The definitive Qt documentation is provided in HTML format; it is
206       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
207       web browser. This man page is provided as a convenience for those users
208       who prefer man pages, although this format is not officially supported
209       by Trolltech.
210
211       If you find errors in this manual page, please report them to qt-
212       bugs@trolltech.com.  Please include the name of the manual page
213       (qaxobject.3qt) and the Qt version (3.3.8).
214
215
216
217Trolltech AS                    2 February 2007                 QAxObject(3qt)
Impressum