This file is indexed.

/usr/share/qt3/doc/html/qaxserver-example-hierarchy.html is in qt3-doc 3:3.3.8-b-8ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!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/hierarchy/hierarchy.doc:47 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Widget Hierarchy (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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>Qt Widget Hierarchy (in-process)</h1>

 

The ActiveX control in this example is a <a href="qwidget.html">QWidget</a>
subclass with child widgets that are accessible as sub types.
<p> 

<pre>    class QParentWidget : public <a href="qwidget.html">QWidget</a>
    {
        <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>
    public:
        QParentWidget( <a href="qwidget.html">QWidget</a> *parent = 0, const char *name = 0, WFlags f = 0 );

        <a href="qsize.html">QSize</a> sizeHint() const;

    public slots:
        void createSubWidget( const <a href="qstring.html">QString</a> &amp;name );

        QSubWidget *subWidget( const <a href="qstring.html">QString</a> &amp;name );

    private:
        <a href="qvboxlayout.html">QVBoxLayout</a> *vbox;
    };
</pre>The <tt>QParentWidget</tt> class provides slots to create a widget
with a name, and to return a pointer to a named widget.
<p> 

<pre>    QParentWidget::QParentWidget( <a href="qwidget.html">QWidget</a> *parent, const char *name, WFlags f )
    : <a href="qwidget.html">QWidget</a>( parent, name, f )
    {
        vbox = new <a href="qvboxlayout.html">QVBoxLayout</a>( this );
    <a name="x2649"></a>    vbox-&gt;<a href="qlayout.html#setAutoAdd">setAutoAdd</a>( TRUE );
    }
</pre>The constructor of QParentWidget creates a vertical box layout.
New child widgets are automatically added to the layout.
<p> <pre>    void QParentWidget::createSubWidget( const <a href="qstring.html">QString</a> &amp;name )
    {
        QSubWidget *sw = new QSubWidget( this, name );
        sw-&gt;setLabel( name );
        sw-&gt;<a href="qwidget.html#show">show</a>();
    }
</pre>The <tt>createSubWidget</tt> slot creates a new <tt>QSubWidget</tt> with
the name provided in the parameter, and sets the label to that
name. The widget is also shown explicitly.
<p> <pre>    QSubWidget *QParentWidget::subWidget( const <a href="qstring.html">QString</a> &amp;name )
    {
        return (QSubWidget*)<a href="qobject.html#child">child</a>( name, "QSubWidget" );
    }
</pre>The <tt>subWidget</tt> slot uses the <a href="qobject.html#child">QObject::child</a>() function and
returns the first child of type <tt>QSubWidget</tt> that has the requested
name.
<p> 

<pre>    class QSubWidget : public <a href="qwidget.html">QWidget</a>
    {
        Q_OBJECT
        Q_PROPERTY( QString label READ label WRITE setLabel )
    public:
        QSubWidget( <a href="qwidget.html">QWidget</a> *parent = 0, const char *name = 0, WFlags f = 0 );

        void setLabel( const <a href="qstring.html">QString</a> &amp;text );
        <a href="qstring.html">QString</a> label() const;

        <a href="qsize.html">QSize</a> sizeHint() const;

    protected:
        void paintEvent( <a href="qpaintevent.html">QPaintEvent</a> *e );

    private:
        <a href="qstring.html">QString</a> lbl;
    };
</pre>The <tt>QSubWidget</tt> class has a single string-property <tt>label</tt>,
and implements the paintEvent to draw the label.
<p> 

<pre>    QSubWidget::QSubWidget( <a href="qwidget.html">QWidget</a> *parent, const char *name, WFlags f )
    : <a href="qwidget.html">QWidget</a>( parent, name, f )
    {
    }

    void QSubWidget::setLabel( const <a href="qstring.html">QString</a> &amp;text )
    {
        lbl = text;
        <a href="qobject.html#setName">setName</a>( text );
        <a href="qwidget.html#update">update</a>();
    }

    QString QSubWidget::label() const
    {
        return lbl;
    }

    QSize QSubWidget::<a href="qwidget.html#sizeHint">sizeHint</a>() const
    {
        <a href="qfontmetrics.html">QFontMetrics</a> fm( <a href="qwidget.html#font">font</a>() );
        return QSize( fm.<a href="qfontmetrics.html#width">width</a>(lbl), fm.<a href="qfontmetrics.html#height">height</a>() );
    }

    void QSubWidget::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">QPaintEvent</a> * )
    {
        <a href="qpainter.html">QPainter</a> painter(this);
        painter.<a href="qpainter.html#setPen">setPen</a>( <a href="qwidget.html#colorGroup">colorGroup</a>().text() );
        painter.<a href="qpainter.html#drawText">drawText</a>( <a href="qwidget.html#rect">rect</a>(), AlignCenter, lbl );
    }
</pre>The implementation of the QSubWidget class is self-explanatory.
<p> 

<pre>    class ActiveQtFactory : public <a href="qaxfactory.html">QAxFactory</a>
    {
    public:
        ActiveQtFactory( const <a href="quuid.html">QUuid</a> &amp;lib, const <a href="quuid.html">QUuid</a> &amp;app )
            : <a href="qaxfactory.html">QAxFactory</a>( lib, app )
        {}
        <a href="qstringlist.html">QStringList</a> featureList() const
        {
            <a href="qstringlist.html">QStringList</a> list;
            list &lt;&lt; "QParentWidget";
            list &lt;&lt; "QSubWidget";
            return list;
        }
</pre>The <tt>ActiveQtFactory</tt> class implements a <a href="qaxfactory.html">QAxFactory</a>. It returns
the class names of all supported types, <tt>QParentWidget</tt> and
<tt>QSubWidget</tt>, from the <tt>featureList()</tt> reimplementation.
<p> <pre>        <a href="qwidget.html">QWidget</a> *create( const <a href="qstring.html">QString</a> &amp;key, QWidget *parent, const char *name )
        {
            if ( key == "QParentWidget" )
                return new QParentWidget( parent, name );

            return 0;
        }
</pre>The factory can however only create objects of the <tt>QParentWidget</tt>
type directly - objects of subtypes can only be created through the
interface of <tt>QParentWidget</tt> objects.
<p> <pre>        <a href="quuid.html">QUuid</a> classID( const <a href="qstring.html">QString</a> &amp;key ) const
        {
            if ( key == "QParentWidget" )
                return QUuid( "{d574a747-8016-46db-a07c-b2b4854ee75c}" );
            if ( key == "QSubWidget" )
                return QUuid( "{850652f4-8f71-4f69-b745-bce241ccdc30}" );

            return QUuid();
        }
        <a href="quuid.html">QUuid</a> interfaceID( const <a href="qstring.html">QString</a> &amp;key ) const
        {
            if ( key == "QParentWidget" )
                return QUuid( "{4a30719d-d9c2-4659-9d16-67378209f822}" );
            if ( key == "QSubWidget" )
                return QUuid( "{2d76cc2f-3488-417a-83d6-debff88b3c3f}" );

            return QUuid();
        }
        <a href="quuid.html">QUuid</a> eventsID( const <a href="qstring.html">QString</a> &amp;key ) const
        {
            if ( key == "QParentWidget" )
                return QUuid( "{aac9f855-c3dc-4cae-b747-c77f4d509f4c}" );
            if ( key == "QSubWidget" )
                return QUuid( "{25fac47e-c723-4696-8c74-6185903bdf65}" );

            return QUuid();
        }
</pre>COM however requires the IDs for the interfaces of the sub types as
well to be able to marshal calls correctly.
<p> <pre>        <a href="qstring.html">QString</a> exposeToSuperClass( const <a href="qstring.html">QString</a> &amp;key ) const
        {
            if ( key == "QSubWidget" )
                return key;
            return QAxFactory::exposeToSuperClass(key);
        }
    };
</pre>Objects of the <tt>QSubWidget</tt> type should not expose the full 
functionality of e.g. <a href="qwidget.html">QWidget</a>. Only those properties and slots
explicitly declared in the type are accessible.
<p> <pre>    QAXFACTORY_EXPORT( ActiveQtFactory, "{9e626211-be62-4d18-9483-9419358fbb03}", "{75c276de-1df5-451f-a004-e4fa1a587df1}" )
</pre>The factory is then exported using the <a href="qaxfactory.html#QAXFACTORY_EXPORT">QAXFACTORY_EXPORT</a>
macro.
<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 
<tt>examples/multiple</tt>.
<p> <hr>
<p> The <a href="qaxserver-demo-hierarchy.html">demonstration</a> requires your
WebBrowser to support ActiveX controls, and scripting to be enabled.
<p> 

<pre>    &lt;script language=javascript&gt;
    function createSubWidget( form )
    {
        ParentWidget.createSubWidget( form.nameEdit.value );
    }

    function renameSubWidget( form )
    {
        var SubWidget = ParentWidget.subWidget( form.nameEdit.value );
        if ( !SubWidget ) {
            alert( "No such widget " + form.nameEdit.value + "!" );
            return;
        }
        SubWidget.label = form.labelEdit.value;
        form.nameEdit.value = SubWidget.label;
    }

    function setFont( form )
    {
        ParentWidget.font = form.fontEdit.value;
    }
    &lt;/script&gt;

    &lt;p&gt;
    This widget can have many children!&lt;br&gt;
    &lt;object ID="ParentWidget" CLASSID="CLSID:d574a747-8016-46db-a07c-b2b4854ee75c"
    CODEBASE=http://www.trolltech.com/demos/hierarchy.cab&gt;
    [Object not available! Did you forget to build and register the server?]
    &lt;/object&gt;&lt;br&gt;
    &lt;form&gt;
    &lt;input type="edit" ID="nameEdit" value = "&lt;enter object name&gt;"&gt;
    &lt;input type="button" value = "Create" onClick="createSubWidget(this.form)"&gt;
    &lt;input type="edit" ID="labelEdit"&gt;
    &lt;input type="button" value = "Rename" onClick="renameSubWidget(this.form)"&gt;
    &lt;br&gt;
    &lt;input type="edit" ID="fontEdit" value = "MS Sans Serif"&gt;
    &lt;input type="button" value = "Set Font" onClick="setFont(this.form)"&gt;
    &lt;/form&gt;
</pre><p>See also <a href="qaxserver-examples.html">The QAxServer Examples</a>.

<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>