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

📄 q3stylesheet.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 3 页
字号:
*/int Q3StyleSheetItem::logicalFontSize() const{    return d->fontsizelog;}/*!    Sets the logical font size setting of the style to \a s. Valid    logical sizes are 1 to 7.    \sa logicalFontSize(), QFont::pointSize(), QFont::setPointSize()*/void Q3StyleSheetItem::setLogicalFontSize(int s){    d->fontsizelog = s;}/*!    Returns the logical font size step of this style.    The default is 0. Tags such as \c big define \c +1; \c small    defines \c -1.    \sa setLogicalFontSizeStep()*/int Q3StyleSheetItem::logicalFontSizeStep() const{    return d->fontsizestep;}/*!    Sets the logical font size step of this style to \a s.    \sa logicalFontSizeStep()*/void Q3StyleSheetItem::setLogicalFontSizeStep(int s){    d->fontsizestep = s;}/*!    Sets the font size setting of the style to \a s points.    \sa fontSize(), QFont::pointSize(), QFont::setPointSize()*/void Q3StyleSheetItem::setFontSize(int s){    d->fontsize = s;}/*!    Returns the font size setting of the style. This is either a valid    point size or Q3StyleSheetItem::Undefined.    \sa setFontSize(), QFont::pointSize(), QFont::setPointSize()*/int Q3StyleSheetItem::fontSize() const{    return d->fontsize;}/*!    Returns the style's font family setting. This is either a valid    font family or an empty string if no family has been set.    \sa setFontFamily(), QFont::family(), QFont::setFamily()*/QString Q3StyleSheetItem::fontFamily() const{    return d->fontfamily;}/*!    Sets the font family setting of the style to \a fam.    \sa fontFamily(), QFont::family(), QFont::setFamily()*/void Q3StyleSheetItem::setFontFamily(const QString& fam){    d->fontfamily = fam;}/*!  Returns the number of columns for this style.  \sa setNumberOfColumns(), displayMode(), setDisplayMode() */int Q3StyleSheetItem::numberOfColumns() const{    return d->ncolumns;}/*!  Sets the number of columns for this style to \a ncols. Elements in the style  are divided into columns.  This makes sense only if the style uses a block display mode  (see Q3StyleSheetItem::DisplayMode).  \sa numberOfColumns() */void Q3StyleSheetItem::setNumberOfColumns(int ncols){    if (ncols > 0)        d->ncolumns = ncols;}/*!    Returns the text color of this style or an invalid color if no    color has been set.    \sa setColor() QColor::isValid()*/QColor Q3StyleSheetItem::color() const{    return d->col;}/*!    Sets the text color of this style to \a c.    \sa color()*/void Q3StyleSheetItem::setColor(const QColor &c){    d->col = c;}/*!    Returns whether this style is an anchor.    \sa setAnchor()*/bool Q3StyleSheetItem::isAnchor() const{    return d->anchor;}/*!    If \a anc is true, sets this style to be an anchor (hypertext    link); otherwise sets it to not be an anchor. Elements in this    style link to other documents or anchors.    \sa isAnchor()*/void Q3StyleSheetItem::setAnchor(bool anc){    d->anchor = anc;}/*!    Returns the whitespace mode.    \sa setWhiteSpaceMode() WhiteSpaceMode*/Q3StyleSheetItem::WhiteSpaceMode Q3StyleSheetItem::whiteSpaceMode() const{    return d->whitespacemode;}/*!    Sets the whitespace mode to \a m.    \sa WhiteSpaceMode*/void Q3StyleSheetItem::setWhiteSpaceMode(WhiteSpaceMode m){    d->whitespacemode = m;}/*!    Returns the width of margin \a m in pixels.    The margin, \a m, can be MarginLeft, MarginRight,    MarginTop, MarginBottom, or MarginFirstLine    \sa setMargin() Margin*/int Q3StyleSheetItem::margin(Margin m) const{    if (m == MarginAll) {        return d->margin[MarginLeft];    } else if (m == MarginVertical) {        return d->margin[MarginTop];    } else if (m == MarginHorizontal) {        return d->margin[MarginLeft];    } else {        return d->margin[m];    }}/*!    Sets the width of margin \a m to \a v pixels.    The margin, \a m, can be \c MarginLeft, \c MarginRight, \c    MarginTop, \c MarginBottom, MarginFirstLine, \c MarginAll,    \c MarginVertical or \c MarginHorizontal. The value \a v must    be >= 0.    \sa margin()*/void Q3StyleSheetItem::setMargin(Margin m, int v){    if (m == MarginAll) {        d->margin[MarginLeft] = v;        d->margin[MarginRight] = v;        d->margin[MarginTop] = v;        d->margin[MarginBottom] = v;    } else if (m == MarginVertical) {        d->margin[MarginTop] = v;        d->margin[MarginBottom] = v;    } else if (m == MarginHorizontal) {        d->margin[MarginLeft] = v;        d->margin[MarginRight] = v;    } else {        d->margin[m] = v;    }}/*!    Returns the list style of the style.    \sa setListStyle() ListStyle */Q3StyleSheetItem::ListStyle Q3StyleSheetItem::listStyle() const{    return d->list;}/*!    \enum Q3StyleSheetItem::ListStyle    This enum type defines how the items in a list are prefixed when    displayed.    \value ListDisc  a filled circle (i.e. a bullet)    \value ListCircle  an unfilled circle    \value ListSquare  a filled square    \value ListDecimal  an integer in base 10: \e 1, \e 2, \e 3, ...    \value ListLowerAlpha  a lowercase letter: \e a, \e b, \e c, ...    \value ListUpperAlpha  an uppercase letter: \e A, \e B, \e C, ...    \omitvalue ListStyleUndefined*//*!    Sets the list style of the style to \a s.    This is used by nested elements that have a display mode of \c    DisplayListItem.    \sa listStyle() DisplayMode ListStyle*/void Q3StyleSheetItem::setListStyle(ListStyle s){    d->list=s;}/*!    Returns a space-separated list of names of styles that may contain    elements of this style. If nothing has been set, contexts()    returns an empty string, which indicates that this style can be    nested everywhere.    \sa setContexts()*/QString Q3StyleSheetItem::contexts() const{    return d->contxt;}/*!    Sets a space-separated list of names of styles that may contain    elements of this style. If \a c is empty, the style can be nested    everywhere.    \sa contexts()*/void Q3StyleSheetItem::setContexts(const QString& c){    d->contxt = QLatin1Char(' ') + c + QLatin1Char(' ');}/*!    Returns true if this style can be nested into an element of style    \a s; otherwise returns false.    \sa contexts(), setContexts()*/bool Q3StyleSheetItem::allowedInContext(const Q3StyleSheetItem* s) const{    if (d->contxt.isEmpty())        return true;    return d->contxt.contains(QLatin1Char(' ')+s->name()+QLatin1Char(' '));}/*!    Returns true if this style has self-nesting enabled; otherwise    returns false.    \sa setSelfNesting()*/bool Q3StyleSheetItem::selfNesting() const{    return d->selfnest;}/*!    Sets the self-nesting property for this style to \a nesting.    In order to support "dirty" HTML, paragraphs \c{<p>} and list    items \c{<li>} are not self-nesting. This means that starting a    new paragraph or list item automatically closes the previous one.    \sa selfNesting()*/void Q3StyleSheetItem::setSelfNesting(bool nesting){    d->selfnest = nesting;}/*!   \internal    Sets the linespacing to be at least \a ls pixels.    For compatibility with previous Qt releases, small values get    treated differently: If \a ls is smaller than the default font    line spacing in pixels at parse time, the resulting line spacing    is the sum of the default line spacing plus \a ls. We recommend    not relying on this behavior.*/void Q3StyleSheetItem::setLineSpacing(int ls){    d->lineSpacing = ls;}/*!  Returns the line spacing.*/int Q3StyleSheetItem::lineSpacing() const{    return d->lineSpacing;}//************************************************************************//************************************************************************/*!    \class Q3StyleSheet qstylesheet.h    \brief The Q3StyleSheet class is a collection of styles for rich text    rendering and a generator of tags.    \compat    By creating Q3StyleSheetItem 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 QTextEdit or a QTextBrowser. However, QLabel,    QWhatsThis and QMessageBox also support it, and other classes are    likely to follow. With QSimpleRichText it is possible to use the    rich text renderer for custom widgets as well.    The default Q3StyleSheet object has the following style bindings,    sorted by structuring bindings, anchors, character style bindings    (i.e. inline styles), special elements such as horizontal lines or    images, and other tags. In addition, rich text supports simple    HTML tables.    The structuring tags are    \table    \header \i Structuring tags \i Notes    \row \i \c{<qt>}...\c{</qt>}         \i A Qt rich text document. It understands the following            attributes:            \list            \i \c title -- The caption of the document. This attribute is                easily accessible with QTextEdit::documentTitle().            \i \c type -- The type of the document. The default type is \c                page. It indicates that the document is displayed in a                page of its own. Another style is \c detail, which can be                used to explain certain expressions in more detail in a                few sentences. For \c detail, 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 \c{<qt type="detail">...</qt>}.            \i \c bgcolor -- The background color, for example \c                bgcolor="yellow" or \c bgcolor="#0000FF".            \i \c background -- The background pixmap, for example \c                background="granite.xpm". The pixmap name will be resolved                by a Q3MimeSourceFactory().            \i \c text -- The default text color, for example \c text="red".            \i \c link -- The link color, for example \c link="green".            \endlist    \row \i \c{<h1>...</h1>}         \i A top-level heading.    \row \i \c{<h2>...</h2>}         \i A sublevel heading.    \row \i \c{<h3>...</h3>}         \i A sub-sublevel heading.    \row \i \c{<p>...</p>}         \i A left-aligned paragraph. Adjust the alignment with the \c            align attribute. Possible values are \c left, \c right and            \c center.    \row \i \c{<center>...}<br>\c{</center>}         \i A centered paragraph.    \row \i \c{<blockquote>...}<br>\c{</blockquote>}         \i An indented paragraph that is useful for quotes.    \row \i \c{<ul>...</ul>}         \i An unordered list. You can also pass a type argument to            define the bullet style. The default is \c type=disc;            other types are \c circle and \c square.    \row \i \c{<ol>...</ol>}         \i An ordered list. You can also pass a type argument to            define the enumeration label style. The default is \c            type="1"; other types are \c "a" and \c "A".    \row \i \c{<li>...</li>}         \i A list item. This tag can be used only within the context            of \c{<ol>} or \c{<ul>}.    \row \i \c{<pre>...</pre>}         \i For larger chunks of code. Whitespaces in the contents are            preserved. For small bits of code use the inline-style \c            code.    \endtable    Anchors and links are done with a single tag:    \table    \header \i Anchor tags \i Notes    \row \i \c{<a>...</a>}         \i An anchor or link.            \list            \i A link is created by using an \c href                attribute, for example                <br>\c{<a href="target.qml">Link Text</a>}. Links to                targets within a document are achieved in the same way                as for HTML, e.g.                <br>\c{<a href="target.qml#subtitle">Link Text</a>}.            \i A target is created by using a \c name                attribute, for example                <br>\c{<a name="subtitle"><h2>Sub Title</h2></a>}.            \endlist    \endtable    The default character style bindings are    \table    \header \i Style tags \i Notes    \row \i \c{<em>...</em>}         \i Emphasized. By default this is the same as \c{<i>...</i>}            (italic).    \row \i \c{<strong>...</strong>}         \i Strong. By default this is the same as \c{<b>...</b>}            (bold).    \row \i \c{<i>...</i>}         \i Italic font style.    \row \i \c{<b>...</b>}         \i Bold font style.    \row \i \c{<u>...</u>}         \i Underlined font style.    \row \i \c{<s>...</s>}         \i Strike out font style.    \row \i \c{<big>...</big>}         \i A larger font size.    \row \i \c{<small>...</small>}         \i A smaller font size.    \row \i \c{<sub>...</sub>}         \i Subscripted text    \row \i \c{<sup>...</sup>}         \i Superscripted text

⌨️ 快捷键说明

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