source: trunk/doc/html/qfontdialog.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 6.7 KB
Line 
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/src/dialogs/qfontdialog.cpp:59 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QFontDialog Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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>QFontDialog Class Reference</h1>
33
34<p>The QFontDialog class provides a dialog widget for selecting a font.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qfontdialog-h.html">qfontdialog.h</a>&gt;</tt>
37<p>Inherits <a href="qdialog.html">QDialog</a>.
38<p><a href="qfontdialog-members.html">List of all member functions.</a>
39<h2>Static Public Members</h2>
40<ul>
41<li class=fn>QFont <a href="#getFont"><b>getFont</b></a> ( bool&nbsp;*&nbsp;ok, const&nbsp;QFont&nbsp;&amp;&nbsp;initial, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
42<li class=fn>QFont <a href="#getFont-2"><b>getFont</b></a> ( bool&nbsp;*&nbsp;ok, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
43</ul>
44<hr><a name="details"></a><h2>Detailed Description</h2>
45
46
47
48
49The QFontDialog class provides a dialog widget for selecting a font.
50<p> The usual way to use this class is to call one of the static convenience
51functions, e.g. <a href="#getFont">getFont</a>().
52<p> Examples:
53<p> <pre>
54 bool ok;
55 <a href="qfont.html">QFont</a> font = QFontDialog::<a href="#getFont">getFont</a>(
56 &amp;ok, QFont( "Helvetica [Cronyx]", 10 ), this );
57 if ( ok ) {
58 // font is set to the font the user selected
59 } else {
60 // the user canceled the dialog; font is set to the initial
61 // value, in this case Helvetica [Cronyx], 10
62 }
63 </pre>
64
65<p> The dialog can also be used to set a widget's font directly:
66<pre>
67 myWidget.setFont( QFontDialog::<a href="#getFont">getFont</a>( 0, myWidget.font() ) );
68 </pre>
69
70If the user clicks OK the font they chose will be used for myWidget,
71and if they click Cancel the original font is used.
72<p> <p>See also <a href="qfont.html">QFont</a>, <a href="qfontinfo.html">QFontInfo</a>, <a href="qfontmetrics.html">QFontMetrics</a>, and <a href="dialogs.html">Dialog Classes</a>.
73
74<p> <img src=qfontdlg-w.png>
75
76<hr><h2>Member Function Documentation</h2>
77<h3 class=fn><a href="qfont.html">QFont</a> <a name="getFont"></a>QFontDialog::getFont ( bool&nbsp;*&nbsp;ok, const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;initial, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )<tt> [static]</tt>
78</h3>
79Executes a modal font dialog and returns a font.
80<p> If the user clicks OK, the selected font is returned. If the user
81clicks Cancel, the <em>initial</em> font is returned.
82<p> The dialog is called <em>name</em>, with the parent <em>parent</em>.
83<em>initial</em> is the initially selected font.
84If the <em>ok</em> parameter is not-null, <em>*</em><em>ok</em> is set to TRUE if the
85user clicked OK, and set to FALSE if the user clicked Cancel.
86<p> This static function is less flexible than the full QFontDialog
87object, but is convenient and easy to use.
88<p> Examples:
89<pre>
90 bool ok;
91 <a href="qfont.html">QFont</a> font = QFontDialog::<a href="#getFont">getFont</a>( &amp;ok, QFont( "Times", 12 ), this );
92 if ( ok ) {
93 // font is set to the font the user selected
94 } else {
95 // the user canceled the dialog; font is set to the initial
96 // value, in this case Times, 12.
97 }
98 </pre>
99
100<p> The dialog can also be used to set a widget's font directly:
101<pre>
102 myWidget.setFont( QFontDialog::<a href="#getFont">getFont</a>( 0, myWidget.font() ) );
103 </pre>
104
105In this example, if the user clicks OK the font they chose will be
106used, and if they click Cancel the original font is used.
107
108<p>Examples: <a href="canvas-chart-example.html#x2881">chart/chartform.cpp</a>, <a href="tutorial2-09.html#x2638">chart/optionsform.cpp</a>, <a href="qfd-example.html#x1981">qfd/fontdisplayer.cpp</a>, <a href="qwerty-example.html#x368">qwerty/qwerty.cpp</a>, and <a href="xform-example.html#x1224">xform/xform.cpp</a>.
109<h3 class=fn><a href="qfont.html">QFont</a> <a name="getFont-2"></a>QFontDialog::getFont ( bool&nbsp;*&nbsp;ok, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )<tt> [static]</tt>
110</h3>
111This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
112<p> Executes a modal font dialog and returns a font.
113<p> If the user clicks OK, the selected font is returned. If the user
114clicks Cancel, the Qt default font is returned.
115<p> The dialog is called <em>name</em>, with parent <em>parent</em>.
116If the <em>ok</em> parameter is not-null, <em>*</em><em>ok</em> is set to TRUE if the
117user clicked OK, and FALSE if the user clicked Cancel.
118<p> This static function is less functional than the full QFontDialog
119object, but is convenient and easy to use.
120<p> Example:
121<pre>
122 bool ok;
123 <a href="qfont.html">QFont</a> font = QFontDialog::<a href="#getFont">getFont</a>( &amp;ok, this );
124 if ( ok ) {
125 // font is set to the font the user selected
126 } else {
127 // the user canceled the dialog; font is set to the default
128 // application font, QApplication::<a href="qwidget.html#font-prop">font</a>()
129 }
130 </pre>
131
132<p>
133<!-- eof -->
134<hr><p>
135This file is part of the <a href="index.html">Qt toolkit</a>.
136Copyright &copy; 1995-2007
137<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
138<table width=100% cellspacing=0 border=0><tr>
139<td>Copyright &copy; 2007
140<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
141<td align=right><div align=right>Qt 3.3.8</div>
142</table></div></address></body>
143</html>
Note: See TracBrowser for help on using the repository browser.