~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/activeqt-wrapper.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/doc/src/examples/activeqt/wrapper.qdoc -->
 
6
<head>
 
7
    <title>Qt 4.0: Wrapper Example (ActiveQt)</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Wrapper Example (ActiveQt)</h1>
 
21
<p>Files:</p>
 
22
<ul>
 
23
<li><a href="activeqt-wrapper-main-cpp.html">activeqt/wrapper/main.cpp</a></li>
 
24
</ul>
 
25
<p>The Wrapper example demonstrates how to export existing <a href="qwidget.html">QWidget</a> classes as ActiveX controls, and the use of <a href="qaxfactory.html">QAxFactory</a> together with the <tt>QAXFACTORY_EXPORT()</tt> macro. ActiveX controls in this example are the standard button classes <a href="qpushbutton.html">QPushButton</a>, <a href="qcheckbox.html">QCheckBox</a> and <a href="qradiobutton.html">QRadioButton</a> as provided by Qt.</p>
 
26
<pre>&nbsp;   class ActiveQtFactory : public QAxFactory
 
27
    {
 
28
    public:
 
29
        ActiveQtFactory( const QUuid &amp;lib, const QUuid &amp;app )
 
30
            : QAxFactory( lib, app )
 
31
        {}
 
32
        QStringList featureList() const
 
33
        {
 
34
            QStringList list;
 
35
            list &lt;&lt; &quot;QCheckBox&quot;;
 
36
            list &lt;&lt; &quot;QRadioButton&quot;;
 
37
            list &lt;&lt; &quot;QPushButton&quot;;
 
38
            list &lt;&lt; &quot;QToolButton&quot;;
 
39
            return list;
 
40
        }
 
41
        QObject *createObject(const QString &amp;key)
 
42
        {
 
43
            if ( key == &quot;QCheckBox&quot; )
 
44
                return new QCheckBox(0);
 
45
            if ( key == &quot;QRadioButton&quot; )
 
46
                return new QRadioButton(0);
 
47
            if ( key == &quot;QPushButton&quot; )
 
48
                return new QPushButton(0 );
 
49
            if ( key == &quot;QToolButton&quot; ) {
 
50
                QToolButton *tb = new QToolButton(0);
 
51
    //          tb-&gt;setIcon( QPixmap(fileopen) );
 
52
                return tb;
 
53
            }
 
54
 
 
55
            return 0;
 
56
        }
 
57
        const QMetaObject *metaObject( const QString &amp;key ) const
 
58
        {
 
59
            if ( key == &quot;QCheckBox&quot; )
 
60
                return &amp;QCheckBox::staticMetaObject;
 
61
            if ( key == &quot;QRadioButton&quot; )
 
62
                return &amp;QRadioButton::staticMetaObject;
 
63
            if ( key == &quot;QPushButton&quot; )
 
64
                return &amp;QPushButton::staticMetaObject;
 
65
            if ( key == &quot;QToolButton&quot; )
 
66
                return &amp;QToolButton::staticMetaObject;
 
67
 
 
68
            return 0;
 
69
        }
 
70
        QUuid classID( const QString &amp;key ) const
 
71
        {
 
72
            if ( key == &quot;QCheckBox&quot; )
 
73
                return &quot;{6E795DE9-872D-43CF-A831-496EF9D86C68}&quot;;
 
74
            if ( key == &quot;QRadioButton&quot; )
 
75
                return &quot;{AFCF78C8-446C-409A-93B3-BA2959039189}&quot;;
 
76
            if ( key == &quot;QPushButton&quot; )
 
77
                return &quot;{2B262458-A4B6-468B-B7D4-CF5FEE0A7092}&quot;;
 
78
            if ( key == &quot;QToolButton&quot; )
 
79
                return &quot;{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}&quot;;
 
80
 
 
81
            return QUuid();
 
82
        }
 
83
        QUuid interfaceID( const QString &amp;key ) const
 
84
        {
 
85
            if ( key == &quot;QCheckBox&quot; )
 
86
                return &quot;{4FD39DD7-2DE0-43C1-A8C2-27C51A052810}&quot;;
 
87
            if ( key == &quot;QRadioButton&quot; )
 
88
                return &quot;{7CC8AE30-206C-48A3-A009-B0A088026C2F}&quot;;
 
89
            if ( key == &quot;QPushButton&quot; )
 
90
                return &quot;{06831CC9-59B6-436A-9578-6D53E5AD03D3}&quot;;
 
91
            if ( key == &quot;QToolButton&quot; )
 
92
                return &quot;{6726080f-d63d-4950-a366-9bf33e5cdf84}&quot;;
 
93
 
 
94
            return QUuid();
 
95
        }
 
96
        QUuid eventsID( const QString &amp;key ) const
 
97
        {
 
98
            if ( key == &quot;QCheckBox&quot; )
 
99
                return &quot;{FDB6FFBE-56A3-4E90-8F4D-198488418B3A}&quot;;
 
100
            if ( key == &quot;QRadioButton&quot; )
 
101
                return &quot;{73EE4860-684C-4A66-BF63-9B9EFFA0CBE5}&quot;;
 
102
            if ( key == &quot;QPushButton&quot; )
 
103
                return &quot;{3CC3F17F-EA59-4B58-BBD3-842D467131DD}&quot;;
 
104
            if ( key == &quot;QToolButton&quot; )
 
105
                return &quot;{f4d421fd-4ead-4fd9-8a25-440766939639}&quot;;
 
106
 
 
107
            return QUuid();
 
108
        }
 
109
    };</pre>
 
