19
23
<span class="comment">// the user canceled the dialog; font is set to the initial</span>
20
24
<span class="comment">// value, in this case Helvetica [Cronyx], 10</span>
22
27
<p>The dialog can also be used to set a widget's font directly:</p>
23
<pre> myWidget.setFont(QFontDialog.getFont(0, myWidget.font()));</pre>
24
<p>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>
25
<p align="center"><img alt="A font dialog in the Plastique widget style." src="images/plastique-fontdialog.png" /></p><p>See also <a href="qfont.html">QFont</a>, <a href="qfontinfo.html">QFontInfo</a>, <a href="qfontmetrics.html">QFontMetrics</a>, <a href="qcolordialog.html">QColorDialog</a>, <a href="qfiledialog.html">QFileDialog</a>, <a href="qprintdialog.html">QPrintDialog</a>, and <a href="dialogs-standarddialogs.html">Standard Dialogs Example</a>.</p>
26
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="FontDialogOption-enum" />QFontDialog.FontDialogOption</h3><p>This enum specifies various options that affect the look and feel of a font dialog.</p>
27
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
28
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
29
<tr><td valign="top"><tt>QFontDialog.NoButtons</tt></td><td align="center" valign="top"><tt>0x00000001</tt></td><td valign="top">Don't display <b>OK</b> and <b>Cancel</b> buttons. (Useful for "live dialogs".)</td></tr>
30
<tr><td valign="top"><tt>QFontDialog.DontUseNativeDialog</tt></td><td align="center" valign="top"><tt>0x00000002</tt></td><td valign="top">Use Qt's standard font dialog on the Mac instead of Apple's native font panel. (Currently, the native dialog is never used, but this is likely to change in future Qt releases.)</td></tr>
28
<pre class="highlightedCode brush: cpp">
29
myWidget.setFont(QFontDialog.getFont(0, myWidget.font()));
31
<p>If the user clicks OK the font they chose will be used for
32
myWidget, and if they click Cancel the original font is used.</p>
33
<p class="centerAlign"><img alt="A font dialog in the Plastique widget style." src="images/plastique-fontdialog.png" /></p>
34
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="FontDialogOption-enum" />QFontDialog.FontDialogOption</h3><p>This enum specifies various options that affect the look and
35
feel of a font dialog.</p>
36
<table class="valuelist">
41
<th class="tblConst">Constant</th>
42
<th class="tblval">Value</th>
43
<th class="tbldscr">Description</th>
46
<td class="topAlign"><tt>QFontDialog.NoButtons</tt></td>
47
<td class=" topAlign"><tt>0x00000001</tt></td>
48
<td class="topAlign">Don't display <b>OK</b> and <b>Cancel</b>
49
buttons. (Useful for "live dialogs".)</td>
52
<td class="topAlign"><tt>QFontDialog.DontUseNativeDialog</tt></td>
53
<td class=" topAlign"><tt>0x00000002</tt></td>
54
<td class="topAlign">Use Qt's standard font dialog on the Mac
55
instead of Apple's native font panel. (Currently, the native dialog
56
is never used, but this is likely to change in future Qt
32
60
<p>This enum was introduced in Qt 4.5.</p>
33
<p>The FontDialogOptions type is a typedef for <a href="qflags.html">QFlags</a><FontDialogOption>. It stores an OR combination of FontDialogOption values.</p>
34
<p>See also <a href="qfontdialog.html#options-prop">options</a>, <a href="qfontdialog.html#setOption">setOption</a>(), and <a href="qfontdialog.html#testOption">testOption</a>().</p>
61
<p>The FontDialogOptions type is a typedef for <a href="qflags.html">QFlags</a><FontDialogOption>. It stores an OR
62
combination of FontDialogOption values.</p>
63
<p>See also <a href="qfontdialog.html#options-prop">options</a>,
64
<a href="qfontdialog.html#setOption">setOption</a>(), and <a href="qfontdialog.html#testOption">testOption</a>().</p>
35
65
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFontDialog" />QFontDialog.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a standard font dialog.</p>
36
<p>Use <a href="qfontdialog.html#currentFont-prop">setCurrentFont</a>() to set the initial font attributes.</p>
66
<p>Use <a href="qfontdialog.html#currentFont-prop">setCurrentFont</a>() to set the
67
initial font attributes.</p>
37
68
<p>The <i>parent</i> parameter is passed to the <a href="qdialog.html">QDialog</a> constructor.</p>
38
69
<p>This function was introduced in Qt 4.5.</p>
39
70
<p>See also <a href="qfontdialog.html#getFont">getFont</a>().</p>
40
<h3 class="fn"><a name="QFontDialog-2" />QFontDialog.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a standard font dialog with the given <i>parent</i> and specified <i>initial</i> color.</p>
73
<h3 class="fn"><a name="QFontDialog-2" />QFontDialog.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a standard font dialog with the given <i>parent</i>
74
and specified <i>initial</i> color.</p>
41
75
<p>This function was introduced in Qt 4.5.</p>
42
<a name="//apple_ref/cpp/instm/QFontDialog/changeEvent" />
43
78
<h3 class="fn"><a name="changeEvent" />QFontDialog.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>
44
<a name="//apple_ref/cpp/instm/QFontDialog/currentFontChanged" />
45
81
<h3 class="fn"><a name="currentFont" /><a href="qfont.html">QFont</a> QFontDialog.currentFont (<i>self</i>)</h3><h3 class="fn"><a name="done" />QFontDialog.done (<i>self</i>, int)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p>
46
<p>Closes the dialog and sets its result code to <i>result</i>. If this dialog is shown with <a href="qdialog.html#exec">exec_</a>(), done() causes the local event loop to finish, and <a href="qdialog.html#exec">exec_</a>() to return <i>result</i>.</p>
82
<p>Closes the dialog and sets its result code to <i>result</i>. If
83
this dialog is shown with <a href="qdialog.html#exec">exec_</a>(),
84
done() causes the local event loop to finish, and <a href="qdialog.html#exec">exec_</a>() to return <i>result</i>.</p>
47
85
<p>See also <a href="qdialog.html#done">QDialog.done</a>().</p>
48
<a name="//apple_ref/cpp/instm/QFontDialog/fontSelected" />
49
88
<h3 class="fn"><a name="getFont" />(<a href="qfont.html">QFont</a>, bool) QFontDialog.getFont (<a href="qfont.html">QFont</a>, <a href="qwidget.html">QWidget</a>, QString, <a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a>)</h3><p>Executes a modal font dialog and returns a font.</p>
50
<p>If the user clicks <b>OK</b>, the selected font is returned. If the user clicks <b>Cancel</b>, the <i>initial</i> font is returned.</p>
51
<p>The dialog is constructed with the given <i>parent</i> and the options specified in <i>options</i>. <i>title</i> is shown as the window title of the dialog and <i>initial</i> is the initially selected font. If the <i>ok</i> parameter is not-null, the value it refers to is set to true if the user clicks <b>OK</b>, and set to false if the user clicks <b>Cancel</b>.</p>
89
<p>If the user clicks <b>OK</b>, the selected font is returned. If
90
the user clicks <b>Cancel</b>, the <i>initial</i> font is
92
<p>The dialog is constructed with the given <i>parent</i> and the
93
options specified in <i>options</i>. <i>title</i> is shown as the
94
window title of the dialog and <i>initial</i> is the initially
95
selected font. If the <i>ok</i> parameter is not-null, the value it
96
refers to is set to true if the user clicks <b>OK</b>, and set to
97
false if the user clicks <b>Cancel</b>.</p>
99
<pre class="highlightedCode brush: cpp">
54
101
QFont font = QFontDialog.getFont(&ok, QFont("Times", 12), this);
56
103
<span class="comment">// font is set to the font the user selected</span>
58
105
<span class="comment">// the user canceled the dialog; font is set to the initial</span>
59
106
<span class="comment">// value, in this case Times, 12.</span>
61
109
<p>The dialog can also be used to set a widget's font directly:</p>
62
<pre> myWidget.setFont(QFontDialog.getFont(0, myWidget.font()));</pre>
63
<p>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>
64
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qfontdialog.html">QFontDialog</a> constructors.</p>
65
<h3 class="fn"><a name="getFont-2" />(<a href="qfont.html">QFont</a>, bool) QFontDialog.getFont (<a href="qfont.html">QFont</a>, <a href="qwidget.html">QWidget</a>, QString)</h3><p>Call getFont(<i>ok</i>, <i>initial</i>, <i>parent</i>) instead.</p>
66
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qfontdialog.html">QFontDialog</a> constructors.</p>
110
<pre class="highlightedCode brush: cpp">
111
myWidget.setFont(QFontDialog.getFont(0, myWidget.font()));
113
<p>In this example, if the user clicks OK the font they chose will
114
be used, and if they click Cancel the original font is used.</p>
115
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
116
of the dialog. If you want to do this, you should create the dialog
117
yourself using one of the <a href="qfontdialog.html">QFontDialog</a> constructors.</p>
120
<h3 class="fn"><a name="getFont-2" />(<a href="qfont.html">QFont</a>, bool) QFontDialog.getFont (<a href="qfont.html">QFont</a>, <a href="qwidget.html">QWidget</a>, QString)</h3><p>Call getFont(<i>ok</i>, <i>initial</i>, <i>parent</i>)
122
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
123
of the dialog. If you want to do this, you should create the dialog
124
yourself using one of the <a href="qfontdialog.html">QFontDialog</a> constructors.</p>
67
125
<p>The <i>name</i> parameter is ignored.</p>
68
126
<p>This function was introduced in Qt 4.5.</p>
69
129
<h3 class="fn"><a name="getFont-3" />(<a href="qfont.html">QFont</a>, bool) QFontDialog.getFont (<a href="qfont.html">QFont</a>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>Call getFont(<i>ok</i>, <i>parent</i>) instead.</p>
70
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the <a href="qfontdialog.html">QFontDialog</a> constructors.</p>
130
<p><b>Warning:</b> Do not delete <i>parent</i> during the execution
131
of the dialog. If you want to do this, you should create the dialog
132
yourself using one of the <a href="qfontdialog.html">QFontDialog</a> constructors.</p>
71
133
<p>The <i>name</i> parameter is ignored.</p>
72
136
<h3 class="fn"><a name="getFont-4" />(<a href="qfont.html">QFont</a>, bool) QFontDialog.getFont (<a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>This is an overloaded function.</p>
73
137
<p>This function was introduced in Qt 4.5.</p>
74
140
<h3 class="fn"><a name="open" />QFontDialog.open (<i>self</i>)</h3><p>This is an overloaded function.</p>
75
<p>Opens the dialog and connects its <a href="qfontdialog.html#fontSelected">fontSelected</a>() signal to the slot specified by <i>receiver</i> and <i>member</i>.</p>
76
<p>The signal will be disconnected from the slot when the dialog is closed.</p>
141
<p>Opens the dialog and connects its <a href="qfontdialog.html#fontSelected">fontSelected</a>() signal to the
142
slot specified by <i>receiver</i> and <i>member</i>.</p>
143
<p>The signal will be disconnected from the slot when the dialog is
77
145
<p>This function was introduced in Qt 4.5.</p>
78
<a name="//apple_ref/cpp/instm/QFontDialog/selectedFont" />
79
<h3 class="fn"><a name="open-2" />QFontDialog.open (<i>self</i>, <a href="qobject.html">QObject</a>, SLOT()SLOT())</h3><h3 class="fn"><a name="open-3" />QFontDialog.open (<i>self</i>, callable)</h3><h3 class="fn"><a name="options" /><a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a> QFontDialog.options (<i>self</i>)</h3><h3 class="fn"><a name="selectedFont" /><a href="qfont.html">QFont</a> QFontDialog.selectedFont (<i>self</i>)</h3><p>Returns the font that the user selected by clicking the <b>OK</b> or equivalent button.</p>
80
<p><b>Note:</b> This font is not always the same as the font held by the <a href="qfontdialog.html#currentFont-prop">currentFont</a> property since the user can choose different fonts before finally selecting the one to use.</p>
81
<a name="//apple_ref/cpp/instm/QFontDialog/setOption" />
82
<h3 class="fn"><a name="setCurrentFont" />QFontDialog.setCurrentFont (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><h3 class="fn"><a name="setOption" />QFontDialog.setOption (<i>self</i>, <a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a>, bool <i>on</i> = True)</h3><p>Sets the given <i>option</i> to be enabled if <i>on</i> is true; otherwise, clears the given <i>option</i>.</p>
83
<p>See also <a href="qfontdialog.html#options-prop">options</a> and <a href="qfontdialog.html#testOption">testOption</a>().</p>
84
<a name="//apple_ref/cpp/instm/QFontDialog/setVisible" />
148
<h3 class="fn"><a name="open-2" />QFontDialog.open (<i>self</i>, <a href="qobject.html">QObject</a>, SLOT()SLOT())</h3><h3 class="fn"><a name="open-3" />QFontDialog.open (<i>self</i>, callable)</h3><h3 class="fn"><a name="options" /><a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a> QFontDialog.options (<i>self</i>)</h3><h3 class="fn"><a name="selectedFont" /><a href="qfont.html">QFont</a> QFontDialog.selectedFont (<i>self</i>)</h3><p>Returns the font that the user selected by clicking the
149
<b>OK</b> or equivalent button.</p>
150
<p><b>Note:</b> This font is not always the same as the font held
151
by the <a href="qfontdialog.html#currentFont-prop">currentFont</a>
152
property since the user can choose different fonts before finally
153
selecting the one to use.</p>
156
<h3 class="fn"><a name="setCurrentFont" />QFontDialog.setCurrentFont (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><h3 class="fn"><a name="setOption" />QFontDialog.setOption (<i>self</i>, <a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a>, bool <i>on</i> = True)</h3><p>Sets the given <i>option</i> to be enabled if <i>on</i> is true;
157
otherwise, clears the given <i>option</i>.</p>
158
<p>See also <a href="qfontdialog.html#options-prop">options</a> and
159
<a href="qfontdialog.html#testOption">testOption</a>().</p>
85
162
<h3 class="fn"><a name="setOptions" />QFontDialog.setOptions (<i>self</i>, <a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a>)</h3><h3 class="fn"><a name="setVisible" />QFontDialog.setVisible (<i>self</i>, bool)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>
86
<a name="//apple_ref/cpp/instm/QFontDialog/testOption" />
87
<h3 class="fn"><a name="testOption" />bool QFontDialog.testOption (<i>self</i>, <a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise, returns false.</p>
88
<p>See also <a href="qfontdialog.html#options-prop">options</a> and <a href="qfontdialog.html#setOption">setOption</a>().</p>
89
<p /><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentFontChanged" />void currentFontChanged (const QFont&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the current font is changed. The new font is specified in <i>font</i>.</p>
90
<p>The signal is emitted while a user is selecting a font. Ultimately, the chosen font may differ from the font currently selected.</p>
165
<h3 class="fn"><a name="testOption" />bool QFontDialog.testOption (<i>self</i>, <a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise,
167
<p>See also <a href="qfontdialog.html#options-prop">options</a> and
168
<a href="qfontdialog.html#setOption">setOption</a>().</p>
169
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentFontChanged" />void currentFontChanged (const QFont&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the current font is changed. The new
170
font is specified in <i>font</i>.</p>
171
<p>The signal is emitted while a user is selecting a font.
172
Ultimately, the chosen font may differ from the font currently
91
174
<p>This function was introduced in Qt 4.5.</p>
92
175
<p>See also <a href="qfontdialog.html#currentFont-prop">currentFont</a>, <a href="qfontdialog.html#fontSelected">fontSelected</a>(), and <a href="qfontdialog.html#selectedFont">selectedFont</a>().</p>
93
<a name="//apple_ref/cpp/instm/QFontDialog/done" />
94
<h3 class="fn"><a name="fontSelected" />void fontSelected (const QFont&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when a font has been selected. The selected font is specified in <i>font</i>.</p>
95
<p>The signal is only emitted when a user has chosen the final font to be used. It is not emitted while the user is changing the current font in the font dialog.</p>
178
<h3 class="fn"><a name="fontSelected" />void fontSelected (const QFont&)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when a font has been selected. The
179
selected font is specified in <i>font</i>.</p>
180
<p>The signal is only emitted when a user has chosen the final font
181
to be used. It is not emitted while the user is changing the
182
current font in the font dialog.</p>
96
183
<p>This function was introduced in Qt 4.5.</p>
97
<p>See also <a href="qfontdialog.html#selectedFont">selectedFont</a>(), <a href="qfontdialog.html#currentFontChanged">currentFontChanged</a>(), and <a href="qfontdialog.html#currentFont-prop">currentFont</a>.</p>
98
<a name="//apple_ref/cpp/clm/QFontDialog/getFont" />
99
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.7 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.3</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'
184
<p>See also <a href="qfontdialog.html#selectedFont">selectedFont</a>(), <a href="qfontdialog.html#currentFontChanged">currentFontChanged</a>(), and
185
<a href="qfontdialog.html#currentFont-prop">currentFont</a>.</p>
188
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.8.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.7.0</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'