This file is indexed.

/usr/share/qt3/doc/html/simple-font-demo-example.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
263
264
265
266
267
268
269
270
271
272
273
<!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/examples/fonts/simple-qfont-demo/simple-qfont-demo.doc:1 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>A simple demonstration of QFont member functions</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>A simple demonstration of QFont member functions</h1>

 
<p> 
<p> This example demonstrates the use of various
<a href="qfont.html">QFont</a> member functions.
<p> <hr>
<p> The main window API (viewer.h):
<p> <pre>/* $Id: qt/viewer.h   3.3.8   edited May 27 2003 $ */

#ifndef VIEWER_H
#define VIEWER_H


#include &lt;<a href="qwidget-h.html">qwidget.h</a>&gt;
#include &lt;<a href="qfont-h.html">qfont.h</a>&gt;

class QTextView;
class QPushButton;

class Viewer : public <a href="qwidget.html">QWidget</a>
{
<a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a>

public:
    Viewer();

private slots:
    void setDefault();
    void setSansSerif();
    void setItalics();

private:
    void setFontSubstitutions();
    void layout();
    void showFontInfo( <a href="qfont.html">QFont</a> &amp; );

    <a href="qtextview.html">QTextView</a> * greetings;
    <a href="qtextview.html">QTextView</a> * fontInfo;

    <a href="qpushbutton.html">QPushButton</a> * defaultButton;
    <a href="qpushbutton.html">QPushButton</a> * sansSerifButton;
    <a href="qpushbutton.html">QPushButton</a> * italicsButton;
};

#endif
</pre>

<p> <hr>
<p> The main window implementation (viewer.cpp):
<p> <pre>/* $Id: qt/viewer.cpp   3.3.8   edited May 27 2003 $ */

#include "viewer.h"
#include &lt;<a href="qstring-h.html">qstring.h</a>&gt;
#include &lt;<a href="qstringlist-h.html">qstringlist.h</a>&gt;
#include &lt;<a href="qtextview-h.html">qtextview.h</a>&gt;
#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
#include &lt;<a href="qlayout-h.html">qlayout.h</a>&gt;

<a name="f590"></a>Viewer::Viewer()
       :<a href="qwidget.html">QWidget</a>()
{
    setFontSubstitutions();

<a name="x2850"></a>    <a href="qstring.html">QString</a> greeting_heb = QString::<a href="qstring.html#fromUtf8">fromUtf8</a>( "\327\251\327\234\327\225\327\235" );
    <a href="qstring.html">QString</a> greeting_ru = QString::<a href="qstring.html#fromUtf8">fromUtf8</a>( "\320\227\320\264\321\200\320\260\320\262\321\201\321\202\320\262\321\203\320\271\321\202\320\265" );
    <a href="qstring.html">QString</a> greeting_en( "Hello" );

    greetings = new <a href="qtextview.html">QTextView</a>( this, "textview" );

    greetings-&gt;<a href="qtextedit.html#setText">setText</a>( greeting_en + "\n" +
                       greeting_ru + "\n" +
                       greeting_heb );

    fontInfo = new <a href="qtextview.html">QTextView</a>( this, "fontinfo" );

    setDefault();

    defaultButton = new <a href="qpushbutton.html">QPushButton</a>( "Default", this,
                                                   "pushbutton1" );
<a name="x2860"></a>    defaultButton-&gt;<a href="qwidget.html#setFont">setFont</a>( QFont( "times" ) );
    <a href="qobject.html#connect">connect</a>( defaultButton, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ),
             this, SLOT( setDefault() ) );

    sansSerifButton = new <a href="qpushbutton.html">QPushButton</a>( "Sans Serif", this,
                                                     "pushbutton2" );
    sansSerifButton-&gt;<a href="qwidget.html#setFont">setFont</a>( QFont( "Helvetica", 12 ) );
    <a href="qobject.html#connect">connect</a>( sansSerifButton, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ),
             this, SLOT( setSansSerif() ) );

    italicsButton = new <a href="qpushbutton.html">QPushButton</a>( "Italics", this,
                                                   "pushbutton3" );
    italicsButton-&gt;<a href="qwidget.html#setFont">setFont</a>( QFont( "lucida", 12, QFont::Bold, TRUE ) );
    <a href="qobject.html#connect">connect</a>( italicsButton, SIGNAL( <a href="qbutton.html#clicked">clicked</a>() ),
             this, SLOT( setItalics() ) );

    <a href="qwidget.html#layout">layout</a>();
}

void <a name="f591"></a>Viewer::setDefault()
{
    <a href="qfont.html">QFont</a> font( "Bavaria" );
<a name="x2843"></a>    font.<a href="qfont.html#setPointSize">setPointSize</a>( 24 );

<a name="x2846"></a>    font.<a href="qfont.html#setWeight">setWeight</a>( QFont::Bold );
<a name="x2845"></a>    font.<a href="qfont.html#setUnderline">setUnderline</a>( TRUE );

    greetings-&gt;<a href="qwidget.html#setFont">setFont</a>( font );

    showFontInfo( font );
}

void <a name="f592"></a>Viewer::setSansSerif()
{
    <a href="qfont.html">QFont</a> font( "Newyork", 18 );
<a name="x2844"></a>    font.<a href="qfont.html#setStyleHint">setStyleHint</a>( QFont::SansSerif );
    greetings-&gt;<a href="qwidget.html#setFont">setFont</a>( font );

    showFontInfo( font );
}

void <a name="f593"></a>Viewer::setItalics()
{
    <a href="qfont.html">QFont</a> font( "Tokyo" );
    font.<a href="qfont.html#setPointSize">setPointSize</a>( 32 );
    font.<a href="qfont.html#setWeight">setWeight</a>( QFont::Bold );
<a name="x2842"></a>    font.<a href="qfont.html#setItalic">setItalic</a>( TRUE );

    greetings-&gt;<a href="qwidget.html#setFont">setFont</a>( font );

    showFontInfo( font );
}

void <a name="f594"></a>Viewer::showFontInfo( <a href="qfont.html">QFont</a> &amp; font )
{
    <a href="qfontinfo.html">QFontInfo</a> info( font );

    <a href="qstring.html">QString</a> messageText;
    messageText = "Font requested: \"" +
<a name="x2838"></a>                  font.<a href="qfont.html#family">family</a>() + "\" " +
<a name="x2851"></a><a name="x2841"></a>                  QString::<a href="qstring.html#number">number</a>( font.<a href="qfont.html#pointSize">pointSize</a>() ) + "pt&lt;BR&gt;" +
                  "Font used: \"" +
<a name="x2848"></a>                  info.<a href="qfontinfo.html#family">family</a>() + "\" " +
<a name="x2849"></a>                  QString::<a href="qstring.html#number">number</a>( info.<a href="qfontinfo.html#pointSize">pointSize</a>() ) + "pt&lt;P&gt;";

<a name="x2847"></a>    <a href="qstringlist.html">QStringList</a> substitutions = QFont::<a href="qfont.html#substitutes">substitutes</a>( font.<a href="qfont.html#family">family</a>() );

<a name="x2856"></a>    if ( ! substitutions.<a href="qvaluelist.html#isEmpty">isEmpty</a>() ){
        messageText += "The following substitutions exist for " + \
                       font.<a href="qfont.html#family">family</a>() + ":&lt;UL&gt;";

        QStringList::Iterator i = substitutions.<a href="qvaluelist.html#begin">begin</a>();
        while ( i != substitutions.<a href="qvaluelist.html#end">end</a>() ){
            messageText += "&lt;LI&gt;\"" + (* i) + "\"";
            i++;
        }
         messageText += "&lt;/UL&gt;";
    } else {
        messageText += "No substitutions exist for " + \
                       font.<a href="qfont.html#family">family</a>() + ".";
    }

    fontInfo-&gt;<a href="qtextedit.html#setText">setText</a>( messageText );
}