110
<p>The factory implementation returns the list of supported controls, creates controls on request and provides information about the unique IDs of the COM classes and interfaces for each control.</p>
 
111
<pre>&nbsp;   QAXFACTORY_EXPORT( ActiveQtFactory, &quot;{3B756301-0075-4E40-8BE8-5A81DE2426B7}&quot;, &quot;{AB068077-4924-406a-BBAF-42D91C8727DD}&quot; )</pre>
 
112
<p>The factory is exported using the QAXFACTORY_EXPORT macro.</p>
 
113
<p>To build the example you must first build the <a href="qaxserver.html#qaxserver">QAxServer</a> library. Then run <tt>qmake</tt> and your make tool in <tt>examples/activeqt/wrapper</tt>.</p>
 
114
<p>The <a href="qaxserver-demo-wrapper.html">demonstration</a> requires your WebBrowser to support ActiveX controls, and scripting to be enabled.</p>
 
115
<pre>&nbsp;   &lt;SCRIPT LANGUAGE=&quot;VBScript&quot;&gt;
 
116
    Sub ToolButton_Clicked()
 
117
        RadioButton.text = InputBox( &quot;Enter something&quot;, &quot;Wrapper Demo&quot; )
 
118
    End Sub
 
119
 
 
120
    Sub PushButton_clicked()
 
121
        MsgBox( &quot;Thank you!&quot; )
 
122
    End Sub
 
123
 
 
124
    Sub CheckBox_toggled( state )
 
125
        if state = 0 then
 
126
            CheckBox.text = &quot;Check me!&quot;
 
127
        else
 
128
            CheckBox.text = &quot;Uncheck me!&quot;
 
129
        end if
 
130
    End Sub
 
131
    &lt;/SCRIPT&gt;
 
132
    &lt;p /&gt;
 
133
    A QPushButton:&lt;br /&gt;
 
134
    &lt;object ID=&quot;PushButton&quot; CLASSID=&quot;CLSID:2B262458-A4B6-468B-B7D4-CF5FEE0A7092&quot;
 
135
    CODEBASE=&quot;http://www.trolltech.com/demos/wrapperax.cab&quot;&gt;
 
136
        &lt;PARAM NAME=&quot;text&quot; VALUE=&quot;Click me!&quot; /&gt;
 
137
    [Object not available! Did you forget to build and register the server?]
 
138
    &lt;/object&gt;&lt;br /&gt;
 
139
 
 
140
    &lt;p /&gt;
 
141
    A QCheckBox:&lt;br /&gt;
 
142
    &lt;object ID=&quot;CheckBox&quot; CLASSID=&quot;CLSID:6E795de9-872d-43cf-a831-496ef9d86c68&quot;
 
143
    CODEBASE=&quot;http://www.trolltech.com/demos/wrapperax.cab&quot;&gt;
 
144
        &lt;PARAM NAME=&quot;text&quot; VALUE=&quot;Check me!&quot; /&gt;
 
145
    [Object not available! Did you forget to build and register the server?]
 
146
    &lt;/object&gt;&lt;br /&gt;
 
147
 
 
148
    &lt;p /&gt;
 
149
    A QToolButton:&lt;br /&gt;
 
150
    &lt;object ID=&quot;ToolButton&quot; CLASSID=&quot;CLSID:7c0ffe7a-60c3-4666-bde2-5cf2b54390a1&quot;
 
151
    CODEBASE=&quot;http://www.trolltech.com/demos/wrapperax.cab&quot;&gt;
 
152
    [Object not available! Did you forget to build and register the server?]
 
153
    &lt;/object&gt;&lt;br /&gt;
 
154
 
 
155
    &lt;p /&gt;
 
156
    A QRadioButton:&lt;br /&gt;
 
157
    &lt;object ID=&quot;RadioButton&quot; CLASSID=&quot;CLSID:afcf78c8-446c-409a-93b3-ba2959039189&quot;
 
158
    CODEBASE=&quot;http://www.trolltech.com/demos/wrapperax.cab&quot;&gt;
 
159
        &lt;PARAM NAME=&quot;text&quot; VALUE=&quot;Tune me!&quot; /&gt;
 
160
    [Object not available! Did you forget to build and register the server?]
 
161
    &lt;/object&gt;&lt;br /&gt;</pre>
 
162
<p /><address><hr /><div align="center">
 
163
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
164
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
165
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
166
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
167
</tr></table></div></address></body>
 
168
</html>