summaryrefslogtreecommitdiffstats
path: root/doc/html/qfontdialog.html
blob: 58f72be0df59ca3c6787763df3d1a2e0f86e4900 (plain)
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
<!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/src/dialogs/qfontdialog.cpp:59 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QFontDialog Class</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>QFontDialog Class Reference</h1>

<p>The QFontDialog class provides a dialog widget for selecting a font.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qfontdialog-h.html">qfontdialog.h</a>&gt;</tt>
<p>Inherits <a href="qdialog.html">QDialog</a>.
<p><a href="qfontdialog-members.html">List of all member functions.</a>
<h2>Static Public Members</h2>
<ul>
<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>
<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>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>




The QFontDialog class provides a dialog widget for selecting a font.
<p> The usual way to use this class is to call one of the static convenience
functions, e.g. <a href="#getFont">getFont</a>().
<p> Examples:
<p> <pre>
    bool ok;
    <a href="qfont.html">QFont</a> font = QFontDialog::<a href="#getFont">getFont</a>(
                    &amp;ok, QFont( "Helvetica [Cronyx]", 10 ), this );
    if ( ok ) {
        // font is set to the font the user selected
    } else {
        // the user canceled the dialog; font is set to the initial
        // value, in this case Helvetica [Cronyx], 10
    }
  </pre>
 
<p> The dialog can also be used to set a widget's font directly:
<pre>
    myWidget.setFont( QFontDialog::<a href="#getFont">getFont</a>( 0, myWidget.font() ) );
  </pre>
 
If the user clicks OK the font they chose will be used for myWidget,
and if they click Cancel the original font is used.
<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>.

<p> <img src=qfontdlg-w.png>

<hr><h2>Member Function Documentation</h2>
<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>
</h3>
Executes a modal font dialog and returns a font.
<p> If the user clicks OK, the selected font is returned. If the user
clicks Cancel, the <em>initial</em> font is returned.
<p> The dialog is called <em>name</em>, with the parent <em>parent</em>.
<em>initial</em> is the initially selected font.
If the <em>ok</em> parameter is not-null, <em>*</em><em>ok</em> is set to TRUE if the
user clicked OK, and set to FALSE if the user clicked Cancel.
<p> This static function is less flexible than the full QFontDialog
object, but is convenient and easy to use.
<p> Examples:
<pre>
    bool ok;
    <a href="qfont.html">QFont</a> font = QFontDialog::<a href="#getFont">getFont</a>( &amp;ok, QFont( "Times", 12 ), this );
    if ( ok ) {
        // font is set to the font the user selected
    } else {
        // the user canceled the dialog; font is set to the initial
        // value, in this case Times, 12.
    }
  </pre>
 
<p> The dialog can also be used to set a widget's font directly:
<pre>
    myWidget.setFont( QFontDialog::<a href="#getFont">getFont</a>( 0, myWidget.font() ) );
  </pre>
 
In this example, if the user clicks OK the font they chose will be
used, and if they click Cancel the original font is used.

<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>.
<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>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Executes a modal font dialog and returns a font.
<p> If the user clicks OK, the selected font is returned. If the user
clicks Cancel, the Qt default font is returned.
<p> The dialog is called <em>name</em>, with parent <em>parent</em>.
If the <em>ok</em> parameter is not-null, <em>*</em><em>ok</em> is set to TRUE if the
user clicked OK, and FALSE if the user clicked Cancel.
<p> This static function is less functional than the full QFontDialog
object, but is convenient and easy to use.
<p> Example:
<pre>
    bool ok;
    <a href="qfont.html">QFont</a> font = QFontDialog::<a href="#getFont">getFont</a>( &amp;ok, this );
    if ( ok ) {
        // font is set to the font the user selected
    } else {
        // the user canceled the dialog; font is set to the default
        // application font, QApplication::<a href="qwidget.html#font-prop">font</a>()
    }
  </pre>
 
<p> 
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<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>