QTextFormat Class Reference

QTextFormat Class Reference

#include <qtextformat.h>

Class Description

Definition at line 129 of file qtextformat.h.

+ Inheritance diagram for QTextFormat:

Public Types

enum  FormatType {
  InvalidFormat = -1, BlockFormat = 1, CharFormat = 2, ListFormat = 3,
  TableFormat = 4, FrameFormat = 5, UserFormat = 100
}
 
enum  Property {
  ObjectIndex = 0x0, CssFloat = 0x0800, LayoutDirection = 0x0801, OutlinePen = 0x810,
  BackgroundBrush = 0x820, ForegroundBrush = 0x821, BackgroundImageUrl = 0x823, BlockAlignment = 0x1010,
  BlockTopMargin = 0x1030, BlockBottomMargin = 0x1031, BlockLeftMargin = 0x1032, BlockRightMargin = 0x1033,
  TextIndent = 0x1034, TabPositions = 0x1035, BlockIndent = 0x1040, LineHeight = 0x1048,
  LineHeightType = 0x1049, BlockNonBreakableLines = 0x1050, BlockTrailingHorizontalRulerWidth = 0x1060, FirstFontProperty = 0x1FE0,
  FontCapitalization = FirstFontProperty, FontLetterSpacing = 0x1FE1, FontWordSpacing = 0x1FE2, FontStyleHint = 0x1FE3,
  FontStyleStrategy = 0x1FE4, FontKerning = 0x1FE5, FontHintingPreference = 0x1FE6, FontFamily = 0x2000,
  FontPointSize = 0x2001, FontSizeAdjustment = 0x2002, FontSizeIncrement = FontSizeAdjustment, FontWeight = 0x2003,
  FontItalic = 0x2004, FontUnderline = 0x2005, FontOverline = 0x2006, FontStrikeOut = 0x2007,
  FontFixedPitch = 0x2008, FontPixelSize = 0x2009, LastFontProperty = FontPixelSize, TextUnderlineColor = 0x2010,
  TextVerticalAlignment = 0x2021, TextOutline = 0x2022, TextUnderlineStyle = 0x2023, TextToolTip = 0x2024,
  IsAnchor = 0x2030, AnchorHref = 0x2031, AnchorName = 0x2032, ObjectType = 0x2f00,
  ListStyle = 0x3000, ListIndent = 0x3001, ListNumberPrefix = 0x3002, ListNumberSuffix = 0x3003,
  FrameBorder = 0x4000, FrameMargin = 0x4001, FramePadding = 0x4002, FrameWidth = 0x4003,
  FrameHeight = 0x4004, FrameTopMargin = 0x4005, FrameBottomMargin = 0x4006, FrameLeftMargin = 0x4007,
  FrameRightMargin = 0x4008, FrameBorderBrush = 0x4009, FrameBorderStyle = 0x4010, TableColumns = 0x4100,
  TableColumnWidthConstraints = 0x4101, TableCellSpacing = 0x4102, TableCellPadding = 0x4103, TableHeaderRowCount = 0x4104,
  TableCellRowSpan = 0x4810, TableCellColumnSpan = 0x4811, TableCellTopPadding = 0x4812, TableCellBottomPadding = 0x4813,
  TableCellLeftPadding = 0x4814, TableCellRightPadding = 0x4815, ImageName = 0x5000, ImageWidth = 0x5010,
  ImageHeight = 0x5011, FullWidthSelection = 0x06000, PageBreakPolicy = 0x7000, UserProperty = 0x100000
}
 
enum  ObjectTypes {
  NoObject, ImageObject, TableObject, TableCellObject,
  UserObject = 0x1000
}
 
enum  PageBreakFlag { PageBreak_Auto = 0, PageBreak_AlwaysBefore = 0x001, PageBreak_AlwaysAfter = 0x010 }
 

Public Member Functions

 QTextFormat ()
 
 QTextFormat (int type)
 
 QTextFormat (const QTextFormat &rhs)
 
QTextFormatoperator= (const QTextFormat &rhs)
 
 ~QTextFormat ()
 
void merge (const QTextFormat &other)
 
bool isValid () const
 
int type () const
 
int objectIndex () const
 
void setObjectIndex (int object)
 
QVariant property (int propertyId) const
 
void setProperty (int propertyId, const QVariant &value)
 
void clearProperty (int propertyId)
 
bool hasProperty (int propertyId) const
 
