diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /doc/html/qaxserver-example-multiple.html | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'doc/html/qaxserver-example-multiple.html')
-rw-r--r-- | doc/html/qaxserver-example-multiple.html | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/doc/html/qaxserver-example-multiple.html b/doc/html/qaxserver-example-multiple.html new file mode 100644 index 000000000..457342dde --- /dev/null +++ b/doc/html/qaxserver-example-multiple.html @@ -0,0 +1,201 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/activeqt/examples/multiple/multiple.doc:44 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>Two simple TQt widgets (in-process)</title> +<style type="text/css"><!-- +fn { margin-left: 1cm; text-indent: -1cm; } +a:link { color: #004faf; text-decoration: none } +a:visited { color: #672967; text-decoration: none } +body { background: #ffffff; color: black; } +--></style> +</head> +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr bgcolor="#E5E5E5"> +<td valign=center> + <a href="index.html"> +<font color="#004faf">Home</font></a> + | <a href="classes.html"> +<font color="#004faf">All Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped Classes</font></a> + | <a href="functions.html"> +<font color="#004faf">Functions</font></a> +</td> +<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Two simple TQt widgets (in-process)</h1> + + + +The ActiveX controls in this example are simple <a href="qwidget.html">TQWidget</a> +subclasses reimplementing the paintEvent() method. The classes use +the Q_CLASSINFO macro to +<p> The example demonstrates the use of the Q_CLASSINFO macro to set +<a href="activeqt.html#ActiveTQt">ActiveTQt</a>-specific attributes for <a href="qobject.html">TQObject</a> sub classes, and the use of +the <a href="qaxfactory.html#TQAXFACTORY_BEGIN">TQAXFACTORY_BEGIN</a>, <a href="qaxfactory.html#TQAXCLASS">TQAXCLASS</a> and <a href="qaxfactory.html#TQAXFACTORY_END">TQAXFACTORY_END</a> macros. +<p> + +<pre> class TQAxWidget1 : public <a href="qwidget.html">TQWidget</a> + { + <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> + Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}") + Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}") + Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}") +</pre>The class declaration includes the Q_OBJECT macro to activate TQt's <a href="metaobjects.html#meta-object">meta object</a> system, and sets COM identifiers for the class using the +Q_CLASSINFO macro. +<pre> Q_PROPERTY( TQColor fillColor READ fillColor WRITE setFillColor ) + public: + TQAxWidget1( <a href="qwidget.html">TQWidget</a> *parent = 0, const char *name = 0, WFlags f = 0 ) + : <a href="qwidget.html">TQWidget</a>( parent, name, f ), fill_color( red ) + { + } + + <a href="qcolor.html">TQColor</a> fillColor() const + { + return fill_color; + } + void setFillColor( const <a href="qcolor.html">TQColor</a> &fc ) + { + fill_color = fc; + repaint(); + } + + protected: + void paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> *e ) + { + <a href="qpainter.html">TQPainter</a> paint( this ); + <a href="qrect.html">TQRect</a> r = rect(); + <a name="x2544"></a> r.<a href="qrect.html#addCoords">addCoords</a>( 10, 10, -10, -10 ); + <a name="x2543"></a> paint.<a href="qpainter.html#fillRect">fillRect</a>( r, fill_color ); + } + + private: + <a href="qcolor.html">TQColor</a> fill_color; + }; +</pre>The control draws a filled rectangle. The fill color is exposed as a +property using the Q_PROPERTY macro. +<p> + +<pre> class TQAxWidget2 : public <a href="qwidget.html">TQWidget</a> + { + Q_OBJECT + Q_CLASSINFO("ClassID", "{58139D56-6BE9-4b17-937D-1B1EDEDD5B71}") + Q_CLASSINFO("InterfaceID", "{B66280AB-08CC-4dcc-924F-58E6D7975B7D}") + Q_CLASSINFO("EventsID", "{D72BACBA-03C4-4480-B4BB-DE4FE3AA14A0}") + Q_CLASSINFO("ToSuperClass", "TQAxWidget2") + Q_CLASSINFO("StockEvents", "yes") +</pre>The declaration of the second control class uses the Q_CLASSINFO macro +to set the COM identifiers as well as additional COM attributes for the +class. Objects of that class will not expose the <a href="qwidget.html">TQWidget</a> API, and provide +the ActiveX stock events (ie. Click, KeyDown etc.). +<pre> Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth ) + public: + TQAxWidget2( <a href="qwidget.html">TQWidget</a> *parent = 0, const char *name = 0, WFlags f = 0 ) + : <a href="qwidget.html">TQWidget</a>( parent, name, f ), line_width( 1 ) + { + } + + int lineWidth() const + { + return line_width; + } + void setLineWidth( int lw ) + { + line_width = lw; + repaint(); + } + + protected: + void paintEvent( <a href="qpaintevent.html">TQPaintEvent</a> *e ) + { + <a href="qpainter.html">TQPainter</a> paint( this ); + <a name="x2546"></a> <a href="qpen.html">TQPen</a> pen = paint.<a href="qpainter.html#pen">pen</a>(); + <a name="x2548"></a> pen.<a href="qpen.html#setWidth">setWidth</a>( line_width ); + <a name="x2547"></a> paint.<a href="qpainter.html#setPen">setPen</a>( pen ); + + <a href="qrect.html">TQRect</a> r = rect(); + <a name="x2549"></a> r.<a href="qrect.html#addCoords">addCoords</a>( 10, 10, -10, -10 ); + <a name="x2545"></a> paint.<a href="qpainter.html#drawEllipse">drawEllipse</a>( r ); + } + + private: + int line_width; + }; +</pre>The control draws a circle. The line width is exposed as a property +using the Q_PROPERTY macro. +<p> The controls are exposed by the implementation of <a href="qaxfactory.html">TQAxFactory</a> as provided +by the TQAXFACTORY_BEGIN and TQAXFACTORY_END macros. + + +<pre> #include <<a href="qaxfactory-h.html">qaxfactory.h</a>> + + #include "ax1.h" + #include "ax2.h" + + TQAXFACTORY_BEGIN("{98DE28B6-6CD3-4e08-B9FA-3D1DB43F1D2F}", "{05828915-AD1C-47ab-AB96-D6AD1E25F0E2}") +</pre>The factory is initialied using the TQAXFACTORY_BEGIN macro, providing +the IDs for the application and the type library. +<pre> TQAXCLASS(TQAxWidget1) + TQAXCLASS(TQAxWidget2) +</pre>The classes exposed are listed using the TQAXCLASS macro. +<pre> TQAXFACTORY_END() +</pre>Finally the factory declaration is closed using the TQAXFACTORY_END +macro. +<p> To build the example you must first build the <a href="qaxserver.html">TQAxServer</a> library. Then run qmake and your make tool in +<tt>examples/multiple</tt>. +<p> <hr> +<p> The <a href="qaxserver-demo-multiple.html">demonstration</a> retquires your +WebBrowser to support ActiveX controls, and scripting to be enabled. +<p> + +<pre> <script language=javascript> + function setColor( form ) + { + Ax1.fillColor = form.colorEdit.value; + } + + function setWidth( form ) + { + Ax2.lineWidth = form.widthEdit.value; + } + </script> + + <p> + This is one TQWidget subclass:<br> + <object ID="Ax1" CLASSID="CLSID:1D9928BD-4453-4bdd-903D-E525ED17FDE5" + CODEBASE=http://www.trolltech.com/demos/multipleax.cab> + [Object not available! Did you forget to build and register the server?] + </object><br> + <form> + Fill Color: <input type="edit" ID="colorEdit" value = "red"> + <input type="button" value = "Set" onClick="setColor(this.form)"> + <input type="button" value = "Hide" onClick="Ax1.hide()"> + <input type="button" value = "Show" onClick="Ax1.show()"> + </form> + + <p> + This is another TQWidget subclass:<br> + <object ID="Ax2" CLASSID="CLSID:58139D56-6BE9-4b17-937D-1B1EDEDD5B71" + CODEBASE=http://www.trolltech.com/demos/multipleax.cab> + [Object not available! Did you forget to build and register the server?] + </object><br> + <form> + Line width: <input type="edit" ID="widthEdit" value = "1"> + <input type="button" value = "Set" onClick="setWidth(this.form)"> + </form> +</pre><p>See also <a href="qaxserver-examples.html">The TQAxServer Examples</a>. + +<!-- eof --> +<p><address><hr><div align=center> +<table width=100% cellspacing=0 border=0><tr> +<td>Copyright © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>TQt 3.3.8</div> +</table></div></address></body> +</html> |