Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 686

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFontDialog Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFontDialog Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QFontDialog class provides a dialog widget for selecting a
font. <a href="#details">More...</a></p>

<p>Inherits <a href="qdialog.html">QDialog</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a></b> { NoButtons, DontUseNativeDialog }</li><li><div class="fn" />class <b><a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qfontdialog.html#QFontDialog">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qfontdialog.html#QFontDialog-2">__init__</a></b> (<i>self</i>, QFont&#160;<i>initial</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qfontdialog.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" />QFont <b><a href="qfontdialog.html#currentFont">currentFont</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#done">done</a></b> (<i>self</i>, int&#160;<i>result</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#open">open</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#open-2">open</a></b> (<i>self</i>, QObject&#160;<i>receiver</i>, SLOT()SLOT()&#160;<i>member</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#open-3">open</a></b> (<i>self</i>, callable&#160;<i>receiver</i>)</li><li><div class="fn" />FontDialogOptions <b><a href="qfontdialog.html#options">options</a></b> (<i>self</i>)</li><li><div class="fn" />QFont <b><a href="qfontdialog.html#selectedFont">selectedFont</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#setCurrentFont">setCurrentFont</a></b> (<i>self</i>, QFont&#160;<i>font</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#setOption">setOption</a></b> (<i>self</i>, FontDialogOption&#160;<i>option</i>, bool&#160;<i>on</i>&#160;=&#160;True)</li><li><div class="fn" /><b><a href="qfontdialog.html#setOptions">setOptions</a></b> (<i>self</i>, FontDialogOptions&#160;<i>options</i>)</li><li><div class="fn" /><b><a href="qfontdialog.html#setVisible">setVisible</a></b> (<i>self</i>, bool&#160;<i>visible</i>)</li><li><div class="fn" />bool <b><a href="qfontdialog.html#testOption">testOption</a></b> (<i>self</i>, FontDialogOption&#160;<i>option</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />(QFont, bool&#160;<i>ok</i>) <b><a href="qfontdialog.html#getFont">getFont</a></b> (QFont&#160;<i>initial</i>, QWidget&#160;<i>parent</i>, QString&#160;<i>title</i>, FontDialogOptions&#160;<i>options</i>)</li><li><div class="fn" />(QFont, bool&#160;<i>ok</i>) <b><a href="qfontdialog.html#getFont-2">getFont</a></b> (QFont&#160;<i>def</i>, QWidget&#160;<i>parent</i>, QString&#160;<i>caption</i>)</li><li><div class="fn" />(QFont, bool&#160;<i>ok</i>) <b><a href="qfontdialog.html#getFont-3">getFont</a></b> (QFont&#160;<i>initial</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />(QFont, bool&#160;<i>ok</i>) <b><a href="qfontdialog.html#getFont-4">getFont</a></b> (QWidget&#160;<i>parent</i>&#160;=&#160;None)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qfontdialog.html#currentFontChanged">currentFontChanged</a></b> (const QFont&amp;)</li><li><div class="fn" />void <b><a href="qfontdialog.html#fontSelected">fontSelected</a></b> (const QFont&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFontDialog class provides a dialog widget for selecting a
font.</p>
<p>A font dialog is created through one of the static <a href="qfontdialog.html#getFont">getFont</a>() functions.</p>
<p>Examples:</p>
<pre class="cpp">
 <span class="type">bool</span> ok;
 <span class="type"><a href="qfont.html">QFont</a></span> font <span class="operator">=</span> <span class="type">QFontDialog</span><span class="operator">.</span><a href="qfontdialog.html#getFont">getFont</a>(
                 <span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Helvetica [Cronyx]"</span><span class="operator">,</span> <span class="number">10</span>)<span class="operator">,</span> <span class="keyword">this</span>);
 <span class="keyword">if</span> (ok) {
     <span class="comment">// the user clicked OK and font is set to the font the user selected</span>
 } <span class="keyword">else</span> {
     <span class="comment">// the user canceled the dialog; font is set to the initial</span>
     <span class="comment">// value, in this case Helvetica [Cronyx], 10</span>
 }
</pre>
<p>The dialog can also be used to set a widget's font directly:</p>
<pre class="cpp">
 myWidget<span class="operator">.</span><a href="qwidget.html#font-prop">setFont</a>(<span class="type">QFontDialog</span><span class="operator">.</span>getFont(<span class="number">0</span><span class="operator">,</span> myWidget<span class="operator">.</span>font()));
</pre>
<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>
<p class="centerAlign"><img alt="A font dialog in the Plastique widget style." src="images/plastique-fontdialog.png" /></p>
<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>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QFontDialog.NoButtons</tt></td>
<td class="topAlign"><tt>0x00000001</tt></td>
<td class="topAlign">Don't display <b>OK</b> and <b>Cancel</b>
buttons. (Useful for "live dialogs".)</td>
</tr>
<tr>
<td class="topAlign"><tt>QFontDialog.DontUseNativeDialog</tt></td>
<td class="topAlign"><tt>0x00000002</tt></td>
<td class="topAlign">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>
</table>
<p>This enum was introduced or modified in Qt 4.5.</p>
<p>The FontDialogOptions type is a typedef for <a href="qflags.html">QFlags</a>&lt;FontDialogOption&gt;. It stores an OR
combination of FontDialogOption values.</p>
<p><b>See also</b> <a href="qfontdialog.html#options-prop">options</a>, <a href="qfontdialog.html#setOption">setOption</a>(), and <a href="qfontdialog.html#testOption">testOption</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFontDialog" />QFontDialog.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;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>
<p>Use <a href="qfontdialog.html#currentFont-prop">setCurrentFont</a>() to set the
initial font attributes.</p>
<p>The <i>parent</i> parameter is passed to the <a href="qdialog.html">QDialog</a> constructor.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qfontdialog.html#getFont">getFont</a>().</p>


<h3 class="fn"><a name="QFontDialog-2" />QFontDialog.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>&#160;<i>initial</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;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> font.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="changeEvent" />QFontDialog.changeEvent (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#changeEvent">QWidget.changeEvent</a>().</p>


<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&#160;<i>result</i>)</h3><p>Reimplemented from <a href="qdialog.html#done">QDialog.done</a>().</p>
<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>
<p><b>See also</b> <a href="qdialog.html#done">QDialog.done</a>().</p>


<h3 class="fn"><a name="getFont" />(<a href="qfont.html">QFont</a>, bool&#160;<i>ok</i>) QFontDialog.getFont (<a href="qfont.html">QFont</a>&#160;<i>initial</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>title</i>, <a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a>&#160;<i>options</i>)</h3><p>Executes a modal font dialog and returns a font.</p>
<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>
<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>
<p>Examples:</p>
<pre class="cpp">
 <span class="type">bool</span> ok;
 <span class="type"><a href="qfont.html">QFont</a></span> font <span class="operator">=</span> <span class="type"><a href="qfontdialog.html">QFontDialog</a></span><span class="operator">.</span>getFont(<span class="operator">&amp;</span>ok<span class="operator">,</span> <span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Times"</span><span class="operator">,</span> <span class="number">12</span>)<span class="operator">,</span> <span class="keyword">this</span>);
 <span class="keyword">if</span> (ok) {
     <span class="comment">// font is set to the font the user selected</span>
 } <span class="keyword">else</span> {
     <span class="comment">// the user canceled the dialog; font is set to the initial</span>
     <span class="comment">// value, in this case Times, 12.</span>
 }
</pre>
<p>The dialog can also be used to set a widget's font directly:</p>
<pre class="cpp">
 myWidget<span class="operator">.</span><a href="qwidget.html#font-prop">setFont</a>(<span class="type"><a href="qfontdialog.html">QFontDialog</a></span><span class="operator">.</span>getFont(<span class="number">0</span><span class="operator">,</span> myWidget<span class="operator">.</span>font()));
</pre>
<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>
<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>


<h3 class="fn"><a name="getFont-2" />(<a href="qfont.html">QFont</a>, bool&#160;<i>ok</i>) QFontDialog.getFont (<a href="qfont.html">QFont</a>&#160;<i>def</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>, QString&#160;<i>caption</i>)</h3><p>Call getFont(<i>ok</i>, <i>initial</i>, <i>parent</i>)
instead.</p>
<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>
<p>The <i>name</i> parameter is ignored.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="getFont-3" />(<a href="qfont.html">QFont</a>, bool&#160;<i>ok</i>) QFontDialog.getFont (<a href="qfont.html">QFont</a>&#160;<i>initial</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>Call getFont(<i>ok</i>, <i>parent</i>) instead.</p>
<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>
<p>The <i>name</i> parameter is ignored.</p>


<h3 class="fn"><a name="getFont-4" />(<a href="qfont.html">QFont</a>, bool&#160;<i>ok</i>) QFontDialog.getFont (<a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>This is an overloaded function.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="open" />QFontDialog.open (<i>self</i>)</h3><p>This is an overloaded function.</p>
<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>
<p>The signal will be disconnected from the slot when the dialog is
closed.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="open-2" />QFontDialog.open (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>receiver</i>, SLOT()SLOT()&#160;<i>member</i>)</h3><h3 class="fn"><a name="open-3" />QFontDialog.open (<i>self</i>, callable&#160;<i>receiver</i>)</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>
<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>


<h3 class="fn"><a name="setCurrentFont" />QFontDialog.setCurrentFont (<i>self</i>, <a href="qfont.html">QFont</a>&#160;<i>font</i>)</h3><h3 class="fn"><a name="setOption" />QFontDialog.setOption (<i>self</i>, <a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a>&#160;<i>option</i>, bool&#160;<i>on</i>&#160;=&#160;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>
<p><b>See also</b> <a href="qfontdialog.html#options-prop">options</a> and <a href="qfontdialog.html#testOption">testOption</a>().</p>


<h3 class="fn"><a name="setOptions" />QFontDialog.setOptions (<i>self</i>, <a href="qfontdialog-fontdialogoptions.html">FontDialogOptions</a>&#160;<i>options</i>)</h3><h3 class="fn"><a name="setVisible" />QFontDialog.setVisible (<i>self</i>, bool&#160;<i>visible</i>)</h3><p>Reimplemented from <a href="qwidget.html#visible-prop">QWidget.setVisible</a>().</p>


<h3 class="fn"><a name="testOption" />bool QFontDialog.testOption (<i>self</i>, <a href="qfontdialog.html#FontDialogOption-enum">FontDialogOption</a>&#160;<i>option</i>)</h3><p>Returns true if the given <i>option</i> is enabled; otherwise,
returns false.</p>
<p><b>See also</b> <a href="qfontdialog.html#options-prop">options</a> and <a href="qfontdialog.html#setOption">setOption</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="currentFontChanged" />void currentFontChanged (const QFont&amp;)</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>
<p>The signal is emitted while a user is selecting a font.
Ultimately, the chosen font may differ from the font currently
selected.</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qfontdialog.html#currentFont-prop">currentFont</a>, <a href="qfontdialog.html#fontSelected">fontSelected</a>(), and <a href="qfontdialog.html#selectedFont">selectedFont</a>().</p>


<h3 class="fn"><a name="fontSelected" />void fontSelected (const QFont&amp;)</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>
<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>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also</b> <a href="qfontdialog.html#selectedFont">selectedFont</a>(), <a href="qfontdialog.html#currentFontChanged">currentFontChanged</a>(), and
<a href="qfontdialog.html#currentFont-prop">currentFont</a>.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>