bool boolProperty (int propertyId) const
 
int intProperty (int propertyId) const
 
qreal doubleProperty (int propertyId) const
 
QString stringProperty (int propertyId) const
 
QColor colorProperty (int propertyId) const
 
QPen penProperty (int propertyId) const
 
QBrush brushProperty (int propertyId) const
 
QTextLength lengthProperty (int propertyId) const
 
QVector< QTextLengthlengthVectorProperty (int propertyId) const
 
void setProperty (int propertyId, const QVector< QTextLength > &lengths)
 
QMap< int, QVariantproperties () const
 
int propertyCount () const
 
void setObjectType (int type)
 
int objectType () const
 
bool isCharFormat () const
 
bool isBlockFormat () const
 
bool isListFormat () const
 
bool isFrameFormat () const
 
bool isImageFormat () const
 
bool isTableFormat () const
 
bool isTableCellFormat () const
 
QTextBlockFormat toBlockFormat () const
 
QTextCharFormat toCharFormat () const
 
QTextListFormat toListFormat () const
 
QTextTableFormat toTableFormat () const
 
QTextFrameFormat toFrameFormat () const
 
QTextImageFormat toImageFormat () const
 
QTextTableCellFormat toTableCellFormat () const
 
bool operator== (const QTextFormat &rhs) const
 
bool operator!= (const QTextFormat &rhs) const
 
 operator QVariant () const
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
Qt::LayoutDirection layoutDirection () const
 
void setBackground (const QBrush &brush)
 
QBrush background () const
 
void clearBackground ()
 
void setForeground (const QBrush &brush)
 
QBrush foreground () const
 
void clearForeground ()
 

Friends

class QTextFormatCollection
 
class QTextCharFormat
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QTextFormat &)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QTextFormat &)
 

Member Enumeration Documentation

enum FormatType
Enumerator
InvalidFormat 
BlockFormat 
CharFormat 
ListFormat 
TableFormat 
FrameFormat 
UserFormat 

Definition at line 134 of file qtextformat.h.

enum Property
Enumerator
ObjectIndex 
CssFloat 
LayoutDirection 
OutlinePen 
BackgroundBrush 
ForegroundBrush 
BackgroundImageUrl 
BlockAlignment 
BlockTopMargin 
BlockBottomMargin 
BlockLeftMargin 
BlockRightMargin 
TextIndent 
TabPositions 
BlockIndent 
LineHeight 
LineHeightType 
BlockNonBreakableLines 
BlockTrailingHorizontalRulerWidth 
FirstFontProperty 
FontCapitalization 
FontLetterSpacing 
FontWordSpacing 
FontStyleHint 
FontStyleStrategy 
FontKerning 
FontHintingPreference 
FontFamily 
FontPointSize 
FontSizeAdjustment 
FontSizeIncrement 
FontWeight 
FontItalic 
FontUnderline 
FontOverline 
FontStrikeOut 
FontFixedPitch 
FontPixelSize 
LastFontProperty 
TextUnderlineColor 
TextVerticalAlignment 
TextOutline 
TextUnderlineStyle 
TextToolTip 
IsAnchor 
AnchorHref 
AnchorName 
ObjectType 
ListStyle 
ListIndent 
ListNumberPrefix 
ListNumberSuffix 
FrameBorder 
FrameMargin 
FramePadding 
FrameWidth 
FrameHeight 
FrameTopMargin 
FrameBottomMargin 
FrameLeftMargin 
FrameRightMargin 
FrameBorderBrush 
FrameBorderStyle 
TableColumns 
TableColumnWidthConstraints 
TableCellSpacing 
TableCellPadding 
TableHeaderRowCount 
TableCellRowSpan 
TableCellColumnSpan 
TableCellTopPadding 
TableCellBottomPadding 
TableCellLeftPadding 
TableCellRightPadding 
ImageName 
ImageWidth 
ImageHeight 
FullWidthSelection 
PageBreakPolicy 
UserProperty 

Definition at line 145 of file qtextformat.h.

