Sophie

Sophie

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

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>QLabel 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">QLabel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QLabel widget provides a text or image display. <a href="#details">More...</a></p>

<p>Inherits <a href="qframe.html">QFrame</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlabel.html#QLabel">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qlabel.html#QLabel-2">__init__</a></b> (<i>self</i>, QString&#160;<i>text</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />Qt.Alignment <b><a href="qlabel.html#alignment">alignment</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qlabel.html#buddy">buddy</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlabel.html#changeEvent">changeEvent</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" /><b><a href="qlabel.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlabel.html#contextMenuEvent">contextMenuEvent</a></b> (<i>self</i>, QContextMenuEvent&#160;<i>ev</i>)</li><li><div class="fn" />bool <b><a href="qlabel.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qlabel.html#focusInEvent">focusInEvent</a></b> (<i>self</i>, QFocusEvent&#160;<i>ev</i>)</li><li><div class="fn" />bool <b><a href="qlabel.html#focusNextPrevChild">focusNextPrevChild</a></b> (<i>self</i>, bool&#160;<i>next</i>)</li><li><div class="fn" /><b><a href="qlabel.html#focusOutEvent">focusOutEvent</a></b> (<i>self</i>, QFocusEvent&#160;<i>ev</i>)</li><li><div class="fn" />bool <b><a href="qlabel.html#hasScaledContents">hasScaledContents</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlabel.html#hasSelectedText">hasSelectedText</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlabel.html#heightForWidth">heightForWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" />int <b><a href="qlabel.html#indent">indent</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlabel.html#keyPressEvent">keyPressEvent</a></b> (<i>self</i>, QKeyEvent&#160;<i>ev</i>)</li><li><div class="fn" />int <b><a href="qlabel.html#margin">margin</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qlabel.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlabel.html#mouseMoveEvent">mouseMoveEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>ev</i>)</li><li><div class="fn" /><b><a href="qlabel.html#mousePressEvent">mousePressEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>ev</i>)</li><li><div class="fn" /><b><a href="qlabel.html#mouseReleaseEvent">mouseReleaseEvent</a></b> (<i>self</i>, QMouseEvent&#160;<i>ev</i>)</li><li><div class="fn" />QMovie <b><a href="qlabel.html#movie">movie</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlabel.html#openExternalLinks">openExternalLinks</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlabel.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent)</li><li><div class="fn" />QPicture <b><a href="qlabel.html#picture">picture</a></b> (<i>self</i>)</li><li><div class="fn" />QPixmap <b><a href="qlabel.html#pixmap">pixmap</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qlabel.html#selectedText">selectedText</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlabel.html#selectionStart">selectionStart</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlabel.html#setAlignment">setAlignment</a></b> (<i>self</i>, Qt.Alignment)</li><li><div class="fn" /><b><a href="qlabel.html#setBuddy">setBuddy</a></b> (<i>self</i>, QWidget)</li><li><div class="fn" /><b><a href="qlabel.html#setIndent">setIndent</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qlabel.html#setMargin">setMargin</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qlabel.html#setMovie">setMovie</a></b> (<i>self</i>, QMovie&#160;<i>movie</i>)</li><li><div class="fn" /><b><a href="qlabel.html#setNum">setNum</a></b> (<i>self</i>, float)</li><li><div class="fn" /><b><a href="qlabel.html#setNum-2">setNum</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qlabel.html#setOpenExternalLinks">setOpenExternalLinks</a></b> (<i>self</i>, bool&#160;<i>open</i>)</li><li><div class="fn" /><b><a href="qlabel.html#setPicture">setPicture</a></b> (<i>self</i>, QPicture)</li><li><div class="fn" /><b><a href="qlabel.html#setPixmap">setPixmap</a></b> (<i>self</i>, QPixmap)</li><li><div class="fn" /><b><a href="qlabel.html#setScaledContents">setScaledContents</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qlabel.html#setSelection">setSelection</a></b> (<i>self</i>, int, int)</li><li><div class="fn" /><b><a href="qlabel.html#setText">setText</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qlabel.html#setTextFormat">setTextFormat</a></b> (<i>self</i>, Qt.TextFormat)</li><li><div class="fn" /><b><a href="qlabel.html#setTextInteractionFlags">setTextInteractionFlags</a></b> (<i>self</i>, Qt.TextInteractionFlags&#160;<i>flags</i>)</li><li><div class="fn" /><b><a href="qlabel.html#setWordWrap">setWordWrap</a></b> (<i>self</i>, bool&#160;<i>on</i>)</li><li><div class="fn" />QSize <b><a href="qlabel.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qlabel.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextFormat <b><a href="qlabel.html#textFormat">textFormat</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TextInteractionFlags <b><a href="qlabel.html#textInteractionFlags">textInteractionFlags</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlabel.html#wordWrap">wordWrap</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qlabel.html#linkActivated">linkActivated</a></b> (const QString&amp;)</li><li><div class="fn" />void <b><a href="qlabel.html#linkHovered">linkHovered</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QLabel widget provides a text or image display.</p>
<p>QLabel is used for displaying text or an image. No user
interaction functionality is provided. The visual appearance of the
label can be configured in various ways, and it can be used for
specifying a focus mnemonic key for another widget.</p>
<p>A QLabel can contain any of the following content types:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>Content</th>
<th>Setting</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td>Plain text</td>
<td>Pass a <a href="qstring.html">QString</a> to <a href="qlabel.html#text-prop">setText</a>().</td>
</tr>
<tr class="even" valign="top">
<td>Rich text</td>
<td>Pass a <a href="qstring.html">QString</a> that contains rich
text to <a href="qlabel.html#text-prop">setText</a>().</td>
</tr>
<tr class="odd" valign="top">
<td>A pixmap</td>
<td>Pass a <a href="qpixmap.html">QPixmap</a> to <a href="qlabel.html#pixmap-prop">setPixmap</a>().</td>
</tr>
<tr class="even" valign="top">
<td>A movie</td>
<td>Pass a <a href="qmovie.html">QMovie</a> to <a href="qlabel.html#setMovie">setMovie</a>().</td>
</tr>
<tr class="odd" valign="top">
<td>A number</td>
<td>Pass an <i>int</i> or a <i>double</i> to <a href="qlabel.html#setNum">setNum</a>(), which converts the number to
plain text.</td>
</tr>
<tr class="even" valign="top">
<td>Nothing</td>
<td>The same as an empty plain text. This is the default. Set by
<a href="qlabel.html#clear">clear</a>().</td>
</tr>
</table>
<p><b>Warning:</b> When passing a <a href="qstring.html">QString</a> to the constructor or calling <a href="qlabel.html#text-prop">setText</a>(), make sure to sanitize your
input, as QLabel tries to guess whether it displays the text as
plain text or as rich text. You may want to call <a href="qlabel.html#textFormat-prop">setTextFormat</a>() explicitly, e.g.
in case you expect the text to be in plain format but cannot
control the text source (for instance when displaying data loaded
from the Web).</p>
<p>When the content is changed using any of these functions, any
previous content is cleared.</p>
<p>By default, labels display <a href="qlabel.html#alignment-prop">left-aligned, vertically-centered</a>
text and images, where any tabs in the text to be displayed are
<a href="qt.html#TextFlag-enum">automatically expanded</a>.
However, the look of a QLabel can be adjusted and fine-tuned in
several ways.</p>
<p>The positioning of the content within the QLabel widget area can
be tuned with <a href="qlabel.html#alignment-prop">setAlignment</a>() and <a href="qlabel.html#indent-prop">setIndent</a>(). Text content can also
wrap lines along word boundaries with <a href="qlabel.html#wordWrap-prop">setWordWrap</a>(). For example, this
code sets up a sunken panel with a two-line text in the bottom
right corner (both lines being flush with the right side of the
label):</p>
<pre class="cpp">
 <span class="type">QLabel</span> <span class="operator">*</span>label <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QLabel</span>(<span class="keyword">this</span>);
 label<span class="operator">-</span><span class="operator">&gt;</span><a href="qframe.html#setFrameStyle">setFrameStyle</a>(<span class="type"><a href="qframe.html">QFrame</a></span><span class="operator">.</span>Panel <span class="operator">|</span> <span class="type"><a href="qframe.html">QFrame</a></span><span class="operator">.</span>Sunken);
 label<span class="operator">-</span><span class="operator">&gt;</span><a href="qlabel.html#text-prop">setText</a>(<span class="string">"first line\nsecond line"</span>);
 label<span class="operator">-</span><span class="operator">&gt;</span><a href="qlabel.html#alignment-prop">setAlignment</a>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignBottom <span class="operator">|</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignRight);