void <a name="f595"></a>Viewer::setFontSubstitutions()
{
    <a href="qstringlist.html">QStringList</a> substitutes;
<a name="x2853"></a>    substitutes.<a href="qvaluelist.html#append">append</a>( "Times" );
    substitutes +=  "Mincho",
    substitutes &lt;&lt; "Arabic Newspaper" &lt;&lt; "crox";

<a name="x2840"></a>    QFont::<a href="qfont.html#insertSubstitutions">insertSubstitutions</a>( "Bavaria", substitutes );

<a name="x2839"></a>    QFont::<a href="qfont.html#insertSubstitution">insertSubstitution</a>( "Tokyo", "Lucida" );
}


// For those who prefer to use Qt Designer for creating GUIs
// the following function might not be of particular interest:
// all it does is creating the widget layout.

<a name="x2858"></a>void Viewer::<a href="qwidget.html#layout">layout</a>()
{
    <a href="qhboxlayout.html">QHBoxLayout</a> * textViewContainer = new <a href="qhboxlayout.html">QHBoxLayout</a>();
    textViewContainer-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( greetings );
    textViewContainer-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( fontInfo );

    <a href="qhboxlayout.html">QHBoxLayout</a> * buttonContainer = new <a href="qhboxlayout.html">QHBoxLayout</a>();

    buttonContainer-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( defaultButton );
    buttonContainer-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( sansSerifButton );
    buttonContainer-&gt;<a href="qboxlayout.html#addWidget">addWidget</a>( italicsButton );

<a name="x2857"></a>    int maxButtonHeight = defaultButton-&gt;<a href="qwidget.html#height">height</a>();

    if ( sansSerifButton-&gt;<a href="qwidget.html#height">height</a>() &gt; maxButtonHeight )
        maxButtonHeight = sansSerifButton-&gt;<a href="qwidget.html#height">height</a>();
    if ( italicsButton-&gt;<a href="qwidget.html#height">height</a>() &gt; maxButtonHeight )
        maxButtonHeight = italicsButton-&gt;<a href="qwidget.html#height">height</a>();

<a name="x2859"></a>    defaultButton-&gt;<a href="qwidget.html#setFixedHeight">setFixedHeight</a>( maxButtonHeight );
    sansSerifButton-&gt;<a href="qwidget.html#setFixedHeight">setFixedHeight</a>( maxButtonHeight );
    italicsButton-&gt;<a href="qwidget.html#setFixedHeight">setFixedHeight</a>( maxButtonHeight );

    <a href="qvboxlayout.html">QVBoxLayout</a> * container = new <a href="qvboxlayout.html">QVBoxLayout</a>( this );
<a name="x2835"></a>    container-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( textViewContainer );
    container-&gt;<a href="qboxlayout.html#addLayout">addLayout</a>( buttonContainer );

    <a href="qwidget.html#resize">resize</a>( 700, 250 );
}
</pre>

<p> <hr>
<p> main() program (simple-qfont-demo.cpp):
<p> <pre>/* $Id: qt/simple-qfont-demo.cpp   3.3.8   edited May 27 2003 $ */

#include "viewer.h"

#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;

int main( int argc, char **argv )
{
    <a href="qapplication.html">QApplication</a> app( argc, argv );
    Viewer * textViewer = new Viewer();
    textViewer-&gt;<a href="qwidget.html#setCaption">setCaption</a>( "Qt Example - Simple QFont Demo" );
    app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( textViewer );
    textViewer-&gt;<a href="qwidget.html#show">show</a>();
    return app.<a href="qapplication.html#exec">exec</a>();
}
</pre>

<p> <p>See also <a href="qfont-examples.html">QFont 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>