145  {
146  ObjectIndex = 0x0,
147 
148  // paragraph and char
149  CssFloat = 0x0800,
150  LayoutDirection = 0x0801,
151 
152  OutlinePen = 0x810,
153  BackgroundBrush = 0x820,
154  ForegroundBrush = 0x821,
155  // Internal to qtextlayout.cpp: ObjectSelectionBrush = 0x822
156  BackgroundImageUrl = 0x823,
157 
158  // paragraph
159  BlockAlignment = 0x1010,
160  BlockTopMargin = 0x1030,
161  BlockBottomMargin = 0x1031,
162  BlockLeftMargin = 0x1032,
163  BlockRightMargin = 0x1033,
164  TextIndent = 0x1034,
165  TabPositions = 0x1035,
166  BlockIndent = 0x1040,
167  LineHeight = 0x1048,
168  LineHeightType = 0x1049,
169  BlockNonBreakableLines = 0x1050,
171 
172  // character properties
173  FirstFontProperty = 0x1FE0,
175  FontLetterSpacing = 0x1FE1,
176  FontWordSpacing = 0x1FE2,
177  FontStyleHint = 0x1FE3,
178  FontStyleStrategy = 0x1FE4,
179  FontKerning = 0x1FE5,
180  FontHintingPreference = 0x1FE6,
181  FontFamily = 0x2000,
182  FontPointSize = 0x2001,
183  FontSizeAdjustment = 0x2002,
184  FontSizeIncrement = FontSizeAdjustment, // old name, compat
185  FontWeight = 0x2003,
186  FontItalic = 0x2004,
187  FontUnderline = 0x2005, // deprecated, use TextUnderlineStyle instead
188  FontOverline = 0x2006,
189  FontStrikeOut = 0x2007,
190  FontFixedPitch = 0x2008,
191  FontPixelSize = 0x2009,
193 
194  TextUnderlineColor = 0x2010,
195  TextVerticalAlignment = 0x2021,
196  TextOutline = 0x2022,
197  TextUnderlineStyle = 0x2023,
198  TextToolTip = 0x2024,
199 
200  IsAnchor = 0x2030,
201  AnchorHref = 0x2031,
202  AnchorName = 0x2032,
203  ObjectType = 0x2f00,
204 
205  // list properties
206  ListStyle = 0x3000,
207  ListIndent = 0x3001,
208  ListNumberPrefix = 0x3002,
209  ListNumberSuffix = 0x3003,
210 
211  // table and frame properties
212  FrameBorder = 0x4000,
213  FrameMargin = 0x4001,
214  FramePadding = 0x4002,
215  FrameWidth = 0x4003,
216  FrameHeight = 0x4004,
217  FrameTopMargin = 0x4005,
218  FrameBottomMargin = 0x4006,
219  FrameLeftMargin = 0x4007,
220  FrameRightMargin = 0x4008,
221  FrameBorderBrush = 0x4009,
222  FrameBorderStyle = 0x4010,
223 
224  TableColumns = 0x4100,
226  TableCellSpacing = 0x4102,
227  TableCellPadding = 0x4103,
228  TableHeaderRowCount = 0x4104,
229 
230  // table cell properties
231  TableCellRowSpan = 0x4810,
232  TableCellColumnSpan = 0x4811,
233 
234  TableCellTopPadding = 0x4812,
235  TableCellBottomPadding = 0x4813,
236  TableCellLeftPadding = 0x4814,
237  TableCellRightPadding = 0x4815,
238 
239  // image properties
240  ImageName = 0x5000,
241  ImageWidth = 0x5010,
242  ImageHeight = 0x5011,
243 
244  // internal
245  /*
246  SuppressText = 0x5012,
247  SuppressBackground = 0x513
248  */
249 
250  // selection properties
251  FullWidthSelection = 0x06000,
252 
253  // page break properties
254  PageBreakPolicy = 0x7000,
255 
256  // --
257  UserProperty = 0x100000
258  };
Enumerator
NoObject 
ImageObject 
TableObject 
TableCellObject 
UserObject 

Definition at line 260 of file qtextformat.h.

Enumerator
PageBreak_Auto 
PageBreak_AlwaysBefore 
PageBreak_AlwaysAfter 

Definition at line 269 of file qtextformat.h.

269  {
270  PageBreak_Auto = 0,
271  PageBreak_AlwaysBefore = 0x001,
272  PageBreak_AlwaysAfter = 0x010
273  // PageBreak_AlwaysInside = 0x100
274  };

Constructor & Destructor Documentation

QTextFormat ( int  type)
explicit
QTextFormat ( const QTextFormat rhs)

Member Function Documentation

QTextFormat& operator= ( const QTextFormat rhs)
void merge ( const QTextFormat other)
bool isValid ( ) const
inline

Definition at line 287 of file qtextformat.h.

