source: trunk/doc/html/qaxwidget.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 16.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/activeqt/container/qaxwidget.cpp:1336 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QAxWidget Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QAxWidget Class Reference<br><small>[<a href="qaxcontainer.html">QAxContainer module</a>]</small></h1>
33
34<p>The QAxWidget class is a QWidget that wraps an ActiveX control.
35<a href="#details">More...</a>
36<p>This class is part of the <b>Qt ActiveQt Extension</b>.
37<p><tt>#include &lt;<a href="qaxwidget-h.html">qaxwidget.h</a>&gt;</tt>
38<p>Inherits <a href="qwidget.html">QWidget</a> and <a href="qaxbase.html">QAxBase</a>.
39<p><a href="qaxwidget-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#QAxWidget"><b>QAxWidget</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</li>
43<li class=fn><a href="#QAxWidget-2"><b>QAxWidget</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;c, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</li>
44<li class=fn><a href="#QAxWidget-3"><b>QAxWidget</b></a> ( IUnknown&nbsp;*&nbsp;iface, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</li>
45<li class=fn><a href="#~QAxWidget"><b>~QAxWidget</b></a> ()</li>
46</ul>
47<h2>Important Inherited Members</h2>
48<ul>
49<li class=fn>QVariant <a href="#dynamicCall"><b>dynamicCall</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;function, const&nbsp;QVariant&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var8 = QVariant ( ) )</li>
50<li class=fn>QVariant <a href="#dynamicCall-2"><b>dynamicCall</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;function, QValueList&lt;QVariant&gt;&nbsp;&amp;&nbsp;vars )</li>
51<li class=fn>QAxObject * <a href="#querySubObject"><b>querySubObject</b></a> ( const&nbsp;QCString&nbsp;&amp;&nbsp;name, const&nbsp;QVariant&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;QVariant&nbsp;&amp;&nbsp;var8 = QVariant ( ) )</li>
52</ul>
53<h2>Protected Members</h2>
54<ul>
55<li class=fn>virtual bool <a href="#createHostWindow"><b>createHostWindow</b></a> ( bool&nbsp;initialized )</li>
56<li class=fn>virtual bool <a href="#translateKeyEvent"><b>translateKeyEvent</b></a> ( int&nbsp;message, int&nbsp;keycode ) const</li>
57</ul>
58<hr><a name="details"></a><h2>Detailed Description</h2>
59<p> This class is defined in the <b>Qt <a href="activeqt.html#ActiveQt">ActiveQt</a> Extension</b>, which can be found in the <tt>qt/extensions</tt> directory. It is not included in the main Qt API.
60<p>
61
62The QAxWidget class is a <a href="qwidget.html">QWidget</a> that wraps an ActiveX control.
63
64<p>
65
66<p> A QAxWidget can be instantiated as an empty object, with the name
67of the ActiveX control it should wrap, or with an existing
68interface pointer to the ActiveX control. The ActiveX control's
69properties, methods and events which only use <a href="qaxbase.html">supported data types</a>, become available as Qt properties,
70slots and signals. The base class <a href="qaxbase.html">QAxBase</a> provides an API to
71access the ActiveX directly through the IUnknown pointer.
72<p> QAxWidget is a QWidget and can be used as such, e.g. it can be
73organized in a widget hierarchy, receive events or act as an event
74filter. Standard widget properties, e.g. <a href="qwidget.html#enabled-prop">enabled</a> are supported, but it depends on the ActiveX
75control to implement support for ambient properties like e.g.
76palette or font. QAxWidget tries to provide the necessary hints.
77<p> <b>Warning:</b>
78You can subclass QAxWidget, but you cannot use the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro
79in the subclass (the generated <a href="moc.html#moc">moc</a>-file will not compile), so you
80cannot add further signals, slots or properties. This limitation
81is due to the metaobject information generated in runtime. To work
82around this problem, aggregate the QAxWidget as a member of the
83<a href="qobject.html">QObject</a> subclass.
84<p>
85<hr><h2>Member Function Documentation</h2>
86<h3 class=fn><a name="QAxWidget"></a>QAxWidget::QAxWidget ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
87</h3>
88Creates an empty QAxWidget widget and propagates <em>parent</em>, <em>name</em> and <em>f</em> to the <a href="qwidget.html">QWidget</a> constructor. To initialize a control,
89call <a href="qaxbase.html#setControl">setControl</a>.
90
91<h3 class=fn><a name="QAxWidget-2"></a>QAxWidget::QAxWidget ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;c, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
92</h3>
93Creates an QAxWidget widget and initializes the ActiveX control <em>c</em>.
94<em>parent</em>, <em>name</em> and <em>f</em> are propagated to the <a href="qwidget.html">QWidget</a> contructor.
95<p> <p>See also <a href="qaxbase.html#control-prop">control</a>.
96
97<h3 class=fn><a name="QAxWidget-3"></a>QAxWidget::QAxWidget ( IUnknown&nbsp;*&nbsp;iface, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
98</h3>
99Creates a QAxWidget that wraps the COM object referenced by <em>iface</em>.
100<em>parent</em>, <em>name</em> and <em>f</em> are propagated to the <a href="qwidget.html">QWidget</a> contructor.
101
102<h3 class=fn><a name="~QAxWidget"></a>QAxWidget::~QAxWidget ()
103</h3>
104Shuts down the ActiveX control and destroys the QAxWidget widget,
105cleaning up all allocated resources.
106<p> <p>See also <a href="qaxbase.html#clear">clear</a>().
107
108<h3 class=fn>bool <a name="createHostWindow"></a>QAxWidget::createHostWindow ( bool&nbsp;initialized )<tt> [virtual protected]</tt>
109</h3>
110Creates the client site for the ActiveX control, and returns TRUE if
111the control could be embedded successfully, otherwise returns FALSE.
112If <em>initialized</em> is TRUE the control has already been initialized.
113<p> This function is called by <a href="qaxbase.html#initialize">initialize</a>(). If you reimplement initialize
114to customize the actual control instantiation, call this function in your
115reimplementation to have the control embedded by the default client side.
116Creates the client site for the ActiveX control, and returns TRUE if
117the control could be embedded successfully, otherwise returns FALSE.
118
119<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="dynamicCall"></a>QAxBase::dynamicCall ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;function, const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var8 = QVariant ( ) )
120</h3>
121Calls the COM object's method <em>function</em>, passing the
122parameters <em>var1</em>, <em>var1</em>, <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>,
123<em>var6</em>, <em>var7</em> and <em>var8</em>, and returns the value returned by
124the method, or an invalid <a href="qvariant.html">QVariant</a> if the method does not return
125a value or when the function call failed.
126<p> If <em>function</em> is a method of the object the string must be provided
127as the full prototype, for example as it would be written in a
128<a href="qobject.html#connect">QObject::connect</a>() call.
129<pre>
130 activeX-&gt;dynamicCall( "Navigate(const <a href="qstring.html">QString</a>&amp;)", "www.trolltech.com" );
131 </pre>
132
133<p> Alternatively a function can be called passing the parameters embedded
134in the string, e.g. above function can also be invoked using
135<pre>
136 activeX-&gt;dynamicCall("Navigate(\"www.trolltech.com\");
137 </pre>
138
139All parameters are passed as strings; it depends on the control whether
140they are interpreted correctly, and is slower than using the prototype
141with correctly typed parameters.
142<p> If <em>function</em> is a property the string has to be the name of the
143property. The property setter is called when <em>var1</em> is a valid QVariant,
144otherwise the getter is called.
145<pre>
146 activeX-&gt;dynamicCall( "Value", 5 );
147 <a href="qstring.html">QString</a> text = activeX-&gt;dynamicCall( "Text" ).toString();
148 </pre>
149
150Note that it is faster to get and set properties using
151<a href="qobject.html#property">QObject::property</a>() and <a href="qobject.html#setProperty">QObject::setProperty</a>().
152<p> It is only possible to call functions through <a href="qaxbase.html#dynamicCall">dynamicCall</a>() that
153have parameters or return values of datatypes supported by
154<a href="qvariant.html">QVariant</a>. See the <a href="qaxbase.html">QAxBase</a> class documentation for a list of
155supported and unsupported datatypes. If you want to call functions
156that have unsupported datatypes in the parameter list, use
157<a href="qaxbase.html#queryInterface">queryInterface</a>() to retrieve the appropriate COM interface, and
158use the function directly.
159<p> <pre>
160 IWebBrowser2 *webBrowser = 0;
161 activeX-&gt;queryInterface( IID_IWebBrowser2, (void**)&amp;webBrowser );
162 if ( webBrowser ) {
163 webBrowser-&gt;Navigate2( pvarURL );
164 webBrowser-&gt;Release();
165 }
166 </pre>
167
168<p> This is also more efficient.
169
170<p>Example: <a href="qaxcontainer-example-qutlook.html#x2720">qutlook/centralwidget.cpp</a>.
171<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="dynamicCall-2"></a>QAxBase::dynamicCall ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;function, <a href="qvaluelist.html">QValueList</a>&lt;QVariant&gt;&nbsp;&amp;&nbsp;vars )
172</h3>
173This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
174<p> Calls the COM object's method <em>function</em>, passing the
175parameters in <em>vars</em>, and returns the value returned by
176the method. If the method does not return a value or when
177the function call failed this function returns an invalid
178<a href="qvariant.html">QVariant</a> object.
179<p> The QVariant objects in <em>vars</em> are updated when the method has
180out-parameters.
181
182<h3 class=fn><a href="qaxobject.html">QAxObject</a>&nbsp;* <a name="querySubObject"></a>QAxBase::querySubObject ( const&nbsp;<a href="qcstring.html">QCString</a>&nbsp;&amp;&nbsp;name, const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var1 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var2 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var3 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var4 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var5 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var6 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var7 = QVariant ( ), const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;var8 = QVariant ( ) )
183</h3>
184Returns a pointer to a <a href="qaxobject.html">QAxObject</a> wrapping the COM object provided
185by the method or property <em>name</em>, passing passing the parameters
186<em>var1</em>, <em>var1</em>, <em>var2</em>, <em>var3</em>, <em>var4</em>, <em>var5</em>, <em>var6</em>,
187<em>var7</em> and <em>var8</em>.
188<p> If <em>name</em> is provided by a method the string must include the
189full function prototype.
190<p> If <em>name</em> is a property the string must be the name of the property,
191and <em>var1</em>, ... <em>var8</em> are ignored.
192<p> The returned QAxObject is a child of this object (which is either of
193type QAxObject or QAxWidget), and is deleted when this object is
194deleted. It is however safe to delete the returned object yourself,
195and you should do so when you iterate over lists of subobjects.
196<p> COM enabled applications usually have an object model publishing
197certain elements of the application as dispatch interfaces. Use
198this method to navigate the hierarchy of the object model, e.g.
199<p> <pre>
200 QAxWidget outlook( "Outlook.Application" );
201 <a href="qaxobject.html">QAxObject</a> *session = outlook.<a href="qaxbase.html#querySubObject">querySubObject</a>( "Session" );
202 if ( session ) {
203 <a href="qaxobject.html">QAxObject</a> *defFolder = session-&gt;<a href="qaxbase.html#querySubObject">querySubObject</a>(
204 "GetDefaultFolder(OlDefaultFolders)",
205 "olFolderContacts" );
206 //...
207 }
208 </pre>
209
210
211<p>Example: <a href="qaxcontainer-example-qutlook.html#x2721">qutlook/centralwidget.cpp</a>.
212<h3 class=fn>bool <a name="translateKeyEvent"></a>QAxWidget::translateKeyEvent ( int&nbsp;message, int&nbsp;keycode ) const<tt> [virtual protected]</tt>
213</h3>
214Reimplement this function to pass certain key events to the
215ActiveX control. <em>message</em> is the Window message identifier
216specifying the message type (ie. WM_KEYDOWN), and <em>keycode</em> is
217the virtual keycode (ie. VK_TAB).
218<p> If the function returns TRUE the key event is passed on to the
219ActiveX control, which then either processes the event or passes
220the event on to Qt.
221<p> If the function returns FALSE the processing of the key event is
222ignored by <a href="activeqt.html#ActiveQt">ActiveQt</a>, ie. the ActiveX control might handle it or
223not.
224<p> The default implementation returns TRUE for the following cases:
225<p> <center><table cellpadding="4" cellspacing="2" border="0">
226<tr bgcolor="#a2c511">
227<th valign="top">WM_SYSKEYDOWN
228<th valign="top">WM_SYSKEYUP
229<th valign="top">WM_KEYDOWN
230<tr bgcolor="#f0f0f0">
231<td valign="top">All keycodes
232<td valign="top">VK_MENU
233<td valign="top">VK_TAB, VK_DELETE and all non-arrow-keys in combination with VK_SHIFT,
234VK_CONTROL or VK_MENU
235</table></center>
236<p> This table is the result of experimenting with popular ActiveX controls,
237ie. Internet Explorer and Microsoft Office applications, but for some
238controls it might require modification.
239
240<!-- eof -->
241<hr><p>
242This file is part of the <a href="index.html">Qt toolkit</a>.
243Copyright &copy; 1995-2007
244<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
245<table width=100% cellspacing=0 border=0><tr>
246<td>Copyright &copy; 2007
247<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
248<td align=right><div align=right>Qt 3.3.8</div>
249</table></div></address></body>
250</html>
Note: See TracBrowser for help on using the repository browser.