<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qaxbindable.cpp --> <title>Qt 4.8: QAxBindable Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li><a href="modules.html">Modules</a></li> <li><a href="qaxserver.html">QAxServer</a></li> <li>QAxBindable</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#protected-functions">Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QAxBindable Class Reference</h1> <!-- $$$QAxBindable-brief --> <p>The QAxBindable class provides an interface between a <a href="qwidget.html">QWidget</a> and an ActiveX client. <a href="#details">More...</a></p> <!-- @@@QAxBindable --> <pre class="cpp"> <span class="preprocessor">#include <QAxBindable></span></pre><ul> <li><a href="qaxbindable-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#QAxBindable">QAxBindable</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#dtor.QAxBindable">~QAxBindable</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QAxAggregated * </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#createAggregate">createAggregate</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#readData">readData</a></b> ( QIODevice * <i>source</i>, const QString & <i>format</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#reportError">reportError</a></b> ( int <i>code</i>, const QString & <i>src</i>, const QString & <i>desc</i>, const QString & <i>context</i> = QString() )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#writeData">writeData</a></b> ( QIODevice * <i>sink</i> )</td></tr> </table> <a name="protected-functions"></a> <h2>Protected Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> IUnknown * </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#clientSite">clientSite</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#propertyChanged">propertyChanged</a></b> ( const char * <i>property</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qaxbindable.html#requestPropertyChange">requestPropertyChange</a></b> ( const char * <i>property</i> )</td></tr> </table> <a name="details"></a> <!-- $$$QAxBindable-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QAxBindable class provides an interface between a <a href="qwidget.html">QWidget</a> and an ActiveX client.</p> <p>The functions provided by this class allow an ActiveX control to communicate property changes to a client application. Inherit your control class from both <a href="qwidget.html">QWidget</a> (directly or indirectly) and this class to get access to this class's functions. The <a href="moc.html#moc">meta-object compiler</a> requires you to inherit from <a href="qwidget.html">QWidget</a> first.</p> <pre class="cpp"> <span class="keyword">class</span> MyActiveX : <span class="keyword">public</span> <span class="type"><a href="qwidget.html">QWidget</a></span><span class="operator">,</span> <span class="keyword">public</span> <span class="type">QAxBindable</span> { Q_OBJECT Q_PROPERTY(<span class="type">int</span> value READ value WRITE setValue) <span class="keyword">public</span>: MyActiveX(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent <span class="operator">=</span> <span class="number">0</span>); <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="type">int</span> value() <span class="keyword">const</span>; <span class="type">void</span> setValue(<span class="type">int</span>); };</pre> <p>When implementing the property write function, use <a href="qaxbindable.html#requestPropertyChange">requestPropertyChange</a>() to get permission from the ActiveX client application to change this property. When the property changes, call <a href="qaxbindable.html#propertyChanged">propertyChanged</a>() to notify the ActiveX client application about the change. If a fatal error occurs in the control, use the static <a href="qaxbindable.html#reportError">reportError</a>() function to notify the client.</p> <p>Use the interface returned by <a href="qaxbindable.html#clientSite">clientSite</a>() to call the ActiveX client. To implement additional COM interfaces in your ActiveX control, reimplement <a href="qaxbindable.html#createAggregate">createAggregate</a>() to return a new object of a <a href="qaxaggregated.html">QAxAggregated</a> subclass.</p> <p>The <a href="activeqt.html#activeqt">ActiveQt</a> <a href="activeqt-opengl.html">OpenGL</a> example shows how to use QAxBindable to implement additional COM interfaces.</p> </div> <p><b>See also </b><a href="qaxaggregated.html">QAxAggregated</a>, <a href="qaxfactory.html">QAxFactory</a>, and <a href="activeqt.html#activeqt-framework">ActiveQt Framework</a>.</p> <!-- @@@QAxBindable --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QAxBindable[overload1]$$$QAxBindable --> <h3 class="fn"><a name="QAxBindable"></a>QAxBindable::<span class="name">QAxBindable</span> ()</h3> <p>Constructs an empty <a href="qaxbindable.html">QAxBindable</a> object.</p> <!-- @@@QAxBindable --> <!-- $$$~QAxBindable[overload1]$$$~QAxBindable --> <h3 class="fn"><a name="dtor.QAxBindable"></a>QAxBindable::<span class="name">~QAxBindable</span> ()<tt> [virtual]</tt></h3> <p>Destroys the <a href="qaxbindable.html">QAxBindable</a> object.</p> <!-- @@@~QAxBindable --> <!-- $$$clientSite[overload1]$$$clientSite --> <h3 class="fn"><a name="clientSite"></a><span class="type">IUnknown</span> * QAxBindable::<span class="name">clientSite</span> () const<tt> [protected]</tt></h3> <p>Returns a pointer to the client site interface for this ActiveX object, or null if no client site has been set.</p> <p>Call <tt>QueryInterface()</tt> on the returned interface to get the interface you want to call.</p> <!-- @@@clientSite --> <!-- $$$createAggregate[overload1]$$$createAggregate --> <h3 class="fn"><a name="createAggregate"></a><span class="type"><a href="qaxaggregated.html">QAxAggregated</a></span> * QAxBindable::<span class="name">createAggregate</span> ()<tt> [virtual]</tt></h3> <p>Reimplement this function when you want to implement additional COM interfaces in the ActiveX control, or when you want to provide alternative implementations of COM interfaces. Return a new object of a <a href="qaxaggregated.html">QAxAggregated</a> subclass.</p> <p>The default implementation returns the null pointer.</p> <!-- @@@createAggregate --> <!-- $$$propertyChanged[overload1]$$$propertyChangedconstchar* --> <h3 class="fn"><a name="propertyChanged"></a><span class="type">void</span> QAxBindable::<span class="name">propertyChanged</span> ( const <span class="type">char</span> * <i>property</i> )<tt> [protected]</tt></h3> <p>Call this function to notify the client that is hosting this ActiveX control that the property <i>property</i> has been changed.</p> <p>This function is usually called at the end of the property's write function.</p> <p><b>See also </b><a href="qaxbindable.html#requestPropertyChange">requestPropertyChange</a>().</p> <!-- @@@propertyChanged --> <!-- $$$readData[overload1]$$$readDataQIODevice*constQString& --> <h3 class="fn"><a name="readData"></a><span class="type">bool</span> QAxBindable::<span class="name">readData</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>source</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>format</i> )<tt> [virtual]</tt></h3> <p>If the COM object supports a MIME type then this function is called to initialize the COM object from the data <i>source</i> in <i>format</i>. You have to open <i>source</i> for reading before you can read from it.</p> <p>Returns true to indicate success. If the function returns false, then <a href="activeqt.html#activeqt">ActiveQt</a> will process the data by setting the properties through the meta object system.</p> <p>If you reimplement this function you also have to implement <a href="qaxbindable.html#writeData">writeData</a>(). The default implementation does nothing and returns false.</p> <p><b>Warning:</b> ActiveX controls embedded in HTML can use either the <tt>type</tt> and <tt>data</tt> attribute of the <tt>object</tt> tag to read data, or use a list of <tt>param</tt> tags to initialize properties. If <tt>param</tt> tags are used, then Internet Explorer will ignore the <tt>data</tt> attribute, and readData will not be called.</p> <p>This function was introduced in Qt 4.1.</p> <p><b>See also </b><a href="qaxbindable.html#writeData">writeData</a>().</p> <!-- @@@readData --> <!-- $$$reportError[overload1]$$$reportErrorintconstQString&constQString&constQString& --> <h3 class="fn"><a name="reportError"></a><span class="type">void</span> QAxBindable::<span class="name">reportError</span> ( <span class="type">int</span> <i>code</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>src</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>desc</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>context</i> = QString() )</h3> <p>Reports an error to the client application. <i>code</i> is a control-defined error code. <i>desc</i> is a human-readable description of the error intended for the application user. <i>src</i> is the name of the source for the error, typically the ActiveX server name. <i>context</i> can be the location of a help file with more information about the error. If <i>context</i> ends with a number in brackets, e.g. [12], this number will be interpreted as the context ID in the help file.</p> <!-- @@@reportError --> <!-- $$$requestPropertyChange[overload1]$$$requestPropertyChangeconstchar* --> <h3 class="fn"><a name="requestPropertyChange"></a><span class="type">bool</span> QAxBindable::<span class="name">requestPropertyChange</span> ( const <span class="type">char</span> * <i>property</i> )<tt> [protected]</tt></h3> <p>Call this function to request permission to change the property <i>property</i> from the client that is hosting this ActiveX control. Returns true if the client allows the change; otherwise returns false.</p> <p>This function is usually called first in the write function for <i>property</i>, and writing is abandoned if the function returns false.</p> <pre class="cpp"> <span class="type">void</span> MyActiveQt<span class="operator">::</span>setText(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&</span>text) { <span class="keyword">if</span> (<span class="operator">!</span>requestPropertyChange(<span class="string">"text"</span>)) <span class="keyword">return</span>; <span class="comment">// update property</span> propertyChanged(<span class="string">"text"</span>); }</pre> <p><b>See also </b><a href="qaxbindable.html#propertyChanged">propertyChanged</a>().</p> <!-- @@@requestPropertyChange --> <!-- $$$writeData[overload1]$$$writeDataQIODevice* --> <h3 class="fn"><a name="writeData"></a><span class="type">bool</span> QAxBindable::<span class="name">writeData</span> ( <span class="type"><a href="qiodevice.html">QIODevice</a></span> * <i>sink</i> )<tt> [virtual]</tt></h3> <p>If the COM object supports a MIME type then this function is called to store the COM object into <i>sink</i>. You have to open <i>sink</i> for writing before you can write to it.</p> <p>Returns true to indicate success. If the function returns false, then <a href="activeqt.html#activeqt">ActiveQt</a> will serialize the object by storing the property values.</p> <p>If you reimplement this function you also have to implement <a href="qaxbindable.html#readData">readData</a>(). The default implementation does nothing and returns false.</p> <p>This function was introduced in Qt 4.1.</p> <p><b>See also </b><a href="qaxbindable.html#readData">readData</a>().</p> <!-- @@@writeData --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>