287 { return type() != InvalidFormat; }
int type() const
int type ( ) const
int objectIndex ( ) const
void setObjectIndex ( int  object)
QVariant property ( int  propertyId) const
void setProperty ( int  propertyId,
const QVariant value 
)
void clearProperty ( int  propertyId)
bool hasProperty ( int  propertyId) const
bool boolProperty ( int  propertyId) const
int intProperty ( int  propertyId) const
qreal doubleProperty ( int  propertyId) const
QString stringProperty ( int  propertyId) const
QColor colorProperty ( int  propertyId) const
QPen penProperty ( int  propertyId) const
QBrush brushProperty ( int  propertyId) const
QTextLength lengthProperty ( int  propertyId) const
QVector<QTextLength> lengthVectorProperty ( int  propertyId) const
void setProperty ( int  propertyId,
const QVector< QTextLength > &  lengths 
)
QMap<int, QVariant> properties ( ) const
int propertyCount ( ) const
void setObjectType ( int  type)
inline

Definition at line 367 of file qtextformat.h.

368 { setProperty(ObjectType, atype); }
void setProperty(int propertyId, const QVariant &value)
int objectType ( ) const
inline

Definition at line 315 of file qtextformat.h.

316  { return intProperty(ObjectType); }
int intProperty(int propertyId) const
bool isCharFormat ( ) const
inline

Definition at line 318 of file qtextformat.h.

318 { return type() == CharFormat; }
int type() const
bool isBlockFormat ( ) const
inline

Definition at line 319 of file qtextformat.h.

319 { return type() == BlockFormat; }
int type() const
bool isListFormat ( ) const
inline

Definition at line 320 of file qtextformat.h.

320 { return type() == ListFormat; }
int type() const
bool isFrameFormat ( ) const
inline

Definition at line 321 of file qtextformat.h.

321 { return type() == FrameFormat; }
int type() const
bool isImageFormat ( ) const
inline

Definition at line 322 of file qtextformat.h.

bool isTableFormat ( ) const
inline

Definition at line 323 of file qtextformat.h.

bool isTableCellFormat ( ) const
inline

Definition at line 324 of file qtextformat.h.

QTextBlockFormat toBlockFormat ( ) const
QTextCharFormat toCharFormat ( ) const
QTextListFormat toListFormat ( ) const
QTextTableFormat toTableFormat ( ) const
QTextFrameFormat toFrameFormat ( ) const
QTextImageFormat toImageFormat ( ) const
QTextTableCellFormat toTableCellFormat ( ) const
bool operator== ( const QTextFormat rhs) const
bool operator!= ( const QTextFormat rhs) const
inline

Definition at line 335 of file qtextformat.h.

335 { return !operator==(rhs); }
bool operator==(const QTextFormat &rhs) const
operator QVariant ( ) const
void setLayoutDirection ( Qt::LayoutDirection  direction)
inline

Definition at line 338 of file qtextformat.h.

void setProperty(int propertyId, const QVariant &value)
Qt::LayoutDirection layoutDirection ( ) const
inline

Definition at line 340 of file qtextformat.h.

void setBackground ( const QBrush brush)
inline

Definition at line 343 of file qtextformat.h.

344  { setProperty(BackgroundBrush, brush); }
void setProperty(int propertyId, const QVariant &value)
QBrush background ( ) const
inline

Definition at line 345 of file qtextformat.h.

346  { return brushProperty(BackgroundBrush); }
QBrush brushProperty(int propertyId) const
void clearBackground ( )
inline

Definition at line 347 of file qtextformat.h.

void setForeground ( const QBrush brush)
inline

Definition at line 350 of file qtextformat.h.

351  { setProperty(ForegroundBrush, brush); }
void setProperty(int propertyId, const QVariant &value)
QBrush foreground ( ) const
inline

Definition at line 352 of file qtextformat.h.

353  { return brushProperty(ForegroundBrush); }
QBrush brushProperty(int propertyId) const
void clearForeground ( )
inline

Definition at line 354 of file qtextformat.h.

Friends And Related Function Documentation

friend class QTextFormatCollection
friend

Definition at line 361 of file qtextformat.h.

friend class QTextCharFormat
friend

Definition at line 362 of file qtextformat.h.

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream ,
const QTextFormat  
)
friend
Q_GUI_EXPORT QDataStream& operator>> ( QDataStream ,
QTextFormat  
)
friend

The documentation for this class was generated from the following file: