1QFontDialog(3qt) QFontDialog(3qt)
2
3
4
6 QFontDialog - Dialog widget for selecting a font
7
9 #include <qfontdialog.h>
10
11 Inherits QDialog.
12
13 Static Public Members
14 <li class=fn>QFont getFont ( bool * ok, const QFont & initial, QWidget
15 * parent = 0, const char * name = 0 ) <li class=fn>QFont getFont ( bool
16 * ok, QWidget * parent = 0, const char * name = 0 )
17
19 The QFontDialog class provides a dialog widget for selecting a font.
20
21 The usual way to use this class is to call one of the static
22 convenience functions, e.g. getFont().
23
24 Examples:
25
26 bool ok;
27 QFont font = QFontDialog::getFont(
28 &ok, QFont( "Helvetica [Cronyx]", 10 ), this );
29 if ( ok ) {
30 // font is set to the font the user selected
31 } else {
32 // the user canceled the dialog; font is set to the initial
33 // value, in this case Helvetica [Cronyx], 10
34 }
35
36 The dialog can also be used to set a widget's font directly:
37
38 myWidget.setFont( QFontDialog::getFont( 0, myWidget.font() ) );
39 If the user clicks OK the font they chose will be used for myWidget,
40 and if they click Cancel the original font is used.
41
42 See also QFont, QFontInfo, QFontMetrics, and Dialog Classes.
43
44 [Image Omitted]
45
48 parent = 0, const char * name = 0 ) [static]
49 Executes a modal font dialog and returns a font.
50
51 If the user clicks OK, the selected font is returned. If the user
52 clicks Cancel, the initial font is returned.
53
54 The dialog is called name, with the parent parent. initial is the
55 initially selected font. If the ok parameter is not-null, *ok is set to
56 TRUE if the user clicked OK, and set to FALSE if the user clicked
57 Cancel.
58
59 This static function is less flexible than the full QFontDialog object,
60 but is convenient and easy to use.
61
62 Examples:
63
64 bool ok;
65 QFont font = QFontDialog::getFont( &ok, QFont( "Times", 12 ), this );
66 if ( ok ) {
67 // font is set to the font the user selected
68 } else {
69 // the user canceled the dialog; font is set to the initial
70 // value, in this case Times, 12.
71 }
72
73 The dialog can also be used to set a widget's font directly:
74
75 myWidget.setFont( QFontDialog::getFont( 0, myWidget.font() ) );
76 In this example, if the user clicks OK the font they chose will be
77 used, and if they click Cancel the original font is used.
78
79 Examples:
80
82 name = 0 ) [static]
83 This is an overloaded member function, provided for convenience. It
84 behaves essentially like the above function.
85
86 Executes a modal font dialog and returns a font.
87
88 If the user clicks OK, the selected font is returned. If the user
89 clicks Cancel, the Qt default font is returned.
90
91 The dialog is called name, with parent parent. If the ok parameter is
92 not-null, *ok is set to TRUE if the user clicked OK, and FALSE if the
93 user clicked Cancel.
94
95 This static function is less functional than the full QFontDialog
96 object, but is convenient and easy to use.
97
98 Example:
99
100 bool ok;
101 QFont font = QFontDialog::getFont( &ok, this );
102 if ( ok ) {
103 // font is set to the font the user selected
104 } else {
105 // the user canceled the dialog; font is set to the default
106 // application font, QApplication::font()
107 }
108
110 http://doc.trolltech.com/qfontdialog.html
111 http://www.trolltech.com/faq/tech.html
112
114 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
115 license file included in the distribution for a complete license
116 statement.
117
119 Generated automatically from the source code.
120
122 If you find a bug in Qt, please report it as described in
123 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
124 help you. Thank you.
125
126 The definitive Qt documentation is provided in HTML format; it is
127 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
128 web browser. This man page is provided as a convenience for those users
129 who prefer man pages, although this format is not officially supported
130 by Trolltech.
131
132 If you find errors in this manual page, please report them to qt-
133 bugs@trolltech.com. Please include the name of the manual page
134 (qfontdialog.3qt) and the Qt version (3.3.8).
135
136
137
138Trolltech AS 2 February 2007 QFontDialog(3qt)