summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-write/qstylesheet.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-write/qstylesheet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-write/qstylesheet.cpp1230
1 files changed, 659 insertions, 571 deletions
diff --git a/noncore/apps/opie-write/qstylesheet.cpp b/noncore/apps/opie-write/qstylesheet.cpp
index 7ab9ec6..67cd828 100644
--- a/noncore/apps/opie-write/qstylesheet.cpp
+++ b/noncore/apps/opie-write/qstylesheet.cpp
@@ -56,2 +56,3 @@ public:
int fontunderline;
+ int fontstrikeout;
int fontweight;
@@ -80,22 +81,25 @@ public:
/*!
- \class QStyleSheetItem qstylesheet.h
- \ingroup text
- \brief The QStyleSheetItem class provides an encapsulation of a set of text styles.
-
- A style sheet item consists of a name and a set of attributes that
- specifiy its font, color, etc. When used in a \link QStyleSheet
- style sheet\endlink (see styleSheet()), items define the name() of a
- rich text tag and the display property changes associated with it.
-
- The \link QStyleSheetItem::DisplayMode display mode\endlink
- attribute indicates whether the item is a block, an inline element
- or a list element; see setDisplayMode(). The treatment of whitespace
- is controlled by the \link QStyleSheetItem::WhiteSpaceMode white
- space mode\endlink; see setWhiteSpaceMode(). An item's margins are
- set with setMargin(), and line spacing is set with setLineSpacing().
- In the case of list items, the list style is set with
- setListStyle(). An item may be a hypertext link anchor; see
- setAnchor(). Other attributes are set with setAlignment(),
- setVerticalAlignment(), setFontFamily(), setFontSize(),
- setFontWeight(), setFontItalic(), setFontUnderline() and setColor().
+ \class QStyleSheetItem qstylesheet.h
+ \brief The QStyleSheetItem class provides an encapsulation of a set of text styles.
+
+ \ingroup text
+
+ A style sheet item consists of a name and a set of attributes that
+ specifiy its font, color, etc. When used in a \link QStyleSheet
+ style sheet\endlink (see styleSheet()), items define the name() of
+ a rich text tag and the display property changes associated with
+ it.
+
+ The \link QStyleSheetItem::DisplayMode display mode\endlink
+ attribute indicates whether the item is a block, an inline element
+ or a list element; see setDisplayMode(). The treatment of
+ whitespace is controlled by the \link
+ QStyleSheetItem::WhiteSpaceMode white space mode\endlink; see
+ setWhiteSpaceMode(). An item's margins are set with setMargin(),
+ In the case of list items, the list style is set with
+ setListStyle(). An item may be a hypertext link anchor; see
+ setAnchor(). Other attributes are set with setAlignment(),
+ setVerticalAlignment(), setFontFamily(), setFontSize(),
+ setFontWeight(), setFontItalic(), setFontUnderline(),
+ setFontStrikeOut and setColor().
*/
@@ -106,15 +110,17 @@ public:
-/*! \enum QStyleSheetItem::WhiteSpaceMode
+/*!
+ \enum QStyleSheetItem::WhiteSpaceMode
- This enum defines the ways in which QStyleSheet can treat whitespace. There are three values at present:
+ This enum defines the ways in which QStyleSheet can treat
+ whitespace.
- \value WhiteSpaceNormal any sequence of whitespace (including
- line-breaks) is equivalent to a single space.
+ \value WhiteSpaceNormal any sequence of whitespace (including
+ line-breaks) is equivalent to a single space.
- \value WhiteSpacePre whitespace must be output exactly as given
- in the input.
+ \value WhiteSpacePre whitespace must be output exactly as given
+ in the input.
- \value WhiteSpaceNoWrap multiple spaces are collapsed as with
- WhiteSpaceNormal, but no automatic line-breaks occur. To break lines manually,
- use the \c{<br>} tag.
+ \value WhiteSpaceNoWrap multiple spaces are collapsed as with
+ WhiteSpaceNormal, but no automatic line-breaks occur. To break
+ lines manually, use the \c{<br>} tag.
@@ -122,12 +128,14 @@ public:
-/*! \enum QStyleSheetItem::Margin
-
- \value MarginLeft left margin
- \value MarginRight right margin
- \value MarginTop top margin
- \value MarginBottom bottom margin
- \value MarginAll all margins (left, right, top and bottom)
- \value MarginVertical top and bottom margins
- \value MarginHorizontal left and right margins
- \value MarginFirstLine margin (indentation) of the first line of a paragarph (in addition to the MarginLeft of the paragraph)
+/*!
+ \enum QStyleSheetItem::Margin
+
+ \value MarginLeft left margin
+ \value MarginRight right margin
+ \value MarginTop top margin
+ \value MarginBottom bottom margin
+ \value MarginAll all margins (left, right, top and bottom)
+ \value MarginVertical top and bottom margins
+ \value MarginHorizontal left and right margins
+ \value MarginFirstLine margin (indentation) of the first line of
+ a paragarph (in addition to the MarginLeft of the paragraph)
*/
@@ -135,7 +143,8 @@ public:
/*!
- Constructs a new style named \a name for the stylesheet \a parent.
+ Constructs a new style called \a name for the stylesheet \a
+ parent.
- All properties in QStyleSheetItem are initially in the "do not change" state,
- except \link QStyleSheetItem::DisplayMode display mode\endlink, which defaults
- to \c DisplayInline.
+ All properties in QStyleSheetItem are initially in the "do not
+ change" state, except \link QStyleSheetItem::DisplayMode display
+ mode\endlink, which defaults to \c DisplayInline.
*/
@@ -152,5 +161,5 @@ QStyleSheetItem::QStyleSheetItem( QStyleSheet* parent, const QString& name )
/*!
- Copy constructor. Constructs a copy of \a other that is
- not bound to any style sheet.
- */
+ Copy constructor. Constructs a copy of \a other that is not bound
+ to any style sheet.
+*/
QStyleSheetItem::QStyleSheetItem( const QStyleSheetItem & other )
@@ -163,5 +172,5 @@ QStyleSheetItem::QStyleSheetItem( const QStyleSheetItem & other )
/*!
- Destroys the style. Note that QStyleSheetItem objects become owned
- by QStyleSheet when they are created.
- */
+ Destroys the style. Note that QStyleSheetItem objects become
+ owned by QStyleSheet when they are created.
+*/
QStyleSheetItem::~QStyleSheetItem()
@@ -174,4 +183,4 @@ QStyleSheetItem::~QStyleSheetItem()
/*!
- Returns the style sheet this item is in.
- */
+ Returns the style sheet this item is in.
+*/
QStyleSheet* QStyleSheetItem::styleSheet()
@@ -183,4 +192,5 @@ QStyleSheet* QStyleSheetItem::styleSheet()
\overload
- Returns the style sheet this item is in.
- */
+
+ Returns the style sheet this item is in.
+*/
const QStyleSheet* QStyleSheetItem::styleSheet() const
@@ -200,2 +210,3 @@ void QStyleSheetItem::init()
d->fontunderline = Undefined;
+ d->fontstrikeout = Undefined;
d->fontweight = Undefined;
@@ -214,4 +225,4 @@ void QStyleSheetItem::init()
d->margin[4] = Undefined;
- d->list = QStyleSheetItem::ListDisc;
- d->whitespacemode = QStyleSheetItem::WhiteSpaceNormal;
+ d->list = (ListStyle) Undefined;
+ d->whitespacemode = (WhiteSpaceMode) Undefined;
d->selfnest = TRUE;
@@ -221,3 +232,3 @@ void QStyleSheetItem::init()
/*!
- Returns the name of the style item.
+ Returns the name of the style item.
*/
@@ -229,7 +240,7 @@ QString QStyleSheetItem::name() const
/*!
- Returns the \link QStyleSheetItem::DisplayMode display mode\endlink
- of the style.
+ Returns the \link QStyleSheetItem::DisplayMode display
+ mode\endlink of the style.
- \sa setDisplayMode()
- */
+ \sa setDisplayMode()
+*/
QStyleSheetItem::DisplayMode QStyleSheetItem::displayMode() const
@@ -239,16 +250,17 @@ QStyleSheetItem::DisplayMode QStyleSheetItem::displayMode() const
-/*! \enum QStyleSheetItem::DisplayMode
+/*!
+ \enum QStyleSheetItem::DisplayMode
- This enum type defines the way adjacent elements are displayed. The possible values are:
+ This enum type defines the way adjacent elements are displayed.
- \value DisplayBlock elements are displayed as a rectangular block
- (e.g. \c{<p>...</p>}).
+ \value DisplayBlock elements are displayed as a rectangular block
+ (e.g. \c{<p>...</p>}).
- \value DisplayInline elements are displayed in a horizontally flowing
- sequence (e.g. \c{<em>...</em>}).
+ \value DisplayInline elements are displayed in a horizontally
+ flowing sequence (e.g. \c{<em>...</em>}).
- \value DisplayListItem elements are displayed in a vertical sequence
- (e.g. \c{<li>...</li>}).
+ \value DisplayListItem elements are displayed in a vertical
+ sequence (e.g. \c{<li>...</li>}).
- \value DisplayNone elements are not displayed at all.
+ \value DisplayNone elements are not displayed at all.
*/
@@ -256,5 +268,5 @@ QStyleSheetItem::DisplayMode QStyleSheetItem::displayMode() const
/*!
- Sets the display mode of the style to \a m.
+ Sets the display mode of the style to \a m.
- \sa displayMode()
+ \sa displayMode()
*/
@@ -267,7 +279,8 @@ void QStyleSheetItem::setDisplayMode(DisplayMode m)
/*!
- Returns the alignment of this style. Possible values are AlignAuto, AlignLeft,
- AlignRight, AlignCenter and AlignJustify.
+ Returns the alignment of this style. Possible values are \c
+ AlignAuto, \c AlignLeft, \c AlignRight, \c AlignCenter or \c
+ AlignJustify.
- \sa setAlignment(), Qt::AlignmentFlags
- */
+ \sa setAlignment(), Qt::AlignmentFlags
+*/
int QStyleSheetItem::alignment() const
@@ -278,9 +291,9 @@ int QStyleSheetItem::alignment() const
/*!
- Sets the alignment to \a f. This only makes sense for styles with a
- \link QStyleSheetItem::DisplayMode display mode\endlink of
- DisplayBlock. Possible values are AlignAuto, AlignLeft, AlignRight,
- AlignCenter and AlignJustify.
+ Sets the alignment to \a f. This only makes sense for styles with
+ a \link QStyleSheetItem::DisplayMode display mode\endlink of
+ DisplayBlock. Possible values are \c AlignAuto, \c AlignLeft,
+ \c AlignRight, \c AlignCenter or \c AlignJustify.
- \sa alignment(), displayMode(), Qt::AlignmentFlags
- */
+ \sa alignment(), displayMode(), Qt::AlignmentFlags
+*/
void QStyleSheetItem::setAlignment( int f )
@@ -292,7 +305,7 @@ void QStyleSheetItem::setAlignment( int f )
/*!
- Returns the vertical alignment of the style. Possible values are
- VAlignBaseline, VAlignSub and VAlignSuper.
+ Returns the vertical alignment of the style. Possible values are
+ \c VAlignBaseline, \c VAlignSub or \c VAlignSuper.
- psa setVerticalAlignment()
- */
+ \sa setVerticalAlignment()
+*/
QStyleSheetItem::VerticalAlignment QStyleSheetItem::verticalAlignment() const
@@ -302,14 +315,15 @@ QStyleSheetItem::VerticalAlignment QStyleSheetItem::verticalAlignment() const
-/*! \enum QStyleSheetItem::VerticalAlignment
+/*!
+ \enum QStyleSheetItem::VerticalAlignment
- This enum type defines the way elements are aligned vertically. This
- is supported for text elements only. The possible values are:
+ This enum type defines the way elements are aligned vertically.
+ This is only supported for text elements.
- \value VAlignBaseline align the baseline of the element (or the
- bottom, if the element doesn't have a baseline) with the baseline of
- the parent
+ \value VAlignBaseline align the baseline of the element (or the
+ bottom, if the element doesn't have a baseline) with the
+ baseline of the parent
- \value VAlignSub subscript the element
+ \value VAlignSub subscript the element
- \value VAlignSuper superscript the element
+ \value VAlignSuper superscript the element
@@ -319,9 +333,9 @@ QStyleSheetItem::VerticalAlignment QStyleSheetItem::verticalAlignment() const
/*!
- Sets the vertical alignment to \a valign. Possible values are
- VAlignBaseline, VAlignSub and VAlignSuper.
+ Sets the vertical alignment to \a valign. Possible values are
+ \c VAlignBaseline, \c VAlignSub or \c VAlignSuper.
- The vertical alignment property is not inherited.
+ The vertical alignment property is not inherited.
- \sa verticalAlignment()
- */
+ \sa verticalAlignment()
+*/
void QStyleSheetItem::setVerticalAlignment( VerticalAlignment valign )
@@ -333,6 +347,7 @@ void QStyleSheetItem::setVerticalAlignment( VerticalAlignment valign )
/*!
- Returns TRUE if the style sets an italic font; otherwise returns FALSE.
+ Returns TRUE if the style sets an italic font; otherwise returns
+ FALSE.
- \sa setFontItalic(), definesFontItalic()
- */
+ \sa setFontItalic(), definesFontItalic()
+*/
bool QStyleSheetItem::fontItalic() const
@@ -346,4 +361,4 @@ bool QStyleSheetItem::fontItalic() const
- \sa fontItalic(), definesFontItalic()
- */
+ \sa fontItalic(), definesFontItalic()
+*/
void QStyleSheetItem::setFontItalic(bool italic)
@@ -354,7 +369,8 @@ void QStyleSheetItem::setFontItalic(bool italic)
/*!
- Returns whether the style defines a font shape. A style
- does not define any shape until setFontItalic() is called.
+ Returns TRUE if the style defines a font shape; otherwise returns
+ FALSE. A style does not define any shape until setFontItalic() is
+ called.
- \sa setFontItalic(), fontItalic()
- */
+ \sa setFontItalic(), fontItalic()
+*/
bool QStyleSheetItem::definesFontItalic() const
@@ -365,6 +381,7 @@ bool QStyleSheetItem::definesFontItalic() const
/*!
- Returns TRUE if the style sets an underlined font; otherwise returns FALSE.
+ Returns TRUE if the style sets an underlined font; otherwise
+ returns FALSE.
- \sa setFontUnderline(), definesFontUnderline()
- */
+ \sa setFontUnderline(), definesFontUnderline()
+*/
bool QStyleSheetItem::fontUnderline() const
@@ -375,7 +392,7 @@ bool QStyleSheetItem::fontUnderline() const
/*!
- If \a underline is TRUE sets underline for the style; otherwise sets
- no underline.
+ If \a underline is TRUE, sets underline for the style; otherwise
+ sets no underline.
- \sa fontUnderline(), definesFontUnderline()
- */
+ \sa fontUnderline(), definesFontUnderline()
+*/
void QStyleSheetItem::setFontUnderline(bool underline)
@@ -386,7 +403,8 @@ void QStyleSheetItem::setFontUnderline(bool underline)
/*!
- Returns whether the style defines a setting for the underline
- property of the font. A style does not define this until
- setFontUnderline() is called.
+ Returns TRUE if the style defines a setting for the underline
+ property of the font; otherwise returns FALSE. A style does not
+ define this until setFontUnderline() is called.
- \sa setFontUnderline(), fontUnderline() */
+ \sa setFontUnderline(), fontUnderline()
+*/
bool QStyleSheetItem::definesFontUnderline() const
@@ -398,7 +416,42 @@ bool QStyleSheetItem::definesFontUnderline() const
/*!
- Returns the font weight setting of the style. This is either a
- valid QFont::Weight or the value QStyleSheetItem::Undefined.
+ Returns TRUE if the style sets a strike out font; otherwise
+ returns FALSE.
- \sa setFontWeight(), QFont
- */
+ \sa setFontStrikeOut(), definesFontStrikeOut()
+*/
+bool QStyleSheetItem::fontStrikeOut() const
+{
+ return d->fontstrikeout > 0;
+}
+
+/*!
+ If \a strikeOut is TRUE, sets strike out for the style; otherwise
+ sets no strike out.
+
+ \sa fontStrikeOut(), definesFontStrikeOut()
+*/
+void QStyleSheetItem::setFontStrikeOut(bool strikeOut)
+{
+ d->fontstrikeout = strikeOut?1:0;
+}
+
+/*!
+ Returns TRUE if the style defines a setting for the strikeOut
+ property of the font; otherwise returns FALSE. A style does not
+ define this until setFontStrikeOut() is called.
+
+ \sa setFontStrikeOut(), fontStrikeOut()
+*/
+bool QStyleSheetItem::definesFontStrikeOut() const
+{
+ return d->fontstrikeout != Undefined;
+}
+
+
+/*!
+ Returns the font weight setting of the style. This is either a
+ valid \c QFont::Weight or the value \c QStyleSheetItem::Undefined.
+
+ \sa setFontWeight(), QFont
+*/
int QStyleSheetItem::fontWeight() const
@@ -409,7 +462,7 @@ int QStyleSheetItem::fontWeight() const
/*!
- Sets the font weight setting of the style to \a w. Valid values are
- those defined by QFont::Weight.
+ Sets the font weight setting of the style to \a w. Valid values
+ are those defined by \c QFont::Weight.
- \sa QFont, fontWeight()
- */
+ \sa QFont, fontWeight()
+*/
void QStyleSheetItem::setFontWeight(int w)
@@ -420,7 +473,7 @@ void QStyleSheetItem::setFontWeight(int w)
/*!
- Returns the logical font size setting of the style. This is either a valid
- size between 1 and 7 or QStyleSheetItem::Undefined.
+ Returns the logical font size setting of the style. This is either
+ a valid size between 1 and 7 or \c QStyleSheetItem::Undefined.
- \sa setLogicalFontSize(), setLogicalFontSizeStep(), QFont::pointSize(), QFont::setPointSize()
- */
+ \sa setLogicalFontSize(), setLogicalFontSizeStep(), QFont::pointSize(), QFont::setPointSize()
+*/
int QStyleSheetItem::logicalFontSize() const
@@ -432,7 +485,7 @@ int QStyleSheetItem::logicalFontSize() const
/*!
- Sets the logical font size setting of the style to \a s.
- Valid logical sizes are 1 to 7.
+ 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()
- */
+ \sa logicalFontSize(), QFont::pointSize(), QFont::setPointSize()
+*/
void QStyleSheetItem::setLogicalFontSize(int s)
@@ -443,9 +496,9 @@ void QStyleSheetItem::setLogicalFontSize(int s)
/*!
- Returns the logical font size step of this style.
+ 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.
+ The default is 0. Tags such as \c big define \c +1; \c small
+ defines \c -1.
- \sa setLogicalFontSizeStep()
- */
+ \sa setLogicalFontSizeStep()
+*/
int QStyleSheetItem::logicalFontSizeStep() const
@@ -456,6 +509,6 @@ int QStyleSheetItem::logicalFontSizeStep() const
/*!
- Sets the logical font size step of this style to \a s.
+ Sets the logical font size step of this style to \a s.
- \sa logicalFontSizeStep()
- */
+ \sa logicalFontSizeStep()
+*/
void QStyleSheetItem::setLogicalFontSizeStep( int s )
@@ -468,6 +521,6 @@ void QStyleSheetItem::setLogicalFontSizeStep( int s )
/*!
- Sets the font size setting of the style to \a s points.
+ Sets the font size setting of the style to \a s points.
- \sa fontSize(), QFont::pointSize(), QFont::setPointSize()
- */
+ \sa fontSize(), QFont::pointSize(), QFont::setPointSize()
+*/
void QStyleSheetItem::setFontSize(int s)
@@ -478,7 +531,7 @@ void QStyleSheetItem::setFontSize(int s)
/*!
- Returns the font size setting of the style. This is either a valid
- point size or QStyleSheetItem::Undefined.
+ Returns the font size setting of the style. This is either a valid
+ point size or \c QStyleSheetItem::Undefined.
- \sa setFontSize(), QFont::pointSize(), QFont::setPointSize()
- */
+ \sa setFontSize(), QFont::pointSize(), QFont::setPointSize()
+*/
int QStyleSheetItem::fontSize() const
@@ -490,7 +543,7 @@ int QStyleSheetItem::fontSize() const
/*!
- Returns the font family setting of the style. This is either a valid
- font family or QString::null if no family has been set.
+ Returns the font family setting of the style. This is either a
+ valid font family or QString::null if no family has been set.
- \sa setFontFamily(), QFont::family(), QFont::setFamily()
- */
+ \sa setFontFamily(), QFont::family(), QFont::setFamily()
+*/
QString QStyleSheetItem::fontFamily() const
@@ -501,6 +554,6 @@ QString QStyleSheetItem::fontFamily() const
/*!
- Sets the font family setting of the style to \a fam.
+ Sets the font family setting of the style to \a fam.
- \sa fontFamily(), QFont::family(), QFont::setFamily()
- */
+ \sa fontFamily(), QFont::family(), QFont::setFamily()
+*/
void QStyleSheetItem::setFontFamily( const QString& fam)
@@ -524,3 +577,3 @@ int QStyleSheetItem::numberOfColumns() const
/*!\obsolete
- Sets the number of columns for this style. Elements in the style
+ Sets the number of columns for this style. Elements in the style
are divided into columns.
@@ -540,7 +593,7 @@ void QStyleSheetItem::setNumberOfColumns(int ncols)
/*!
- Returns the text color of this style or an invalid color
- if no color has been set.
+ Returns the text color of this style or an invalid color if no
+ color has been set.
- \sa setColor() QColor::isValid()
- */
+ \sa setColor() QColor::isValid()
+*/
QColor QStyleSheetItem::color() const
@@ -551,6 +604,6 @@ QColor QStyleSheetItem::color() const
/*!
- Sets the text color of this style to \a c.
+ Sets the text color of this style to \a c.
- \sa color()
- */
+ \sa color()
+*/
void QStyleSheetItem::setColor( const QColor &c)
@@ -561,6 +614,6 @@ void QStyleSheetItem::setColor( const QColor &c)
/*!
- Returns whether this style is an anchor.
+ Returns whether this style is an anchor.
- \sa setAnchor()
- */
+ \sa setAnchor()
+*/
bool QStyleSheetItem::isAnchor() const
@@ -571,8 +624,8 @@ bool QStyleSheetItem::isAnchor() const
/*!
- 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 have
- connections to other documents or anchors.
+ 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()
- */
+ \sa isAnchor()
+*/
void QStyleSheetItem::setAnchor(bool anc)
@@ -584,6 +637,6 @@ void QStyleSheetItem::setAnchor(bool anc)
/*!
- Returns the whitespace mode.
+ Returns the whitespace mode.
- \sa setWhiteSpaceMode() WhiteSpaceMode
- */
+ \sa setWhiteSpaceMode() WhiteSpaceMode
+*/
QStyleSheetItem::WhiteSpaceMode QStyleSheetItem::whiteSpaceMode() const
@@ -594,5 +647,6 @@ QStyleSheetItem::WhiteSpaceMode QStyleSheetItem::whiteSpaceMode() const
/*!
- Sets the whitespace mode to \a m.
- \sa WhiteSpaceMode
- */
+ Sets the whitespace mode to \a m.
+
+ \sa WhiteSpaceMode
+*/
void QStyleSheetItem::setWhiteSpaceMode(WhiteSpaceMode m)
@@ -604,10 +658,10 @@ void QStyleSheetItem::setWhiteSpaceMode(WhiteSpaceMode m)
/*!
- Returns the width of margin \a m in pixels.
+ Returns the width of margin \a m in pixels.
- The margin, \a m, can be \c MarginLeft, \c MarginRight,
- \c MarginTop, \c MarginBottom, \c MarginAll, \c MarginVertical or \c
- MarginHorizontal.
+ The margin, \a m, can be \c MarginLeft, \c MarginRight, \c
+ MarginTop, \c MarginBottom, \c MarginAll, \c MarginVertical or \c
+ MarginHorizontal.
- \sa setMargin() Margin
- */
+ \sa setMargin() Margin
+*/
int QStyleSheetItem::margin(Margin m) const
@@ -619,10 +673,10 @@ int QStyleSheetItem::margin(Margin m) const
/*!
- Sets the width of margin \a m to \a v pixels.
+ 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, \c MarginAll, \c MarginVertical or \c
- MarginHorizontal. The value \a v must be >= 0.
+ The margin, \a m, can be \c MarginLeft, \c MarginRight, \c
+ MarginTop, \c MarginBottom, \c MarginAll, \c MarginVertical or \c
+ MarginHorizontal. The value \a v must be >= 0.
- \sa margin()
- */
+ \sa margin()
+*/
void QStyleSheetItem::setMargin(Margin m, int v)
@@ -648,5 +702,5 @@ void QStyleSheetItem::setMargin(Margin m, int v)
/*!
- Returns the list style of the style.
+ Returns the list style of the style.
- \sa setListStyle() ListStyle
+ \sa setListStyle() ListStyle
*/
@@ -657,22 +711,24 @@ QStyleSheetItem::ListStyle QStyleSheetItem::listStyle() const
-/*! \enum QStyleSheetItem::ListStyle
+/*!
+ \enum QStyleSheetItem::ListStyle
- This enum type defines how the items in a list are prefixed when
- displayed. The currently defined values are:
+ 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, ...
+ \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, ...
*/
+
/*!
- Sets the list style of the style to \a s.
+ Sets the list style of the style to \a s.
- This is used by nested elements that have a display mode of
- \c DisplayListItem.
+ This is used by nested elements that have a display mode of \c
+ DisplayListItem.
- \sa listStyle() DisplayMode ListStyle
- */
+ \sa listStyle() DisplayMode ListStyle
+*/
void QStyleSheetItem::setListStyle(ListStyle s)
@@ -683,9 +739,10 @@ void QStyleSheetItem::setListStyle(ListStyle 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.
+/*!
+ 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()
- */
+ \sa setContexts()
+*/
QString QStyleSheetItem::contexts() const
@@ -696,8 +753,8 @@ QString QStyleSheetItem::contexts() const
/*!
- 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.
+ 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()
- */
+ \sa contexts()
+*/
void QStyleSheetItem::setContexts( const QString& c)
@@ -708,7 +765,7 @@ void QStyleSheetItem::setContexts( const QString& c)
/*!
- Returns TRUE if this style can be nested into an element
- of style \a s; otherwise returns FALSE.
+ Returns TRUE if this style can be nested into an element of style
+ \a s; otherwise returns FALSE.
- \sa contexts(), setContexts()
- */
+ \sa contexts(), setContexts()
+*/
bool QStyleSheetItem::allowedInContext( const QStyleSheetItem* s) const
@@ -722,7 +779,7 @@ bool QStyleSheetItem::allowedInContext( const QStyleSheetItem* s) const
/*!
- Returns TRUE if this style has self-nesting enabled; otherwise
- returns FALSE.
+ Returns TRUE if this style has self-nesting enabled; otherwise
+ returns FALSE.
- \sa setSelfNesting()
- */
+ \sa setSelfNesting()
+*/
bool QStyleSheetItem::selfNesting() const
@@ -733,10 +790,10 @@ bool QStyleSheetItem::selfNesting() const
/*!
- Sets the self-nesting property for this style to \a nesting.
+ 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.
+ 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()
- */
+ \sa selfNesting()
+*/
void QStyleSheetItem::setSelfNesting( bool nesting )
@@ -746,3 +803,11 @@ void QStyleSheetItem::setSelfNesting( bool nesting )
-/*! Sets the linespacing to be \a ls pixels */
+/*
+ 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.
+*/
@@ -753,3 +818,7 @@ void QStyleSheetItem::setLineSpacing( int ls )
-/*! Returns the linespacing */
+/*!
+ \obsolete
+
+ Returns the linespacing
+*/
@@ -769,220 +838,218 @@ int QStyleSheetItem::lineSpacing() const
/*!
- \class QStyleSheet qstylesheet.h
- \ingroup text
- \brief The QStyleSheet class is a collection of styles for rich text
- rendering and a generator of tags.
-
- \ingroup graphics
- \ingroup helpsystem
-
- By 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. 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 QStyleSheet 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
- \list
- \i \c{<qt>}...\c{</qt>}
- - A Qt rich text document. It understands the following attributes:
- \list
- \i title
- - The caption of the document. This attribute is easily accessible with
- QTextView::documentTitle().
- \i 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. 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
- \c{<qt type="detail">...</qt>}.
- \i bgcolor
- - The background color, for example \c bgcolor="yellow" or \c
- bgcolor="#0000FF".
- \i background
- - The background pixmap, for example \c
- background="granit.xpm". The pixmap name will be resolved by
- a QMimeSourceFactory().
- \i text
- - The default text color, for example \c text="red".
- \i link
- - The link color, for example \c link="green".
- \endlist
- \i \c{<h1>...</h1>}
- - A top-level heading.
- \i \c{<h2>...</h2>}
- - A sublevel heading.
- \i \c{<h3>...</h3>}
- - A sub-sublevel heading.
- \i \c{<p>...</p>}
- - A left-aligned paragraph. Adjust the alignment with
- the \c align attribute. Possible values are
- \c left, \c right and \c center.
- \i \c{<center>...</center>}
- - A centered paragraph.
- \i \c{<blockquote>...</blockquote>}
- - An indented paragraph that is useful for quotes.
- \i \c{<ul>...</ul>}
- - 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.
- \i \c{<ol>...</ol>}
- - 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".
- \i <tt>&lt;li&gt;</tt>...<tt>&lt;/li&gt;</tt>
- - A list item. This tag can be used only within the context of
- \c ol or \c ul.
- \i \c{<pre>...</pre>}
- - For larger chunks of code. Whitespaces in the contents are preserved.
- For small bits of code use the inline-style \c code.
- \endlist
-
- Anchors and links are done with a single tag:
- \list
- \i \c{<a>...</a>}
- - An anchor or link. The reference target is defined in the \c
- href attribute of the tag as in \c{<a
- href="target.qml">...</a>}. You can also specify an
- additional anchor within the specified target document, for
- example \c{<a href="target.qml#123">...</a>}. If \c a is
- meant to be an anchor, the reference source is given in the
- \c name attribute.
- \endlist
-
- The default character style bindings are
- \list
- \i \c{<em>...</em>}
- - Emphasized. By default this is the same as
- \c{<i>...</i>} (italic).
- \i \c{<strong>...</strong>}
- - Strong. By default this is the same as
- \c{<b>...</b>} (bold).
- \i \c{<i>...</i>}
- - Italic font style.
- \i \c{<b>...</b>}
- - Bold font style.
- \i \c{<u>...</u>}
- - Underlined font style.
- \i \c{<big>...</big>}
- - A larger font size.
- \i \c{<small>...</small>}
- - A smaller font size.
- \i \c{<code>...</code>}
- - Indicates code. By default this is the same as
- \c{<tt>...</tt>} (typewriter). For
- larger junks of code use the block-tag \c pre.
- \i \c{<tt>...</tt>}
- - Typewriter font style.
- \i \c{<font>...</font>}
- - Customizes the font size, family and text color. The tag understands
- the following attributes:
- \list
- \i color
- - The text color, for example \c color="red" or \c color="#FF0000".
- \i size
- - The logical size of the font. Logical sizes 1 to 7 are supported.
- The value may either be absolute (for example,
- \c size=3) or relative (\c size=-2). In the latter case the sizes
- are simply added.
- \i face
- - The family of the font, for example \c face=times.
- \endlist
- \endlist
-
- Special elements are:
- \list
- \i \c{<img>}
- - An image. The image name for the mime source
- factory is given in the source attribute, for example
- \c{<img src="qt.xpm">}
- The image tag also understands the attributes \c width and \c
- height that determine the size of the image. If the pixmap
- does not fit the specified size it will be scaled
- automatically (by using QImage::smoothScale()).
-
- The \c align attribute determines where the image is
- placed. By default, an image is placed inline just like a
- normal character. Specify \c left or \c right to place the
- image at the respective side.
- \i \c{<hr>}
- - A horizonal line.
- \i \c{<br>}
- - A line break.
- \endlist
-
- Another tag not in any of the above cathegories is
- \list
- \i \c{<nobr>...</nobr>}
- - No break. Prevents word wrap.
- \endlist
-
- In addition, rich text supports simple HTML tables. A table consists
- of one or more rows each of which contains one or more cells. Cells
- are either data cells or header cells, depending on their
- content. Cells which span rows and columns are supported.
-
- \list
- \i \c{<table>...</table>}
- - A table. Tables support the following attributes:
- \list
- \i bgcolor
- - The background color.
- \i width
- - The table width. This is either an absolute pixel width or a relative
- percentage of the table's width, for example \c width=80%.
- \i border
- - The width of the table border. The default is 0 (= no border).
- \i cellspacing
- - Additional space around the table cells. The default is 2.
- \i cellpadding
- - Additional space around the contents of table cells. The default is 1.
- \endlist
- \i \c{<tr>...</tr>}
- - A table row. This is only valid within a \c table. Rows support
- the following attribute:
- \list
- \i bgcolor
- - The background color.
- \endlist
- \i \c{<th>...</th>}
- - A table header cell. Similar to \c td, but defaults to center alignment
- and a bold font.
- \i \c{<td>...</td>}
- - A table data cell. This is only valid within a \c tr. Cells
- support the following attributes:
- \list
- \i bgcolor
- - The background color.
- \i width
- - The cell width. This is either an absolute pixel width or a relative
- percentage of table's width, for example \c width=50%.
- \i colspan
- - Specifies how many columns this cell spans. The default is 1.
- \i rowspan
- - Specifies how many rows this cell spans. The default is 1.
- \i align
- - Alignment; possible values are \c left, \c right, and \c center. The
- default is left.
- \endlist
- \endlist
-*/
-
-/*!
- Creates a style sheet with parent \a parent and name \a name. Like
- any QObject it will be deleted when its parent is
- destroyed (if the child still exists).
-
- By default the style sheet has the tag definitions defined above.
+ \class QStyleSheet qstylesheet.h
+ \ingroup text
+ \brief The QStyleSheet class is a collection of styles for rich text
+ rendering and a generator of tags.
+
+ \ingroup graphics
+ \ingroup helpsystem
+
+ By 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. 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 QStyleSheet 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 QTextView::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 QMimeSourceFactory().
+ \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{<code>...</code>}
+ \i Indicates code. By default this is the same as
+ \c{<tt>...</tt>} (typewriter). For larger junks of code
+ use the block-tag \c{<}\c{pre>}.
+ \row \i \c{<tt>...</tt>}
+ \i Typewriter font style.
+ \row \i \c{<font>...</font>}
+ \i Customizes the font size, family and text color. The tag
+ understands the following attributes:
+ \list
+ \i \c color -- The text color, for example \c color="red" or
+ \c color="#FF0000".
+ \i \c size -- The logical size of the font. Logical sizes 1
+ to 7 are supported. The value may either be absolute
+ (for example, \c size=3) or relative (\c size=-2). In
+ the latter case the sizes are simply added.
+ \i \c face -- The family of the font, for example \c face=times.
+ \endlist
+ \endtable
+
+ Special elements are:
+ \table
+ \header \i Special tags \i Notes
+ \row \i \c{<img>}
+ \i An image. The image name for the mime source factory is
+ given in the source attribute, for example
+ \c{<img src="qt.xpm">} The image tag also understands the
+ attributes \c width and \c height that determine the size
+ of the image. If the pixmap does not fit the specified
+ size it will be scaled automatically (by using
+ QImage::smoothScale()).
+ <br>
+ The \c align attribute determines where the image is
+ placed. By default, an image is placed inline just like a
+ normal character. Specify \c left or \c right to place the
+ image at the respective side.
+ \row \i \c{<hr>}
+ \i A horizonal line.
+ \row \i \c{<br>}
+ \i A line break.
+ \row \i \c{<nobr>...</nobr>}
+ \i No break. Prevents word wrap.
+ \endtable
+
+ In addition, rich text supports simple HTML tables. A table
+ consists of one or more rows each of which contains one or more
+ cells. Cells are either data cells or header cells, depending on
+ their content. Cells which span rows and columns are supported.
+
+ \table
+ \header \i Table tags \i Notes
+ \row \i \c{<table>...</table>}
+ \i A table. Tables support the following attributes:
+ \list
+ \i \c bgcolor -- The background color.
+ \i \c width -- The table width. This is either an absolute
+ pixel width or a relative percentage of the table's
+ width, for example \c width=80%.
+ \i \c border -- The width of the table border. The default is
+ 0 (= no border).
+ \i \c cellspacing -- Additional space around the table cells.
+ The default is 2.
+ \i \c cellpadding -- Additional space around the contents of
+ table cells. The default is 1.
+ \endlist
+ \row \i \c{<tr>...</tr>}
+ \i A table row. This is only valid within a \c table. Rows
+ support the following attribute:
+ \list
+ \i \c bgcolor -- The background color.
+ \endlist
+ \row \i \c{<th>...</th>}
+ \i A table header cell. Similar to \c td, but defaults to
+ center alignment and a bold font.
+ \row \i \c{<td>...</td>}
+ \i A table data cell. This is only valid within a \c tr.
+ Cells support the following attributes:
+ \list
+ \i \c bgcolor -- The background color.
+ \i \c width -- The cell width. This is either an absolute
+ pixel width or a relative percentage of table's width,
+ for example \c width=50%.
+ \i \c colspan -- Specifies how many columns this cell spans.
+ The default is 1.
+ \i \c rowspan -- Specifies how many rows this cell spans. The
+ default is 1.
+ \i \c align -- Alignment; possible values are \c left, \c
+ right, and \c center. The default is left.
+ \endlist
+ \endtable
+*/
+
+/*!
+ Creates a style sheet called \a name, with parent \a parent. Like
+ any QObject it will be deleted when its parent is destroyed (if
+ the child still exists).
+
+ By default the style sheet has the tag definitions defined above.
*/
@@ -995,4 +1062,4 @@ QStyleSheet::QStyleSheet( QObject *parent, const char *name )
/*!
- Destroys the style sheet. All styles inserted into the style sheet
- will be deleted.
+ Destroys the style sheet. All styles inserted into the style sheet
+ will be deleted.
*/
@@ -1020,3 +1087,2 @@ void QStyleSheet::init()
style->setDisplayMode( QStyleSheetItem::DisplayBlock );
- //style->setMargin( QStyleSheetItem::MarginAll, 4 );
@@ -1049,4 +1115,4 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginTop, 12);
- style-> setMargin(QStyleSheetItem::MarginBottom, 6);
+ style-> setMargin(QStyleSheetItem::MarginTop, 18);
+ style-> setMargin(QStyleSheetItem::MarginBottom, 12);
@@ -1056,4 +1122,4 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginTop, 10);
- style-> setMargin(QStyleSheetItem::MarginBottom, 5);
+ style-> setMargin(QStyleSheetItem::MarginTop, 16);
+ style-> setMargin(QStyleSheetItem::MarginBottom, 12);
@@ -1063,4 +1129,4 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginTop, 8);
- style-> setMargin(QStyleSheetItem::MarginBottom, 4);
+ style-> setMargin(QStyleSheetItem::MarginTop, 14);
+ style-> setMargin(QStyleSheetItem::MarginBottom, 12);
@@ -1070,4 +1136,3 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginTop, 8);
- style-> setMargin(QStyleSheetItem::MarginBottom, 4);
+ style-> setMargin(QStyleSheetItem::MarginVertical, 12);
@@ -1077,3 +1142,3 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginTop, 8);
+ style-> setMargin(QStyleSheetItem::MarginTop, 12);
style-> setMargin(QStyleSheetItem::MarginBottom, 4);
@@ -1082,3 +1147,3 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginVertical, 8);
+ style-> setMargin(QStyleSheetItem::MarginVertical, 12);
style->setSelfNesting( FALSE );
@@ -1099,3 +1164,5 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
- style-> setMargin(QStyleSheetItem::MarginVertical, 4);
+ style->setListStyle( QStyleSheetItem::ListDisc );
+ style-> setMargin(QStyleSheetItem::MarginVertical, 12);
+ style->setMargin( QStyleSheetItem::MarginLeft, 40 );
@@ -1104,3 +1171,4 @@ void QStyleSheet::init()
style->setListStyle( QStyleSheetItem::ListDecimal );
- style-> setMargin(QStyleSheetItem::MarginVertical, 4);
+ style-> setMargin(QStyleSheetItem::MarginVertical, 12);
+ style->setMargin( QStyleSheetItem::MarginLeft, 40 );
@@ -1109,4 +1177,2 @@ void QStyleSheet::init()
style->setSelfNesting( FALSE );
- style->setContexts(QString::fromLatin1("ol ul"));
- style-> setMargin(QStyleSheetItem::MarginVertical, 4);
@@ -1121,2 +1187,3 @@ void QStyleSheet::init()
new QStyleSheetItem(this, QString::fromLatin1("hr"));
+
style = new QStyleSheetItem(this, QString::fromLatin1("sub"));
@@ -1137,5 +1204,9 @@ void QStyleSheet::init()
style->setDisplayMode(QStyleSheetItem::DisplayNone);
+ style = new QStyleSheetItem( this, QString::fromLatin1("body") );
+ style->setDisplayMode(QStyleSheetItem::DisplayBlock);
style = new QStyleSheetItem( this, QString::fromLatin1("div") );
style->setDisplayMode(QStyleSheetItem::DisplayBlock) ;
+ style = new QStyleSheetItem( this, QString::fromLatin1("span") );
style = new QStyleSheetItem( this, QString::fromLatin1("dl") );
+ style-> setMargin(QStyleSheetItem::MarginVertical, 8);
style->setDisplayMode(QStyleSheetItem::DisplayBlock);
@@ -1150,6 +1221,11 @@ void QStyleSheet::init()
style->setFontUnderline( TRUE);
+ style = new QStyleSheetItem( this, QString::fromLatin1("s") );
+ style->setFontStrikeOut( TRUE);
style = new QStyleSheetItem( this, QString::fromLatin1("nobr") );
style->setWhiteSpaceMode( QStyleSheetItem::WhiteSpaceNoWrap );
- style = new QStyleSheetItem( this, QString::fromLatin1("wsp") ); // qt extension for QTextEdit
- style->setWhiteSpaceMode( (QStyleSheetItem::WhiteSpaceMode) 3 ); // WhiteSpaceModeNoCompression
+
+ // compatibily with some minor 3.0.x Qt versions that had an
+ // undocumented <wsp> tag. ### Remove 3.1
+ style = new QStyleSheetItem( this, QString::fromLatin1("wsp") );
+ style->setWhiteSpaceMode( QStyleSheetItem::WhiteSpacePre );
@@ -1175,10 +1251,10 @@ static QSingleCleanupHandler<QStyleSheet> qt_cleanup_stylesheet;
/*!
- Returns the application-wide default style sheet. This style sheet is
- used by rich text rendering classes such as QSimpleRichText,
- QWhatsThis and 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 QTextEdit and
- QTextBrowser.
-
- \sa setDefaultSheet()
+ Returns the application-wide default style sheet. This style sheet
+ is used by rich text rendering classes such as QSimpleRichText,
+ QWhatsThis and QMessageBox to define the rendering style and
+ available tags within rich text documents. It also serves as the
+ initial style sheet for the more complex render widgets, QTextEdit
+ and QTextBrowser.
+
+ \sa setDefaultSheet()
*/
@@ -1194,7 +1270,7 @@ QStyleSheet* QStyleSheet::defaultSheet()
/*!
- Sets the application-wide default style sheet to \a sheet, deleting
- any style sheet previously set. The ownership is transferred to
- QStyleSheet.
+ Sets the application-wide default style sheet to \a sheet,
+ deleting any style sheet previously set. The ownership is
+ transferred to QStyleSheet.
- \sa defaultSheet()
+ \sa defaultSheet()
*/
@@ -1213,4 +1289,4 @@ void QStyleSheet::setDefaultSheet( QStyleSheet* sheet)
/*!\internal
- Inserts \a style. Any tags generated after this time will be
- bound to this style. Note that \a style becomes owned by the
+ Inserts \a style. Any tags generated after this time will be
+ bound to this style. Note that \a style becomes owned by the
style sheet and will be deleted when the style sheet is destroyed.
@@ -1224,4 +1300,4 @@ void QStyleSheet::insert( QStyleSheetItem* style )
/*!
- Returns the style with name \a name or 0 if there is no such style.
- */
+ Returns the style called \a name or 0 if there is no such style.
+*/
QStyleSheetItem* QStyleSheet::item( const QString& name)
@@ -1235,4 +1311,6 @@ QStyleSheetItem* QStyleSheet::item( const QString& name)
\overload
- Returns the style with name \a name or 0 if there is no such style (const version)
- */
+
+ Returns the style called \a name or 0 if there is no such style
+ (const version)
+*/
const QStyleSheetItem* QStyleSheet::item( const QString& name) const
@@ -1247,17 +1325,18 @@ const QStyleSheetItem* QStyleSheet::item( const QString& name) const
\preliminary
- Generates an internal object for the tag called \a name, given the
- attributes \a attr, and using additional information provided
- by the mime source factory \a factory.
- \a context is the optional context of the document, i.e. the path to
- look for relative links. This becomes important if the text contains
- relative references, for example within image tags. QSimpleRichText
- always uses the default mime source factory (see
- \l{QMimeSourceFactory::defaultFactory()}) to resolve these references.
- The context will then be used to calculate the absolute path. See
- QMimeSourceFactory::makeAbsolute() for details.
+ Generates an internal object for the tag called \a name, given the
+ attributes \a attr, and using additional information provided by
+ the mime source factory \a factory.
- \a emptyTag and \a doc are for internal use only.
+ \a context is the optional context of the document, i.e. the path
+ to look for relative links. This becomes important if the text
+ contains relative references, for example within image tags.
+ QSimpleRichText always uses the default mime source factory (see
+ \l{QMimeSourceFactory::defaultFactory()}) to resolve these
+ references. The context will then be used to calculate the
+ absolute path. See QMimeSourceFactory::makeAbsolute() for details.
- This function should not (yet) be used in application code.
+ \a emptyTag and \a doc are for internal use only.
+
+ This function should not be used in application code.
*/
@@ -1269,5 +1348,2 @@ QTextCustomItem* QStyleSheet::tag( const QString& name,
{
- static QString s_img = QString::fromLatin1("img");
- static QString s_hr = QString::fromLatin1("hr");
-
const QStyleSheetItem* style = item( name );
@@ -1276,5 +1352,5 @@ QTextCustomItem* QStyleSheet::tag( const QString& name,
return 0;
- if ( style->name() == s_img )
+ if ( style->name() == "img" )
return new QTextImage( doc, attr, context, (QMimeSourceFactory&)factory );
- if ( style->name() == s_hr )
+ if ( style->name() == "hr" )
return new QTextHorizontalLine( doc, attr, context, (QMimeSourceFactory&)factory );
@@ -1284,13 +1360,12 @@ QTextCustomItem* QStyleSheet::tag( const QString& name,
-/*!
- Auxiliary function. Converts the plain text string \a plain to a
- rich text formatted paragraph while preserving its look.
+/*! Auxiliary function. Converts the plain text string \a plain to a
+ rich text formatted paragraph while preserving most of its look.
- \a mode defines the whitespace mode. Possible values are \c
- QStyleSheetItem::WhiteSpacePre (no wrapping, all whitespaces
- preserved) and \c QStyleSheetItem::WhiteSpaceNormal (wrapping,
- simplified whitespaces).
+ \a mode defines the whitespace mode. Possible values are \c
+ QStyleSheetItem::WhiteSpacePre (no wrapping, all whitespaces
+ preserved) and \c QStyleSheetItem::WhiteSpaceNormal (wrapping,
+ simplified whitespaces).
- \sa escape()
- */
+ \sa escape()
+*/
QString QStyleSheet::convertFromPlainText( const QString& plain, QStyleSheetItem::WhiteSpaceMode mode )
@@ -1302,28 +1377,40 @@ QString QStyleSheet::convertFromPlainText( const QString& plain, QStyleSheetItem
if ( plain[i] == '\n' ){
- if ( col == 1 )
- rich += "<p></p>";
- else
- rich += "<br>";
+ int c = 1;
+ while ( i+1 < int(plain.length()) && plain[i+1] == '\n' ) {
+ i++;
+ c++;
+ }
+ if ( c == 1)
+ rich += "<br>\n";
+ else {
+ rich += "</p>\n";
+ while ( --c > 1 )
+ rich += "<br>\n";
+ rich += "<p>";
+ }
col = 0;
- }
- else if ( mode == QStyleSheetItem::WhiteSpacePre && plain[i] == '\t' ){
- rich += 0x00a0U;
- while ( col % 4 ) {
+ } else {
+ if ( mode == QStyleSheetItem::WhiteSpacePre && plain[i] == '\t' ){
rich += 0x00a0U;
++col;
+ while ( col % 8 ) {
+ rich += 0x00a0U;
+ ++col;
+ }
}
+ else if ( mode == QStyleSheetItem::WhiteSpacePre && plain[i].isSpace() )
+ rich += 0x00a0U;
+ else if ( plain[i] == '<' )
+ rich +="&lt;";
+ else if ( plain[i] == '>' )
+ rich +="&gt;";
+ else if ( plain[i] == '&' )
+ rich +="&amp;";
+ else
+ rich += plain[i];
+ ++col;
}
- else if ( mode == QStyleSheetItem::WhiteSpacePre && plain[i].isSpace() )
- rich += 0x00a0U;
- else if ( plain[i] == '<' )
- rich +="&lt;";
- else if ( plain[i] == '>' )
- rich +="&gt;";
- else if ( plain[i] == '&' )
- rich +="&amp;";
- else
- rich += plain[i];
- ++col;
}
- rich += "</p>";
+ if ( col != 0 )
+ rich += "</p>";
return rich;
@@ -1332,7 +1419,7 @@ QString QStyleSheet::convertFromPlainText( const QString& plain, QStyleSheetItem
/*!
- Auxiliary function. Converts the plain text string \a plain to a
- rich text formatted string with any HTML meta-characters escaped.
+ Auxiliary function. Converts the plain text string \a plain to a
+ rich text formatted string with any HTML meta-characters escaped.
- \sa convertFromPlainText()
- */
+ \sa convertFromPlainText()
+*/
QString QStyleSheet::escape( const QString& plain)
@@ -1356,18 +1443,19 @@ QString QStyleSheet::escape( const QString& plain)
/*!
- \enum Qt::TextFormat
+ \enum Qt::TextFormat
- This enum is used in widgets that can display both plain text and
- rich text, e.g. QLabel. It is used for deciding whether a text
- string should be interpreted as one or the other. This is
- normally done by passing one of the enum values to a setTextFormat()
- function.
+ This enum is used in widgets that can display both plain text and
+ rich text, e.g. QLabel. It is used for deciding whether a text
+ string should be interpreted as one or the other. This is normally
+ done by passing one of the enum values to a setTextFormat()
+ function.
- \value PlainText The text string is interpreted as a plain text string.
+ \value PlainText The text string is interpreted as a plain text
+ string.
- \value RichText The text string is interpreted as a rich text string
- using the current QStyleSheet::defaultSheet().
+ \value RichText The text string is interpreted as a rich text
+ string using the current QStyleSheet::defaultSheet().
- \value AutoText The text string is interpreted as for \c RichText if
- QStyleSheet::mightBeRichText() returns TRUE, otherwise as for \c
- PlainText.
+ \value AutoText The text string is interpreted as for \c RichText
+ if QStyleSheet::mightBeRichText() returns TRUE, otherwise as
+ \c PlainText.
*/
@@ -1375,9 +1463,9 @@ QString QStyleSheet::escape( const QString& plain)
/*!
- Returns TRUE if the string \a text is likely to be rich text;
- otherwise returns FALSE.
+ Returns TRUE if the string \a text is likely to be rich text;
+ otherwise returns FALSE.
- Note: 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. Although the result may be correct for
- most common cases, there is no guarantee.
+ This 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. Although the result may be correct
+ for common cases, there is no guarantee.
*/
@@ -1415,13 +1503,14 @@ bool QStyleSheet::mightBeRichText( const QString& text)
-/*! \fn void QStyleSheet::error( const QString& msg) const
+/*!
+ \fn void QStyleSheet::error( const QString& msg) const
- This virtual function is called when an error occurs when
- processing rich text. Reimplement it if you need to catch
- error messages.
+ This virtual function is called when an error occurs when
+ processing rich text. Reimplement it if you need to catch error
+ messages.
- Errors might occur if some rich text strings contain tags that are
- not understood by the stylesheet, if some tags are nested incorrectly, or
- if tags are not closed properly.
+ Errors might occur if some rich text strings contain tags that are
+ not understood by the stylesheet, if some tags are nested
+ incorrectly, or if tags are not closed properly.
- \a msg is the error message.
+ \a msg is the error message.
*/
@@ -1433,12 +1522,11 @@ void QStyleSheet::error( const QString& ) const
/*!
- Scales the font \a font to the appropriate physical point size
- corresponding to the logical font size \a logicalSize.
+ Scales the font \a font to the appropriate physical point size
+ corresponding to the logical font size \a logicalSize.
- When calling this function, \a font has a point size corresponding to
- the logical font size 3.
+ When calling this function, \a font has a point size corresponding
+ to the logical font size 3.
- Logical font sizes range from 1 to 7, with 1 being the smallest.
+ Logical font sizes range from 1 to 7, with 1 being the smallest.
- \sa QStyleSheetItem::logicalFontSize(),
- QStyleSheetItem::logicalFontSizeStep(), QFont::setPointSize()
+ \sa QStyleSheetItem::logicalFontSize(), QStyleSheetItem::logicalFontSizeStep(), QFont::setPointSize()
*/