</pre>
<p>The properties and functions QLabel inherits from <a href="qframe.html">QFrame</a> can also be used to specify the widget
frame to be used for any given label.</p>
<p>A QLabel is often used as a label for an interactive widget. For
this use QLabel provides a useful mechanism for adding an mnemonic
(see <a href="qkeysequence.html">QKeySequence</a>) that will set
the keyboard focus to the other widget (called the QLabel's
"buddy"). For example:</p>
<pre class="cpp">
 <span class="type"><a href="qlineedit.html">QLineEdit</a></span><span class="operator">*</span> phoneEdit <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>(<span class="keyword">this</span>);
 <span class="type">QLabel</span><span class="operator">*</span> phoneLabel <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QLabel</span>(<span class="string">"&amp;Phone:"</span><span class="operator">,</span> <span class="keyword">this</span>);
 phoneLabel<span class="operator">-</span><span class="operator">&gt;</span><a href="qlabel.html#setBuddy">setBuddy</a>(phoneEdit);
</pre>
<p>In this example, keyboard focus is transferred to the label's
buddy (the <a href="qlineedit.html">QLineEdit</a>) when the user
presses Alt+P. If the buddy was a button (inheriting from <a href="qabstractbutton.html">QAbstractButton</a>), triggering the
mnemonic would emulate a button click.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Macintosh style label" src="images/macintosh-label.png" /></td>
<td>A label shown in the <a href="gallery-macintosh.html">Macintosh
widget style</a>.</td>
</tr>
<tr class="even" valign="top">
<td><img alt="Screenshot of a Plastique style label" src="images/plastique-label.png" /></td>
<td>A label shown in the <a href="gallery-plastique.html">Plastique
widget style</a>.</td>
</tr>
<tr class="odd" valign="top">
<td><img alt="Screenshot of a Windows XP style label" src="images/windowsxp-label.png" /></td>
<td>A label shown in the <a href="gallery-windowsxp.html">Windows
XP widget style</a>.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLabel" />QLabel.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</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 an empty label.</p>
<p>The <i>parent</i> and widget flag <i>f</i>, arguments are passed
to the <a href="qframe.html">QFrame</a> constructor.</p>
<p><b>See also</b> <a href="qlabel.html#alignment-prop">setAlignment</a>(), <a href="qframe.html#setFrameStyle">setFrameStyle</a>(), and <a href="qlabel.html#indent-prop">setIndent</a>().</p>


