⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qlabel.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
📖 第 1 页 / 共 2 页
字号:
Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing is disabled..PPAuto-resizing is disabled by default..PPSee also setAutoResize()..SH "QWidget * QLabel::buddy () const"Returns the buddy of this label, or 0 if no buddy is currently set..PPSee also setBuddy()..SH "void QLabel::clear ()\fC [slot]\fR"Clears any label contents. Equivalent to setText( "" )..SH "void QLabel::drawContents ( QPainter * p )\fC [virtual protected]\fR"Draws the label contents using the painter \fIp\fR..PPReimplemented from QFrame..SH "bool QLabel::hasScaledContents () const"Returns TRUE if the label will scale its contents to fill all available space; otherwise returns FALSE. See the "scaledContents" property for details..SH "int QLabel::indent () const"Returns the label's indent in pixels. See the "indent" property for details..SH "QMovie * QLabel::movie () const"If the label contains a movie, returns a pointer to it. Otherwise, returns 0..PPSee also setMovie()..SH "QPicture * QLabel::picture () const"Returns the label's picture or 0 if the label doesn't have a picture..SH "QPixmap * QLabel::pixmap () const"Returns the label's pixmap. See the "pixmap" property for details..SH "void QLabel::setAlignment ( int )\fC [virtual]\fR"Sets the alignment of the label's contents. See the "alignment" property for details..SH "void QLabel::setAutoResize ( bool enable )\fC [virtual]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPEnables auto-resizing if \fIenable\fR is TRUE, or disables it if \fIenable\fR is FALSE..PPWhen auto-resizing is enabled the label will resize itself to fit the contents whenever the contents change. The top-left corner is not moved. This is useful for QLabel widgets that are not managed by a QLayout (e.g., top-level widgets)..PPAuto-resizing is disabled by default..PPSee also autoResize(), adjustSize() and sizeHint..SH "void QLabel::setBuddy ( QWidget * buddy )\fC [virtual]\fR"Sets the buddy of this label to \fIbuddy\fR..PPWhen the user presses the accelerator key indicated by this label, the keyboard focus is transferred to the label's buddy widget..PPThe buddy mechanism is available only for QLabels that contain plain text in which one letter is prefixed with an ampersand, &. This letter is set as the accelerator key. The letter is displayed underlined, and the '&' is not displayed (i.e. the ShowPrefix alignment flag is turned on; see setAlignment())..PPIn 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"), perhaps like this:.PP.nf.br    QLineEdit *nameEd  = new QLineEdit( this );.br    QLabel    *nameLb  = new QLabel( "&Name:", this );.br    nameLb->setBuddy( nameEd );.br    QLineEdit *phoneEd = new QLineEdit( this );.br    QLabel    *phoneLb = new QLabel( "&Phone:", this );.br    phoneLb->setBuddy( phoneEd );.br    // ( layout setup not shown ).br.fi.PPWith 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..PPTo unset a previously set buddy, call this function with \fIbuddy\fR set to 0..PPSee also buddy(), text, QAccel and alignment..PPExample: addressbook/centralwidget.cpp..SH "void QLabel::setFont ( const QFont & f )\fC [virtual]\fR"Sets the font used on the QLabel to font \fIf\fR..PPReimplemented from QWidget..SH "void QLabel::setIndent ( int )"Sets the label's indent in pixels. See the "indent" property for details..SH "void QLabel::setMovie ( const QMovie & movie )\fC [virtual slot]\fR"Sets the label contents to \fImovie\fR. Any previous content is cleared..PPThe buddy accelerator, if any, is disabled..PPThe label resizes itself if auto-resizing is enabled..PPSee also movie() and setBuddy()..SH "void QLabel::setNum ( int num )\fC [virtual slot]\fR"Sets the label contents to plain text containing the printed representation of integer \fInum\fR. Any previous content is cleared. Does nothing if the integer's string representation is the same as the current contents of the label..PPThe buddy accelerator, if any, is disabled..PPThe label resizes itself if auto-resizing is enabled..PPSee also text, QString::setNum() and setBuddy()..SH "void QLabel::setNum ( double num )\fC [virtual slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the label contents to plain text containing the printed representation of double \fInum\fR. Any previous content is cleared. Does nothing if the double's string representation is the same as the current contents of the label..PPThe buddy accelerator, if any, is disabled..PPThe label resizes itself if auto-resizing is enabled..PPSee also text, QString::setNum() and setBuddy()..SH "void QLabel::setPicture ( const QPicture & picture )\fC [virtual slot]\fR"Sets the label contents to \fIpicture\fR. Any previous content is cleared..PPThe buddy accelerator, if any, is disabled..PPSee also picture() and setBuddy()..SH "void QLabel::setPixmap ( const QPixmap & )\fC [virtual slot]\fR"Sets the label's pixmap. See the "pixmap" property for details..SH "void QLabel::setScaledContents ( bool )"Sets whether the label will scale its contents to fill all available space. See the "scaledContents" property for details..SH "void QLabel::setText ( const QString & )\fC [virtual slot]\fR"Sets the label text. See the "text" property for details..SH "void QLabel::setTextFormat ( TextFormat )"Sets the label's text format. See the "textFormat" property for details..SH "QString QLabel::text () const"Returns the label text. See the "text" property for details..SH "TextFormat QLabel::textFormat () const"Returns the label's text format. See the "textFormat" property for details..SS "Property Documentation".SH "Alignment alignment"This property holds the alignment of the label's contents..PPThe alignment is a bitwise OR of Qt::AlignmentFlags and Qt::TextFlags values. The ExpandTabs, SingleLine and ShowPrefix flags apply only if the label contains plain text; otherwise they are ignored. The DontClip flag is always ignored. WordBreak applies to both rich text and plain text labels..PPIf the label has a buddy, the ShowPrefix flag is forced to TRUE..PPThe default alignment is \fCAlignAuto | AlignVCenter | ExpandTabs\fR if the label doesn't have a buddy and \fCAlignAuto | AlignVCenter | ExpandTabs | ShowPrefix\fR if the label has a buddy. If the label contains rich text, additionally WordBreak is turned on..PPSee also Qt::AlignmentFlags, alignment, setBuddy() and text..PPSet this property's value with setAlignment() and get this property's value with alignment()..SH "int indent"This property holds the label's indent in pixels..PPThe indent applies to the left edge if alignment() is AlignLeft, to the right edge if alignment() is AlignRight, to the top edge if alignment() is AlignTop, and to to the bottom edge if alignment() is AlignBottom..PPIf the indent is negative, or if no indent has been set, the label computes the effective indent as follows: if frameWidth() is 0, the effective indent becomes 0. If frameWidth() is greater than 0, the effective indent becomes half the width of the "x" character of the widget's current font()..PPSee also alignment, frameWidth and font..PPSet this property's value with setIndent() and get this property's value with indent()..SH "QPixmap pixmap"This property holds the label's pixmap..PPIf no pixmap has been set this will return an invalid pixmap..PPSetting the pixmap clears any previous content, and resizes the label if QLabel::autoResize() is TRUE. The buddy accelerator, if any, is disabled..PPSet this property's value with setPixmap() and get this property's value with pixmap()..SH "bool scaledContents"This property holds whether the label will scale its contents to fill all available space..PPWhen enabled and the label shows a pixmap, it will scale the pixmap to fill the available space..PPSee also scaledContents..PPSet this property's value with setScaledContents() and get this property's value with hasScaledContents()..SH "QString text"This property holds the label text..PPIf no text has been set this will return an empty string. Setting the text clears any previous content, unless they are the same..PPThe text will be interpreted either as a plain text or as a rich text, depending on the text format setting; see setTextFormat(). The default setting is AutoText, i.e. QLabel will try to auto-detect the format of the text set..PPIf the text is interpreted as a plain text and a buddy has been set, the buddy accelerator key is updated from the new text..PPThe label resizes itself if auto-resizing is enabled..PPNote that Qlabel is well-suited to display small rich text documents only. For large documents, use QTextView instead. QTextView will flicker less on resize and can also provide a scrollbar, when necessary..PPSee also text, textFormat, setBuddy() and alignment..PPSet this property's value with setText() and get this property's value with text()..SH "TextFormat textFormat"This property holds the label's text format..PPSee the Qt::TextFormat enum for an explanation of the possible options..PPThe default format is AutoText..PPSee also text..PPSet this property's value with setTextFormat() and get this property's value with textFormat()..SH "SEE ALSO".BR http://doc.trolltech.com/qlabel.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qlabel.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -