[190] | 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/examples/wrapper/wrapper.doc:57 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>Standard Qt widgets as ActiveX controls (in-process)</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { 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 Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main 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 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>Standard Qt widgets as ActiveX controls (in-process)</h1>
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | The ActiveX controls in this example are the standard button
|
---|
| 37 | classes <a href="qpushbutton.html">QPushButton</a>, <a href="qcheckbox.html">QCheckBox</a> and <a href="qradiobutton.html">QRadioButton</a> as provided by
|
---|
| 38 | Qt.
|
---|
| 39 | <p> It demonstrates how to export existing <a href="qwidget.html">QWidget</a> classes as ActiveX
|
---|
| 40 | controls, and the use of <a href="qaxfactory.html">QAxFactory</a> together with the <a href="qaxfactory.html#QAXFACTORY_EXPORT">QAXFACTORY_EXPORT</a>
|
---|
| 41 | macro.
|
---|
| 42 | <p>
|
---|
| 43 |
|
---|
| 44 | <pre> class ActiveQtFactory : public <a href="qaxfactory.html">QAxFactory</a>
|
---|
| 45 | {
|
---|
| 46 | public:
|
---|
| 47 | ActiveQtFactory( const <a href="quuid.html">QUuid</a> &lib, const <a href="quuid.html">QUuid</a> &app )
|
---|
| 48 | : <a href="qaxfactory.html">QAxFactory</a>( lib, app )
|
---|
| 49 | {}
|
---|
| 50 | <a href="qstringlist.html">QStringList</a> featureList() const
|
---|
| 51 | {
|
---|
| 52 | <a href="qstringlist.html">QStringList</a> list;
|
---|
| 53 | list << "QButton";
|
---|
| 54 | list << "QCheckBox";
|
---|
| 55 | list << "QRadioButton";
|
---|
| 56 | list << "QPushButton";
|
---|
| 57 | list << "QToolButton";
|
---|
| 58 | return list;
|
---|
| 59 | }
|
---|
| 60 | <a href="qwidget.html">QWidget</a> *create( const <a href="qstring.html">QString</a> &key, QWidget *parent, const char *name )
|
---|
| 61 | {
|
---|
| 62 | if ( key == "QButton" )
|
---|
| 63 | return new <a href="qbutton.html">QButton</a>( parent, name );
|
---|
| 64 | if ( key == "QCheckBox" )
|
---|
| 65 | return new <a href="qcheckbox.html">QCheckBox</a>( parent, name );
|
---|
| 66 | if ( key == "QRadioButton" )
|
---|
| 67 | return new <a href="qradiobutton.html">QRadioButton</a>( parent, name );
|
---|
| 68 | if ( key == "QPushButton" )
|
---|
| 69 | return new <a href="qpushbutton.html">QPushButton</a>( parent, name );
|
---|
| 70 | if ( key == "QToolButton" ) {
|
---|
| 71 | <a href="qtoolbutton.html">QToolButton</a> *tb = new <a href="qtoolbutton.html">QToolButton</a>( parent, name );
|
---|
| 72 | <a name="x2518"></a> tb-><a href="qbutton.html#setPixmap">setPixmap</a>( QPixmap(fileopen) );
|
---|
| 73 | return tb;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | return 0;
|
---|
| 77 | }
|
---|
| 78 | <a href="qmetaobject.html">QMetaObject</a> *metaObject( const <a href="qstring.html">QString</a> &key ) const
|
---|
| 79 | {
|
---|
| 80 | if ( key == "QButton" )
|
---|
| 81 | return QButton::staticMetaObject();
|
---|
| 82 | if ( key == "QCheckBox" )
|
---|
| 83 | return QCheckBox::staticMetaObject();
|
---|
| 84 | if ( key == "QRadioButton" )
|
---|
| 85 | return QRadioButton::staticMetaObject();
|
---|
| 86 | if ( key == "QPushButton" )
|
---|
| 87 | return QPushButton::staticMetaObject();
|
---|
| 88 | if ( key == "QToolButton" )
|
---|
| 89 | return QToolButton::staticMetaObject();
|
---|
| 90 |
|
---|
| 91 | return 0;
|
---|
| 92 | }
|
---|
| 93 | <a href="quuid.html">QUuid</a> classID( const <a href="qstring.html">QString</a> &key ) const
|
---|
| 94 | {
|
---|
| 95 | if ( key == "QButton" )
|
---|
| 96 | return "{23F5012A-7333-43D3-BCA8-836AABC61B4A}";
|
---|
| 97 | if ( key == "QCheckBox" )
|
---|
| 98 | return "{6E795DE9-872D-43CF-A831-496EF9D86C68}";
|
---|
| 99 | if ( key == "QRadioButton" )
|
---|
| 100 | return "{AFCF78C8-446C-409A-93B3-BA2959039189}";
|
---|
| 101 | if ( key == "QPushButton" )
|
---|
| 102 | return "{2B262458-A4B6-468B-B7D4-CF5FEE0A7092}";
|
---|
| 103 | if ( key == "QToolButton" )
|
---|
| 104 | return "{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}";
|
---|
| 105 |
|
---|
| 106 | return QUuid();
|
---|
| 107 | }
|
---|
| 108 | <a href="quuid.html">QUuid</a> interfaceID( const <a href="qstring.html">QString</a> &key ) const
|
---|
| 109 | {
|
---|
| 110 | if ( key == "QButton" )
|
---|
| 111 | return "{6DA689FB-928F-423C-8632-678C3D3606DB}";
|
---|
| 112 | if ( key == "QCheckBox" )
|
---|
| 113 | return "{4FD39DD7-2DE0-43C1-A8C2-27C51A052810}";
|
---|
| 114 | if ( key == "QRadioButton" )
|
---|
| 115 | return "{7CC8AE30-206C-48A3-A009-B0A088026C2F}";
|
---|
| 116 | if ( key == "QPushButton" )
|
---|
| 117 | return "{06831CC9-59B6-436A-9578-6D53E5AD03D3}";
|
---|
| 118 | if ( key == "QToolButton" )
|
---|
| 119 | return "{6726080f-d63d-4950-a366-9bf33e5cdf84}";
|
---|
| 120 |
|
---|
| 121 | return QUuid();
|
---|
| 122 | }
|
---|
| 123 | <a href="quuid.html">QUuid</a> eventsID( const <a href="qstring.html">QString</a> &key ) const
|
---|
| 124 | {
|
---|
| 125 | if ( key == "QButton" )
|
---|
| 126 | return "{73A5D03F-8ADE-4D84-9AE0-A93B4F85A130}";
|
---|
| 127 | if ( key == "QCheckBox" )
|
---|
| 128 | return "{FDB6FFBE-56A3-4E90-8F4D-198488418B3A}";
|
---|
| 129 | if ( key == "QRadioButton" )
|
---|
| 130 | return "{73EE4860-684C-4A66-BF63-9B9EFFA0CBE5}";
|
---|
| 131 | if ( key == "QPushButton" )
|
---|
| 132 | return "{3CC3F17F-EA59-4B58-BBD3-842D467131DD}";
|
---|
| 133 | if ( key == "QToolButton" )
|
---|
| 134 | return "{f4d421fd-4ead-4fd9-8a25-440766939639}";
|
---|
| 135 |
|
---|
| 136 | return QUuid();
|
---|
| 137 | }
|
---|
| 138 | };
|
---|
| 139 | </pre>The factory implementation returns the list of supported controls,
|
---|
| 140 | creates controls on request and provides information about the unique
|
---|
| 141 | IDs of the COM classes and interfaces for each control.
|
---|
| 142 | <p> <pre> QAXFACTORY_EXPORT( ActiveQtFactory, "{3B756301-0075-4E40-8BE8-5A81DE2426B7}", "{AB068077-4924-406a-BBAF-42D91C8727DD}" )
|
---|
| 143 | </pre>The factory is exported using the QAXFACTORY_EXPORT macro.
|
---|
| 144 | <p> To build the example you must first build the <a href="qaxserver.html">QAxServer</a> library. Then run qmake and your make tool in
|
---|
| 145 | <tt>examples/wrapper</tt>.
|
---|
| 146 | <p> <hr>
|
---|
| 147 | <p> The <a href="qaxserver-demo-wrapper.html">demonstration</a> requires your
|
---|
| 148 | WebBrowser to support ActiveX controls, and scripting to be enabled.
|
---|
| 149 | <p>
|
---|
| 150 |
|
---|
| 151 | <pre> <SCRIPT LANGUAGE=VBScript>
|
---|
| 152 | Sub ToolButton_Clicked()
|
---|
| 153 | RadioButton.text = InputBox( "Enter something", "Wrapper Demo" )
|
---|
| 154 | End Sub
|
---|
| 155 |
|
---|
| 156 | Sub PushButton_clicked()
|
---|
| 157 | MsgBox( "Thank you!" )
|
---|
| 158 | End Sub
|
---|
| 159 |
|
---|
| 160 | Sub CheckBox_toggled( state )
|
---|
| 161 | if state = 0 then
|
---|
| 162 | CheckBox.text = "Check me!"
|
---|
| 163 | else
|
---|
| 164 | CheckBox.text = "Uncheck me!"
|
---|
| 165 | end if
|
---|
| 166 | End Sub
|
---|
| 167 | </SCRIPT>
|
---|
| 168 | <p>
|
---|
| 169 | A QPushButton:<br>
|
---|
| 170 | <object ID="PushButton" CLASSID="CLSID:2B262458-A4B6-468B-B7D4-CF5FEE0A7092"
|
---|
| 171 | CODEBASE=http://www.trolltech.com/demos/wrapperax.cab>
|
---|
| 172 | <PARAM NAME="text" VALUE="Click me!">
|
---|
| 173 | [Object not available! Did you forget to build and register the server?]
|
---|
| 174 | </object><br>
|
---|
| 175 |
|
---|
| 176 | <p>
|
---|
| 177 | A QCheckBox:<br>
|
---|
| 178 | <object ID="CheckBox" CLASSID="CLSID:6E795de9-872d-43cf-a831-496ef9d86c68"
|
---|
| 179 | CODEBASE=http://www.trolltech.com/demos/wrapperax.cab>
|
---|
| 180 | <PARAM NAME="text" VALUE="Check me!">
|
---|
| 181 | [Object not available! Did you forget to build and register the server?]
|
---|
| 182 | </object><br>
|
---|
| 183 |
|
---|
| 184 | <p>
|
---|
| 185 | A QToolButton:<br>
|
---|
| 186 | <object ID="ToolButton" CLASSID="CLSID:7c0ffe7a-60c3-4666-bde2-5cf2b54390a1"
|
---|
| 187 | CODEBASE=http://www.trolltech.com/demos/wrapperax.cab>
|
---|
| 188 | [Object not available! Did you forget to build and register the server?]
|
---|
| 189 | </object><br>
|
---|
| 190 |
|
---|
| 191 | <p>
|
---|
| 192 | A QRadioButton:<br>
|
---|
| 193 | <object ID="RadioButton" CLASSID="CLSID:afcf78c8-446c-409a-93b3-ba2959039189"
|
---|
| 194 | CODEBASE=http://www.trolltech.com/demos/wrapperax.cab>
|
---|
| 195 | <PARAM NAME="text" VALUE="Tune me!">
|
---|
| 196 | [Object not available! Did you forget to build and register the server?]
|
---|
| 197 | </object><br>
|
---|
| 198 | </pre><p>See also <a href="qaxserver-examples.html">The QAxServer Examples</a>.
|
---|
| 199 |
|
---|
| 200 | <!-- eof -->
|
---|
| 201 | <p><address><hr><div align=center>
|
---|
| 202 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 203 | <td>Copyright © 2007
|
---|
| 204 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 205 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 206 | </table></div></address></body>
|
---|
| 207 | </html>
|
---|