<h3 class="fn"><a name="QLabel-2" />QLabel.__init__ (<i>self</i>, QString&#160;<i>text</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</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 label that displays the text, <i>text</i>.</p>
<p>The <i>parent</i> and widget flag <i>f</i>, arguments are passed
to the <a href="qframe.html">QFrame</a> constructor.</p>
<p><b>See also</b> <a href="qlabel.html#text-prop">setText</a>(),
<a href="qlabel.html#alignment-prop">setAlignment</a>(), <a href="qframe.html#setFrameStyle">setFrameStyle</a>(), and <a href="qlabel.html#indent-prop">setIndent</a>().</p>


<h3 class="fn"><a name="alignment" /><a href="qt-alignment.html">Qt.Alignment</a> QLabel.alignment (<i>self</i>)</h3><h3 class="fn"><a name="buddy" /><a href="qwidget.html">QWidget</a> QLabel.buddy (<i>self</i>)</h3><p>Returns this label's buddy, or 0 if no buddy is currently
set.</p>
<p><b>See also</b> <a href="qlabel.html#setBuddy">setBuddy</a>().</p>


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


<h3 class="fn"><a name="clear" />QLabel.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><p>Clears any label contents.</p>


<h3 class="fn"><a name="contextMenuEvent" />QLabel.contextMenuEvent (<i>self</i>, <a href="qcontextmenuevent.html">QContextMenuEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#contextMenuEvent">QWidget.contextMenuEvent</a>().</p>


<h3 class="fn"><a name="event" />bool QLabel.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="focusInEvent" />QLabel.focusInEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusInEvent">QWidget.focusInEvent</a>().</p>


<h3 class="fn"><a name="focusNextPrevChild" />bool QLabel.focusNextPrevChild (<i>self</i>, bool&#160;<i>next</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusNextPrevChild">QWidget.focusNextPrevChild</a>().</p>


<h3 class="fn"><a name="focusOutEvent" />QLabel.focusOutEvent (<i>self</i>, <a href="qfocusevent.html">QFocusEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#focusOutEvent">QWidget.focusOutEvent</a>().</p>


<h3 class="fn"><a name="hasScaledContents" />bool QLabel.hasScaledContents (<i>self</i>)</h3><h3 class="fn"><a name="hasSelectedText" />bool QLabel.hasSelectedText (<i>self</i>)</h3><h3 class="fn"><a name="heightForWidth" />int QLabel.heightForWidth (<i>self</i>, int)</h3><p>Reimplemented from <a href="qwidget.html#heightForWidth">QWidget.heightForWidth</a>().</p>


<h3 class="fn"><a name="indent" />int QLabel.indent (<i>self</i>)</h3><h3 class="fn"><a name="keyPressEvent" />QLabel.keyPressEvent (<i>self</i>, <a href="qkeyevent.html">QKeyEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#keyPressEvent">QWidget.keyPressEvent</a>().</p>


<h3 class="fn"><a name="margin" />int QLabel.margin (<i>self</i>)</h3><h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QLabel.minimumSizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#minimumSizeHint-prop">QWidget.minimumSizeHint</a>().</p>


<h3 class="fn"><a name="mouseMoveEvent" />QLabel.mouseMoveEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseMoveEvent">QWidget.mouseMoveEvent</a>().</p>


<h3 class="fn"><a name="mousePressEvent" />QLabel.mousePressEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#mousePressEvent">QWidget.mousePressEvent</a>().</p>


<h3 class="fn"><a name="mouseReleaseEvent" />QLabel.mouseReleaseEvent (<i>self</i>, <a href="qmouseevent.html">QMouseEvent</a>&#160;<i>ev</i>)</h3><p>Reimplemented from <a href="qwidget.html#mouseReleaseEvent">QWidget.mouseReleaseEvent</a>().</p>


<h3 class="fn"><a name="movie" /><a href="qmovie.html">QMovie</a> QLabel.movie (<i>self</i>)</h3><p>Returns a pointer to the label's movie, or 0 if no movie has
been set.</p>
<p><b>See also</b> <a href="qlabel.html#setMovie">setMovie</a>().</p>


<h3 class="fn"><a name="openExternalLinks" />bool QLabel.openExternalLinks (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QLabel.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p>


<h3 class="fn"><a name="picture" /><a href="qpicture.html">QPicture</a> QLabel.picture (<i>self</i>)</h3><p>Returns the label's picture or 0 if the label doesn't have a
picture.</p>
<p><b>See also</b> <a href="qlabel.html#setPicture">setPicture</a>().</p>


<h3 class="fn"><a name="pixmap" /><a href="qpixmap.html">QPixmap</a> QLabel.pixmap (<i>self</i>)</h3><h3 class="fn"><a name="selectedText" />QString QLabel.selectedText (<i>self</i>)</h3><h3 class="fn"><a name="selectionStart" />int QLabel.selectionStart (<i>self</i>)</h3><p>selectionStart() returns the index of the first selected
character in the label or -1 if no text is selected.</p>
<p><b>Note:</b> The <a href="qlabel.html#textInteractionFlags-prop">textInteractionFlags</a>
set on the label need to include either TextSelectableByMouse or
TextSelectableByKeyboard.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qlabel.html#selectedText-prop">selectedText</a>().</p>


<h3 class="fn"><a name="setAlignment" />QLabel.setAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a>)</h3><h3 class="fn"><a name="setBuddy" />QLabel.setBuddy (<i>self</i>, <a href="qwidget.html">QWidget</a>)</h3><p>Sets this label's buddy to <i>buddy</i>.</p>
<p>When the user presses the shortcut key indicated by this label,
the keyboard focus is transferred to the label's buddy widget.</p>
<p>The buddy mechanism is only available for QLabels that contain
text in which one character is prefixed with an ampersand, '&amp;'.
This character is set as the shortcut key. See the <a href="qkeysequence.html#mnemonic">QKeySequence.mnemonic</a>()
documentation for details (to display an actual ampersand, use
'&amp;&amp;').</p>
<p>In a dialog, you might create two data entry widgets and a label
for each, and set up the geometry layout so each label is just to
the left of its data entry widget (its "buddy"), for example:</p>
<pre class="cpp">
 <span class="type"><a href="qlineedit.html">QLineEdit</a></span> <span class="operator">*</span>nameEd  <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>(<span class="keyword">this</span>);
 <span class="type"><a href="qlabel.html">QLabel</a></span>    <span class="operator">*</span>nameLb  <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(<span class="string">"&amp;Name:"</span><span class="operator">,</span> <span class="keyword">this</span>);
 nameLb<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(nameEd);
 <span class="type"><a href="qlineedit.html">QLineEdit</a></span> <span class="operator">*</span>phoneEd <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlineedit.html">QLineEdit</a></span>(<span class="keyword">this</span>);
 <span class="type"><a href="qlabel.html">QLabel</a></span>    <span class="operator">*</span>phoneLb <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qlabel.html">QLabel</a></span>(<span class="string">"&amp;Phone:"</span><span class="operator">,</span> <span class="keyword">this</span>);
 phoneLb<span class="operator">-</span><span class="operator">&gt;</span>setBuddy(phoneEd);
 <span class="comment">// (layout setup not shown)</span>
</pre>
<p>With the code above, the focus jumps to the Name field when the
user presses Alt+N, and to the Phone field when the user presses
Alt+P.</p>
<p>To unset a previously set buddy, call this function with
<i>buddy</i> set to 0.</p>
<p><b>See also</b> <a href="qlabel.html#buddy">buddy</a>(),
<a href="qlabel.html#text-prop">setText</a>(), <a href="qshortcut.html">QShortcut</a>, and <a href="qlabel.html#alignment-prop">setAlignment</a>().</p>


<h3 class="fn"><a name="setIndent" />QLabel.setIndent (<i>self</i>, int)</h3><h3 class="fn"><a name="setMargin" />QLabel.setMargin (<i>self</i>, int)</h3><h3 class="fn"><a name="setMovie" />QLabel.setMovie (<i>self</i>, <a href="qmovie.html">QMovie</a>&#160;<i>movie</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setMovie(QMovie *)</tt>.</p><p>Sets the label contents to <i>movie</i>. Any previous content is
cleared. The label does NOT take ownership of the movie.</p>
<p>The buddy shortcut, if any, is disabled.</p>
<p><b>See also</b> <a href="qlabel.html#movie">movie</a>() and
<a href="qlabel.html#setBuddy">setBuddy</a>().</p>


<h3 class="fn"><a name="setNum" />QLabel.setNum (<i>self</i>, float)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setNum(double)</tt>.</p><p>Sets the label contents to plain text containing the textual
representation of integer <i>num</i>. Any previous content is
cleared. Does nothing if the integer's string representation is the
same as the current contents of the label.</p>
<p>The buddy shortcut, if any, is disabled.</p>
<p><b>See also</b> <a href="qlabel.html#text-prop">setText</a>(),
<a href="qstring.html#setNum">QString.setNum</a>(), and <a href="qlabel.html#setBuddy">setBuddy</a>().</p>


<h3 class="fn"><a name="setNum-2" />QLabel.setNum (<i>self</i>, int)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setNum(int)</tt>.</p><p>This is an overloaded function.</p>
<p>Sets the label contents to plain text containing the textual
representation of double <i>num</i>. Any previous content is
cleared. Does nothing if the double's string representation is the
same as the current contents of the label.</p>
<p>The buddy shortcut, if any, is disabled.</p>
<p><b>See also</b> <a href="qlabel.html#text-prop">setText</a>(),
<a href="qstring.html#setNum">QString.setNum</a>(), and <a href="qlabel.html#setBuddy">setBuddy</a>().</p>


<h3 class="fn"><a name="setOpenExternalLinks" />QLabel.setOpenExternalLinks (<i>self</i>, bool&#160;<i>open</i>)</h3><h3 class="fn"><a name="setPicture" />QLabel.setPicture (<i>self</i>, <a href="qpicture.html">QPicture</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPicture(const QPicture&amp;)</tt>.</p><p>Sets the label contents to <i>picture</i>. Any previous content
is cleared.</p>
<p>The buddy shortcut, if any, is disabled.</p>
<p><b>See also</b> <a href="qlabel.html#picture">picture</a>() and
<a href="qlabel.html#setBuddy">setBuddy</a>().</p>


<h3 class="fn"><a name="setPixmap" />QLabel.setPixmap (<i>self</i>, <a href="qpixmap.html">QPixmap</a>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setPixmap(const QPixmap&amp;)</tt>.</p><h3 class="fn"><a name="setScaledContents" />QLabel.setScaledContents (<i>self</i>, bool)</h3><h3 class="fn"><a name="setSelection" />QLabel.setSelection (<i>self</i>, int, int)</h3><p>Selects text from position <i>start</i> and for <i>length</i>
characters.</p>
<p><b>Note:</b> The <a href="qlabel.html#textInteractionFlags-prop">textInteractionFlags</a>
set on the label need to include either TextSelectableByMouse or
TextSelectableByKeyboard.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qlabel.html#selectedText-prop">selectedText</a>().</p>


<h3 class="fn"><a name="setText" />QLabel.setText (<i>self</i>, QString)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setText(const QString&amp;)</tt>.</p><h3 class="fn"><a name="setTextFormat" />QLabel.setTextFormat (<i>self</i>, <a href="qt.html#TextFormat-enum">Qt.TextFormat</a>)</h3><h3 class="fn"><a name="setTextInteractionFlags" />QLabel.setTextInteractionFlags (<i>self</i>, <a href="qt-textinteractionflags.html">Qt.TextInteractionFlags</a>&#160;<i>flags</i>)</h3><h3 class="fn"><a name="setWordWrap" />QLabel.setWordWrap (<i>self</i>, bool&#160;<i>on</i>)</h3><h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QLabel.sizeHint (<i>self</i>)</h3><p>Reimplemented from <a href="qwidget.html#sizeHint-prop">QWidget.sizeHint</a>().</p>
<h3 class="fn"><a name="text" />QString QLabel.text (<i>self</i>)</h3><h3 class="fn"><a name="textFormat" /><a href="qt.html#TextFormat-enum">Qt.TextFormat</a> QLabel.textFormat (<i>self</i>)</h3><h3 class="fn"><a name="textInteractionFlags" /><a href="qt-textinteractionflags.html">Qt.TextInteractionFlags</a> QLabel.textInteractionFlags (<i>self</i>)</h3><h3 class="fn"><a name="wordWrap" />bool QLabel.wordWrap (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="linkActivated" />void linkActivated (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user clicks a link. The URL
referred to by the anchor is passed in <i>link</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qlabel.html#linkHovered">linkHovered</a>().</p>


<h3 class="fn"><a name="linkHovered" />void linkHovered (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user hovers over a link. The URL
referred to by the anchor is passed in <i>link</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qlabel.html#linkActivated">linkActivated</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>