1QAxWidget(3qt) QAxWidget(3qt)
2
3
4
6 QAxWidget - QWidget that wraps an ActiveX control
7
9 This class is part of the Qt ActiveQt Extension.
10
11 #include <qaxwidget.h>
12
13 Inherits QWidget and QAxBase.
14
15 Public Members
16 QAxWidget ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
17 QAxWidget ( const QString & c, QWidget * parent = 0, const char * name
18 = 0, WFlags f = 0 )
19 QAxWidget ( IUnknown * iface, QWidget * parent = 0, const char * name =
20 0, WFlags f = 0 )
21 ~QAxWidget ()
22
23 Important Inherited Members
24 QVariant dynamicCall ( const QCString & function, const QVariant & var1
25 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
26 QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant (
27 ), const QVariant & var5 = QVariant ( ), const QVariant & var6 =
28 QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant
29 & var8 = QVariant ( ) )
30 QVariant dynamicCall ( const QCString & function, QValueList<QVariant>
31 & vars )
32 QAxObject * querySubObject ( const QCString & name, const QVariant &
33 var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
34 QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant (
35 ), const QVariant & var5 = QVariant ( ), const QVariant & var6 =
36 QVariant ( ), const QVariant & var7 = QVariant ( ), const QVariant
37 & var8 = QVariant ( ) )
38
39 Protected Members
40 virtual bool createHostWindow ( bool initialized )
41 virtual bool translateKeyEvent ( int message, int keycode ) const
42
44 This class is defined in the Qt ActiveQt Extension, which can be found
45 in the qt/extensions directory. It is not included in the main Qt API.
46
47 The QAxWidget class is a QWidget that wraps an ActiveX control.
48
49 A QAxWidget can be instantiated as an empty object, with the name of
50 the ActiveX control it should wrap, or with an existing interface
51 pointer to the ActiveX control. The ActiveX control's properties,
52 methods and events which only use supported data types, become
53 available as Qt properties, slots and signals. The base class QAxBase
54 provides an API to access the ActiveX directly through the IUnknown
55 pointer.
56
57 QAxWidget is a QWidget and can be used as such, e.g. it can be
58 organized in a widget hierarchy, receive events or act as an event
59 filter. Standard widget properties, e.g. enabled are supported, but it
60 depends on the ActiveX control to implement support for ambient
61 properties like e.g. palette or font. QAxWidget tries to provide the
62 necessary hints.
63
64 Warning: You can subclass QAxWidget, but you cannot use the Q_OBJECT
65 macro in the subclass (the generated moc-file will not compile), so you
66 cannot add further signals, slots or properties. This limitation is due
67 to the metaobject information generated in runtime. To work around this
68 problem, aggregate the QAxWidget as a member of the QObject subclass.
69
72 0 )
73 Creates an empty QAxWidget widget and propagates parent, name and f to
74 the QWidget constructor. To initialize a control, call setControl.
75
77 name = 0, WFlags f = 0 )
78 Creates an QAxWidget widget and initializes the ActiveX control c.
79 parent, name and f are propagated to the QWidget contructor.
80
81 See also control.
82
84 name = 0, WFlags f = 0 )
85 Creates a QAxWidget that wraps the COM object referenced by iface.
86 parent, name and f are propagated to the QWidget contructor.
87
89 Shuts down the ActiveX control and destroys the QAxWidget widget,
90 cleaning up all allocated resources.
91
92 See also clear().
93
95 Creates the client site for the ActiveX control, and returns TRUE if
96 the control could be embedded successfully, otherwise returns FALSE. If
97 initialized is TRUE the control has already been initialized.
98
99 This function is called by initialize(). If you reimplement initialize
100 to customize the actual control instantiation, call this function in
101 your reimplementation to have the control embedded by the default
102 client side. Creates the client site for the ActiveX control, and
103 returns TRUE if the control could be embedded successfully, otherwise
104 returns FALSE.
105
107 var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
108 QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ),
109 const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant
110 ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 =
111 QVariant ( ) )
112 Calls the COM object's method function, passing the parameters var1,
113 var1, var2, var3, var4, var5, var6, var7 and var8, and returns the
114 value returned by the method, or an invalid QVariant if the method does
115 not return a value or when the function call failed.
116
117 If function is a method of the object the string must be provided as
118 the full prototype, for example as it would be written in a
119 QObject::connect() call.
120
121 activeX->dynamicCall( "Navigate(const QString&)", "www.trolltech.com" );
122
123 Alternatively a function can be called passing the parameters embedded
124 in the string, e.g. above function can also be invoked using
125
126 activeX->dynamicCall("Navigate(\"www.trolltech.com\");
127 All parameters are passed as strings; it depends on the control whether
128 they are interpreted correctly, and is slower than using the prototype
129 with correctly typed parameters.
130
131 If function is a property the string has to be the name of the
132 property. The property setter is called when var1 is a valid QVariant,
133 otherwise the getter is called.
134
135 activeX->dynamicCall( "Value", 5 );
136 QString text = activeX->dynamicCall( "Text" ).toString();
137 Note that it is faster to get and set properties using
138 QObject::property() and QObject::setProperty().
139
140 It is only possible to call functions through dynamicCall() that have
141 parameters or return values of datatypes supported by QVariant. See the
142 QAxBase class documentation for a list of supported and unsupported
143 datatypes. If you want to call functions that have unsupported
144 datatypes in the parameter list, use queryInterface() to retrieve the
145 appropriate COM interface, and use the function directly.
146
147 IWebBrowser2 *webBrowser = 0;
148 activeX->queryInterface( IID_IWebBrowser2, (void**)&webBrowser );
149 if ( webBrowser ) {
150 webBrowser->Navigate2( pvarURL );
151 webBrowser->Release();
152 }
153
154 This is also more efficient.
155
156 Example: qutlook/centralwidget.cpp.
157
159 QValueList<QVariant> & vars )
160 This is an overloaded member function, provided for convenience. It
161 behaves essentially like the above function.
162
163 Calls the COM object's method function, passing the parameters in vars,
164 and returns the value returned by the method. If the method does not
165 return a value or when the function call failed this function returns
166 an invalid QVariant object.
167
168 The QVariant objects in vars are updated when the method has out-
169 parameters.
170
172 var1 = QVariant ( ), const QVariant & var2 = QVariant ( ), const
173 QVariant & var3 = QVariant ( ), const QVariant & var4 = QVariant ( ),
174 const QVariant & var5 = QVariant ( ), const QVariant & var6 = QVariant
175 ( ), const QVariant & var7 = QVariant ( ), const QVariant & var8 =
176 QVariant ( ) )
177 Returns a pointer to a QAxObject wrapping the COM object provided by
178 the method or property name, passing passing the parameters var1, var1,
179 var2, var3, var4, var5, var6, var7 and var8.
180
181 If name is provided by a method the string must include the full
182 function prototype.
183
184 If name is a property the string must be the name of the property, and
185 var1, ... var8 are ignored.
186
187 The returned QAxObject is a child of this object (which is either of
188 type QAxObject or QAxWidget), and is deleted when this object is
189 deleted. It is however safe to delete the returned object yourself, and
190 you should do so when you iterate over lists of subobjects.
191
192 COM enabled applications usually have an object model publishing
193 certain elements of the application as dispatch interfaces. Use this
194 method to navigate the hierarchy of the object model, e.g.
195
196 QAxWidget outlook( "Outlook.Application" );
197 QAxObject *session = outlook.querySubObject( "Session" );
198 if ( session ) {
199 QAxObject *defFolder = session->querySubObject(
200 "GetDefaultFolder(OlDefaultFolders)",
201 "olFolderContacts" );
202 //...
203 }
204
205 Example: qutlook/centralwidget.cpp.
206
208 protected]
209 Reimplement this function to pass certain key events to the ActiveX
210 control. message is the Window message identifier specifying the
211 message type (ie. WM_KEYDOWN), and keycode is the virtual keycode (ie.
212 VK_TAB).
213
214 If the function returns TRUE the key event is passed on to the ActiveX
215 control, which then either processes the event or passes the event on
216 to Qt.
217
218 If the function returns FALSE the processing of the key event is
219 ignored by ActiveQt, ie. the ActiveX control might handle it or not.
220
221 The default implementation returns TRUE for the following cases:
222
223 <center>.nf
224
225 </center>
226
227 This table is the result of experimenting with popular ActiveX
228 controls, ie. Internet Explorer and Microsoft Office applications, but
229 for some controls it might require modification.
230
231
233 http://doc.trolltech.com/qaxwidget.html
234 http://www.trolltech.com/faq/tech.html
235
237 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
238 license file included in the distribution for a complete license
239 statement.
240
242 Generated automatically from the source code.
243
245 If you find a bug in Qt, please report it as described in
246 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
247 help you. Thank you.
248
249 The definitive Qt documentation is provided in HTML format; it is
250 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
251 web browser. This man page is provided as a convenience for those users
252 who prefer man pages, although this format is not officially supported
253 by Trolltech.
254
255 If you find errors in this manual page, please report them to qt-
256 bugs@trolltech.com. Please include the name of the manual page
257 (qaxwidget.3qt) and the Qt version (3.3.8).
258
259
260
261Trolltech AS 2 February 2007 QAxWidget(3qt)