📄 qstylesheet.3qt
字号:
.TH QStyleSheet 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQStyleSheet \- A collection of styles for rich text rendering and a generator of tags.SH SYNOPSIS.br.PP\fC#include <qstylesheet.h>\fR.PPInherits QObject..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQStyleSheet\fR ( QObject * " "parent" "=0, const char * " "name" "=0 )".br.ti -1c.BI "virtual \fB~QStyleSheet\fR ()".br.ti -1c.BI "QStyleSheetItem* \fBitem\fR ( const QString & name )".br.ti -1c.BI "const QStyleSheetItem* \fBitem\fR ( const QString & name ) const".br.ti -1c.BI "void \fBinsert\fR ( QStyleSheetItem * item )".br.ti -1c.BI "virtual QTextNode* \fBtag\fR ( const QString & " "name" ", const QMap<QString, QString> & " "attr" ", const QString & " "context" ", const QMimeSourceFactory & " "factory" ", bool " "emptyTag" " = FALSE ) const".br.ti -1c.BI "virtual void \fBscaleFont\fR ( QFont & " "font" ", int logicalSize ) const".br.ti -1c.BI "virtual void \fBerror\fR ( const QString & ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QStyleSheet* \fBdefaultSheet\fR ()".br.ti -1c.BI "void \fBsetDefaultSheet\fR ( QStyleSheet * )".br.ti -1c.BI "QString \fBconvertFromPlainText\fR ( const QString & )".br.ti -1c.BI "bool \fBmightBeRichText\fR ( const QString & )".br.in -1c.SH DESCRIPTIONA collection of styles for rich text rendering and a generator of tags..PPBy creating QStyleSheetItem objects for a style sheet, you build a definition of a set of tags. This definition will be used by the internal rich text rendering system to parse and display text documents to which the style sheet applies. Rich text is normally visualized in a QTextView or a QTextBrowser. But also QLabel, QWhatsThis and QMessageBox support it for now, with others likely to follow. With QSimpleRichText it is possible to use the rich text renderer for custom widgets as well..PPThe default QStyleSheet object has the following style bindings:.TP\fC<qt>...</qt>\fR - A Qt rich text document. It understands the following attributes.TP\fCtitle\fR - the caption of the document. This attribute is easily accessible with QTextView::documentTitle().TP\fCtype\fR - The type of the document. The default type is \fCpage\fR . It indicates that the document is displayed in a page of its own. Another style is \fCdetail.\fR It can be used to explain certain expressions more detailed in a few sentences. The QTextBrowser will then keep the current page and display the new document in a small popup similar to QWhatsThis. Note that links will not work in documents with \fC<qt type="detail" >...</qt>\fR.TP\fCbgcolor\fR - The background color, for example \fCbgcolor="yellow"\fR or \fCbgcolor="#0000FF"\fR.TP\fCbackground\fR - The background pixmap, for example \fCbackground="granit.xpm".\fR The pixmap name will be resolved by a QMimeSourceFactory()..TP\fCtext\fR - The default text color, for example \fCtext="red"\fR.TP\fClink\fR - The link color, for example \fClink="green"\fR.TP\fC<a>...</a>\fR - An anchor or link. The reference target is defined in the \fChref\fR attribute of the tag as in \\c<a \fChref="target.qml">...</a>.\fR You can also specify an additional anchor within the specified target document, for example \fC<a href="target.qml#123">...</a>.\fR If \fCa\fR is meant to be an anchor, the reference source is given in the \fCname\fR attribute..TP\fC<font>...</font>\fR - Customizes the font size and text color. The tag understands two attributes:.TP\fCcolor\fR - the text color, for example \fCcolor="red"\fR or \fCcolor="#FF0000".\fR.TP\fCsize\fR - the logical size of the font. Logical sizes 1 to 7 are supported. The value may either be absolute, for example \fCsize=3,\fR or relative. In the latter case, the sizes are simply added..TP\fC<em>...</em>\fR - Emphasized. As default, this is the same as \fC<i>...</i>\fR (Italic).TP\fC<strong>...</strong>\fR - Strong. As default, this is the same as \fC<bold>...</bold>\fR (bold).TP\fC<big>...</big>\fR - A larger font size..TP\fC<small>...</small>\fR - A smaller font size..TP\fC<code>...</code>\fR - Indicates Code. As default, this is the same as \fC<tt>...</tt>\fR (typewriter).TP\fC<pre>...</pre>\fR - For larger junks of code. Whitespaces in the contents are preserved..TP\fC<large>...</large>\fR - Large font size..TP\fC<b>...</b>\fR - style->setFontWeight( QFont::Bold); Bold font style..TP\fC<h1>...</h1>\fR - A top-level heading..TP\fC<h2>...</h2>\fR - A sub-level heading..TP\fC<h3>...</h3>\fR - A sub-sub-level heading..TP\fC<p>...</p>\fR - A paragraph..TP\fC<center>...</center>\fR - A centered paragraph..TP\fC<blockquote>...</blockquote>\fR - An indented paragraph, useful for quotes..TP\fC<multicol cols=\fIn\fR >...</multicol>\fR - Multicol display with \fIn\fR columns.TP\fC<twocolumn>...</twocolumn>\fR - Two-column display..TP\fC<ul>...</ul>\fR - An un-ordered list. You can also pass a type argument to define the bullet style. The default is \fCtype=disc,\fR other types are \fCcircle\fR and \fCsquare.\fR.TP\fC<ol>...</ol>\fR - An ordered list. You can also pass a type argument to define the enumeration label style. The default is \fCtype="1",\fR other types are \fC"a"\fR and \fC"A".\fR.TP\fC<li>...</li>\fR - A list item..TP\fC<img/>\fR - An image. The image name for the mime source factory is given in the source attribute, for example \fC<img source="qt.xpm"/>\fR The image tag also understands the attributes \fCwidth\fR and \fCheight\fR that determine the size of the image. If the pixmap does not fit to the specified size, it will be scaled automatically ( by using QImage::smoothScale() )..TP\fC<br/>\fR - A line break.TP\fC<hr/>\fR - A horizonal line.SH MEMBER FUNCTION DOCUMENTATION.SH "QStyleSheet::QStyleSheet ( QObject * parent=0, const char * name=0 )"Create a style sheet. Like any QObject, the created object will be deleted when its parent destructs (if the child still exists then)..PPBy default, the style sheet has the tag definitions defined above..SH "QStyleSheet::~QStyleSheet () \fC[virtual]\fR"Destroys the style sheet. All styles inserted into the style sheet will be deleted..SH "QString QStyleSheet::convertFromPlainText ( const QString & plain ) \fC[static]\fR"Auxiliary function. Converts the plain text string \fIplain\fR to a rich text formatted string while preserving its look..SH "QStyleSheet* QStyleSheet::defaultSheet () \fC[static]\fR"Returns the application-wide default style sheet.This style sheet is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and also QMessageBox to define the rendering style and available tags within rich text documents. It serves also as initial style sheet for the more complex render widgets QTextView and QTextBrowser..PPSee also: setDefaultSheet()..PPExamples:.(lqbrowser/main.cpp.)l.SH "void QStyleSheet::error ( const QString & msg ) const \fC[virtual]\fR"This virtual function is called when an error occurs when processsing rich text. Reimplement if if you need to catch error messages..PPErrors might occur if some rich text strings contain tags that are not understood by the stylesheet, if some tags are nested wrongly or if tags are not closed properly..PP\fImsg\fR is the error message..SH "void QStyleSheet::insert ( QStyleSheetItem * style )"For internal use only..SH "QStyleSheetItem* QStyleSheet::item ( const QString & name )"Returns the style with name \fIname\fR or 0 if there is no such style..SH "const QStyleSheetItem* QStyleSheet::item ( const QString & name ) const"Returns the style with name \fIname\fR or 0 if there is no such style (const version)..SH "bool QStyleSheet::mightBeRichText ( const QString & text ) \fC[static]\fR"Returns whether the string \fItext\fR is likely to be rich text formatted..PPNote: The function uses a fast and therefore simple heuristic. It mainly checks whether there is something that looks like a tag before the first line break. While the result may be correct for most common cases, there is no guarantee..SH "void QStyleSheet::scaleFont ( QFont & font, int logicalSize ) const \fC[virtual]\fR"Scales the font \fIfont\fR to the appropriate physical point size corresponding to the logical font size \fIlogicalSize.\fR.PPWhen calling this function, \fIfont\fR has a point size corresponding to the logical font size 3..PPTypical logical font sizes range from 1 to 7, with 1 being the smallest..PPSee also: logicalFontSize(), logicalFontSizeStep() and QFont::setPointSize()..SH "void QStyleSheet::setDefaultSheet ( QStyleSheet * sheet ) \fC[static]\fR"Sets the application-wide default style sheet, deleting any style sheet previously set. The ownership is transferred..PPSee also: defaultSheet()..SH "QTextNode* QStyleSheet::tag ( const QString & name, const QMap<QString, QString> & attr, const QString & context, const QMimeSourceFactory & factory, bool emptyTag = FALSE ) const \fC[virtual]\fR"Generates an internal object for tag named \fIname,\fR given the attributes \fIattr,\fR and using additional information provided by the mime source factory \fIfactory\fR ..PPThis function should not (yet) be used in application code..SH "SEE ALSO".BR http://www.troll.no/qt/qstylesheet.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS. See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -