1QStyleSheetItem(3qt) QStyleSheetItem(3qt)
2
3
4
6 QStyleSheetItem - Encapsulation of a set of text styles
7
9 #include <qstylesheet.h>
10
11 Inherits Qt.
12
13 Public Members
14 QStyleSheetItem ( QStyleSheet * parent, const QString & name )
15 QStyleSheetItem ( const QStyleSheetItem & other )
16 ~QStyleSheetItem ()
17 QStyleSheetItem & operator= ( const QStyleSheetItem & other )
18 QString name () const
19 QStyleSheet * styleSheet ()
20 const QStyleSheet * styleSheet () const
21 enum DisplayMode { DisplayBlock, DisplayInline, DisplayListItem,
22 DisplayNone }
23 DisplayMode displayMode () const
24 void setDisplayMode ( DisplayMode m )
25 int alignment () const
26 void setAlignment ( int f )
27 enum VerticalAlignment { VAlignBaseline, VAlignSub, VAlignSuper }
28 VerticalAlignment verticalAlignment () const
29 void setVerticalAlignment ( VerticalAlignment valign )
30 int fontWeight () const
31 void setFontWeight ( int w )
32 int logicalFontSize () const
33 void setLogicalFontSize ( int s )
34 int logicalFontSizeStep () const
35 void setLogicalFontSizeStep ( int s )
36 int fontSize () const
37 void setFontSize ( int s )
38 QString fontFamily () const
39 void setFontFamily ( const QString & fam )
40 int numberOfColumns () const (obsolete)
41 void setNumberOfColumns ( int ncols ) (obsolete)
42 QColor color () const
43 void setColor ( const QColor & c )
44 bool fontItalic () const
45 void setFontItalic ( bool italic )
46 bool definesFontItalic () const
47 bool fontUnderline () const
48 void setFontUnderline ( bool underline )
49 bool definesFontUnderline () const
50 bool fontStrikeOut () const
51 void setFontStrikeOut ( bool strikeOut )
52 bool definesFontStrikeOut () const
53 bool isAnchor () const
54 void setAnchor ( bool anc )
55 enum WhiteSpaceMode { WhiteSpaceNormal, WhiteSpacePre, WhiteSpaceNoWrap
56 }
57 WhiteSpaceMode whiteSpaceMode () const
58 void setWhiteSpaceMode ( WhiteSpaceMode m )
59 enum Margin { MarginLeft, MarginRight, MarginTop, MarginBottom,
60 MarginFirstLine, MarginAll, MarginVertical, MarginHorizontal }
61 int margin ( Margin m ) const
62 void setMargin ( Margin m, int v )
63 enum ListStyle { ListDisc, ListCircle, ListSquare, ListDecimal,
64 ListLowerAlpha, ListUpperAlpha }
65 ListStyle listStyle () const
66 void setListStyle ( ListStyle s )
67 QString contexts () const
68 void setContexts ( const QString & c )
69 bool allowedInContext ( const QStyleSheetItem * s ) const
70 bool selfNesting () const
71 void setSelfNesting ( bool nesting )
72 int lineSpacing () const (obsolete)
73
75 The QStyleSheetItem class provides an encapsulation of a set of text
76 styles.
77
78 A style sheet item consists of a name and a set of attributes that
79 specifiy its font, color, etc. When used in a style sheet (see
80 styleSheet()), items define the name() of a rich text tag and the
81 display property changes associated with it.
82
83 The display mode attribute indicates whether the item is a block, an
84 inline element or a list element; see setDisplayMode(). The treatment
85 of whitespace is controlled by the white space mode; see
86 setWhiteSpaceMode(). An item's margins are set with setMargin(), In the
87 case of list items, the list style is set with setListStyle(). An item
88 may be a hypertext link anchor; see setAnchor(). Other attributes are
89 set with setAlignment(), setVerticalAlignment(), setFontFamily(),
90 setFontSize(), setFontWeight(), setFontItalic(), setFontUnderline(),
91 setFontStrikeOut and setColor().
92
93 See also Text Related Classes.
94
95 Member Type Documentation
97 This enum type defines the way adjacent elements are displayed.
98
99 QStyleSheetItem::DisplayBlock - elements are displayed as a rectangular
100 block (e.g. <p>...</p>).
101
102 QStyleSheetItem::DisplayInline - elements are displayed in a
103 horizontally flowing sequence (e.g. <em>...</em>).
104
105 QStyleSheetItem::DisplayListItem - elements are displayed in a vertical
106 sequence (e.g. <li>...</li>).
107
108 QStyleSheetItem::DisplayNone - elements are not displayed at all.
109
111 This enum type defines how the items in a list are prefixed when
112 displayed.
113
114 QStyleSheetItem::ListDisc - a filled circle (i.e. a bullet)
115
116 QStyleSheetItem::ListCircle - an unfilled circle
117
118 QStyleSheetItem::ListSquare - a filled square
119
120 QStyleSheetItem::ListDecimal - an integer in base 10: 1, 2, 3, ...
121
122 QStyleSheetItem::ListLowerAlpha - a lowercase letter: a, b, c, ...
123
124 QStyleSheetItem::ListUpperAlpha - an uppercase letter: A, B, C, ...
125
127 QStyleSheetItem::MarginLeft - left margin
128
129 QStyleSheetItem::MarginRight - right margin
130
131 QStyleSheetItem::MarginTop - top margin
132
133 QStyleSheetItem::MarginBottom - bottom margin
134
135 QStyleSheetItem::MarginAll - all margins (left, right, top and bottom)
136
137 QStyleSheetItem::MarginVertical - top and bottom margins
138
139 QStyleSheetItem::MarginHorizontal - left and right margins
140
141 QStyleSheetItem::MarginFirstLine - margin (indentation) of the first
142 line of a paragarph (in addition to the MarginLeft of the paragraph)
143
145 This enum type defines the way elements are aligned vertically. This is
146 only supported for text elements.
147
148 QStyleSheetItem::VAlignBaseline - align the baseline of the element (or
149 the bottom, if the element doesn't have a baseline) with the baseline
150 of the parent
151
152 QStyleSheetItem::VAlignSub - subscript the element
153
154 QStyleSheetItem::VAlignSuper - superscript the element
155
157 This enum defines the ways in which QStyleSheet can treat whitespace.
158
159 QStyleSheetItem::WhiteSpaceNormal - any sequence of whitespace
160 (including line-breaks) is equivalent to a single space.
161
162 QStyleSheetItem::WhiteSpacePre - whitespace must be output exactly as
163 given in the input.
164
165 QStyleSheetItem::WhiteSpaceNoWrap - multiple spaces are collapsed as
166 with WhiteSpaceNormal, but no automatic line-breaks occur. To break
167 lines manually, use the <br> tag.
168
171 )
172 Constructs a new style called name for the stylesheet parent.
173
174 All properties in QStyleSheetItem are initially in the "do not change"
175 state, except display mode, which defaults to DisplayInline.
176
178 Copy constructor. Constructs a copy of other that is not bound to any
179 style sheet.
180
182 Destroys the style. Note that QStyleSheetItem objects become owned by
183 QStyleSheet when they are created.
184
186 Returns the alignment of this style. Possible values are AlignAuto,
187 AlignLeft, AlignRight, AlignCenter or AlignJustify.
188
189 See also setAlignment() and Qt::AlignmentFlags.
190
192 Returns TRUE if this style can be nested into an element of style s;
193 otherwise returns FALSE.
194
195 See also contexts() and setContexts().
196
198 Returns the text color of this style or an invalid color if no color
199 has been set.
200
201 See also setColor() and QColor::isValid().
202
204 Returns a space-separated list of names of styles that may contain
205 elements of this style. If nothing has been set, contexts() returns an
206 empty string, which indicates that this style can be nested everywhere.
207
208 See also setContexts().
209
211 Returns TRUE if the style defines a font shape; otherwise returns
212 FALSE. A style does not define any shape until setFontItalic() is
213 called.
214
215 See also setFontItalic() and fontItalic().
216
218 Returns TRUE if the style defines a setting for the strikeOut property
219 of the font; otherwise returns FALSE. A style does not define this
220 until setFontStrikeOut() is called.
221
222 See also setFontStrikeOut() and fontStrikeOut().
223
225 Returns TRUE if the style defines a setting for the underline property
226 of the font; otherwise returns FALSE. A style does not define this
227 until setFontUnderline() is called.
228
229 See also setFontUnderline() and fontUnderline().
230
232 Returns the display mode of the style.
233
234 See also setDisplayMode().
235
237 Returns the font family setting of the style. This is either a valid
238 font family or QString::null if no family has been set.
239
240 See also setFontFamily(), QFont::family(), and QFont::setFamily().
241
243 Returns TRUE if the style sets an italic font; otherwise returns FALSE.
244
245 See also setFontItalic() and definesFontItalic().
246
248 Returns the font size setting of the style. This is either a valid
249 point size or QStyleSheetItem::Undefined.
250
251 See also setFontSize(), QFont::pointSize(), and QFont::setPointSize().
252
254 Returns TRUE if the style sets a strike out font; otherwise returns
255 FALSE.
256
257 See also setFontStrikeOut() and definesFontStrikeOut().
258
260 Returns TRUE if the style sets an underlined font; otherwise returns
261 FALSE.
262
263 See also setFontUnderline() and definesFontUnderline().
264
266 Returns the font weight setting of the style. This is either a valid
267 QFont::Weight or the value QStyleSheetItem::Undefined.
268
269 See also setFontWeight() and QFont.
270
272 Returns whether this style is an anchor.
273
274 See also setAnchor().
275
277 This function is obsolete. It is provided to keep old source working.
278 We strongly advise against using it in new code.
279
280 Returns the linespacing
281
283 Returns the list style of the style.
284
285 See also setListStyle() and ListStyle.
286
288 Returns the logical font size setting of the style. This is either a
289 valid size between 1 and 7 or QStyleSheetItem::Undefined.
290
291 See also setLogicalFontSize(), setLogicalFontSizeStep(),
292 QFont::pointSize(), and QFont::setPointSize().
293
295 Returns the logical font size step of this style.
296
297 The default is 0. Tags such as big define +1; small defines -1.
298
299 See also setLogicalFontSizeStep().
300
302 Returns the width of margin m in pixels.
303
304 The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom,
305 or MarginFirstLine.
306
307 See also setMargin() and Margin.
308
310 Returns the name of the style item.
311
313 This function is obsolete. It is provided to keep old source working.
314 We strongly advise against using it in new code.
315
316 Returns the number of columns for this style.
317
318 See also setNumberOfColumns(), displayMode(), and setDisplayMode().
319
321
322 Assignment. Assings a copy of other that is not bound to any style
323 sheet. Unbounds first from previous style sheet.
324
326 Returns TRUE if this style has self-nesting enabled; otherwise returns
327 FALSE.
328
329 See also setSelfNesting().
330
332 Sets the alignment to f. This only makes sense for styles with a
333 display mode of DisplayBlock. Possible values are AlignAuto, AlignLeft,
334 AlignRight, AlignCenter or AlignJustify.
335
336 See also alignment(), displayMode(), and Qt::AlignmentFlags.
337
339 If anc is TRUE, sets this style to be an anchor (hypertext link);
340 otherwise sets it to not be an anchor. Elements in this style link to
341 other documents or anchors.
342
343 See also isAnchor().
344
346 Sets the text color of this style to c.
347
348 See also color().
349
351 Sets a space-separated list of names of styles that may contain
352 elements of this style. If c is empty, the style can be nested
353 everywhere.
354
355 See also contexts().
356
358 Sets the display mode of the style to m.
359
360 See also displayMode().
361
363 Sets the font family setting of the style to fam.
364
365 See also fontFamily(), QFont::family(), and QFont::setFamily().
366
368 If italic is TRUE sets italic for the style; otherwise sets upright.
369
370 See also fontItalic() and definesFontItalic().
371
373 Sets the font size setting of the style to s points.
374
375 See also fontSize(), QFont::pointSize(), and QFont::setPointSize().
376
378 If strikeOut is TRUE, sets strike out for the style; otherwise sets no
379 strike out.
380
381 See also fontStrikeOut() and definesFontStrikeOut().
382
384 If underline is TRUE, sets underline for the style; otherwise sets no
385 underline.
386
387 See also fontUnderline() and definesFontUnderline().
388
390 Sets the font weight setting of the style to w. Valid values are those
391 defined by QFont::Weight.
392
393 See also QFont and fontWeight().
394
396 Sets the list style of the style to s.
397
398 This is used by nested elements that have a display mode of
399 DisplayListItem.
400
401 See also listStyle(), DisplayMode, and ListStyle.
402
404 Sets the logical font size setting of the style to s. Valid logical
405 sizes are 1 to 7.
406
407 See also logicalFontSize(), QFont::pointSize(), and
408 QFont::setPointSize().
409
411 Sets the logical font size step of this style to s.
412
413 See also logicalFontSizeStep().
414
416 Sets the width of margin m to v pixels.
417
418 The margin, m, can be MarginLeft, MarginRight, MarginTop, MarginBottom,
419 MarginFirstLine, MarginAll, MarginVertical or MarginHorizontal. The
420 value v must be >= 0.
421
422 See also margin().
423
425 This function is obsolete. It is provided to keep old source working.
426 We strongly advise against using it in new code.
427
428 Sets the number of columns for this style. Elements in the style are
429 divided into columns.
430
431 This makes sense only if the style uses a block display mode (see
432 QStyleSheetItem::DisplayMode).
433
434 See also numberOfColumns().
435
437 Sets the self-nesting property for this style to nesting.
438
439 In order to support "dirty" HTML, paragraphs <p> and list items <li>
440 are not self-nesting. This means that starting a new paragraph or list
441 item automatically closes the previous one.
442
443 See also selfNesting().
444
446 Sets the vertical alignment to valign. Possible values are
447 VAlignBaseline, VAlignSub or VAlignSuper.
448
449 The vertical alignment property is not inherited.
450
451 See also verticalAlignment().
452
454 Sets the whitespace mode to m.
455
456 See also WhiteSpaceMode.
457
459 Returns the style sheet this item is in.
460
462 This is an overloaded member function, provided for convenience. It
463 behaves essentially like the above function.
464
465 Returns the style sheet this item is in.
466
468 Returns the vertical alignment of the style. Possible values are
469 VAlignBaseline, VAlignSub or VAlignSuper.
470
471 See also setVerticalAlignment().
472
474 Returns the whitespace mode.
475
476 See also setWhiteSpaceMode() and WhiteSpaceMode.
477
478
480 http://doc.trolltech.com/qstylesheetitem.html
481 http://www.trolltech.com/faq/tech.html
482
484 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
485 license file included in the distribution for a complete license
486 statement.
487
489 Generated automatically from the source code.
490
492 If you find a bug in Qt, please report it as described in
493 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
494 help you. Thank you.
495
496 The definitive Qt documentation is provided in HTML format; it is
497 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
498 web browser. This man page is provided as a convenience for those users
499 who prefer man pages, although this format is not officially supported
500 by Trolltech.
501
502 If you find errors in this manual page, please report them to qt-
503 bugs@trolltech.com. Please include the name of the manual page
504 (qstylesheetitem.3qt) and the Qt version (3.3.8).
505
506
507
508Trolltech AS 2 February 2007 QStyleSheetItem(3qt)