- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Friends

# QTextFormat Class Reference

Search for all occurrences

## Detailed Description

Definition at line 129 of file qtextformat.h.

`#include <qtextformat.h>`

Inheritance diagram for QTextFormat:
[legend]

List of all members.

## 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, BlockNonBreakableLines = 0x1050, BlockTrailingHorizontalRulerWidth = 0x1060, FirstFontProperty = 0x1FE0, FontCapitalization = FirstFontProperty, FontLetterSpacing = 0x1FE1, FontWordSpacing = 0x1FE2, FontStyleHint = 0x1FE3, FontStyleStrategy = 0x1FE4, FontKerning = 0x1FE5, 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, 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)
QTextFormat & | operator= (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< 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)
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 QDataStream & | operator<< (QDataStream &, const QTextFormat &)
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QTextFormat &)

## Member Enumeration Documentation

enum FormatType

Search for all occurrences

Enumerator:

  InvalidFormat | Search for all occurrences
  BlockFormat | Search for all occurrences
  CharFormat | Search for all occurrences
  ListFormat | Search for all occurrences
  TableFormat | Search for all occurrences
  FrameFormat | Search for all occurrences
  UserFormat | Search for all occurrences

Definition at line 134 of file qtextformat.h.

                        {
            InvalidFormat = -1,
            BlockFormat = 1,
            CharFormat = 2,
            ListFormat = 3,
            TableFormat = 4,
            FrameFormat = 5,

            UserFormat = 100
        };

enum Property

Search for all occurrences

Enumerator:

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

Definition at line 145 of file qtextformat.h.

                      {
            ObjectIndex = 0x0,

            // paragraph and char
            CssFloat = 0x0800,
            LayoutDirection = 0x0801,

            OutlinePen = 0x810,
            BackgroundBrush = 0x820,
            ForegroundBrush = 0x821,
            // Internal to qtextlayout.cpp: ObjectSelectionBrush = 0x822
            BackgroundImageUrl = 0x823,

            // paragraph
            BlockAlignment = 0x1010,
            BlockTopMargin = 0x1030,
            BlockBottomMargin = 0x1031,
            BlockLeftMargin = 0x1032,
            BlockRightMargin = 0x1033,
            TextIndent = 0x1034,
            TabPositions = 0x1035,
            BlockIndent = 0x1040,
            BlockNonBreakableLines = 0x1050,
            BlockTrailingHorizontalRulerWidth = 0x1060,

            // character properties
            FirstFontProperty = 0x1FE0,
            FontCapitalization = FirstFontProperty,
            FontLetterSpacing = 0x1FE1,
            FontWordSpacing = 0x1FE2,
            FontStyleHint = 0x1FE3,
            FontStyleStrategy = 0x1FE4,
            FontKerning = 0x1FE5,
            FontFamily = 0x2000,
            FontPointSize = 0x2001,
            FontSizeAdjustment = 0x2002,
            FontSizeIncrement = FontSizeAdjustment, // old name, compat
            FontWeight = 0x2003,
            FontItalic = 0x2004,
            FontUnderline = 0x2005, // deprecated, use TextUnderlineStyle instead
            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,

            // list properties
            ListStyle = 0x3000,
            ListIndent = 0x3001,

            // table and frame properties
            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,

            // table cell properties
            TableCellRowSpan = 0x4810,
            TableCellColumnSpan = 0x4811,

            TableCellTopPadding = 0x4812,
            TableCellBottomPadding = 0x4813,
            TableCellLeftPadding = 0x4814,
            TableCellRightPadding = 0x4815,

            // image properties
            ImageName = 0x5000,
            ImageWidth = 0x5010,
            ImageHeight = 0x5011,

            // internal
            /*
               SuppressText = 0x5012,
               SuppressBackground = 0x513
            */

            // selection properties
            FullWidthSelection = 0x06000,

            // page break properties
            PageBreakPolicy = 0x7000,

            // --
            UserProperty = 0x100000
        };

enum ObjectTypes

Search for all occurrences

Enumerator:

  NoObject | Search for all occurrences
  ImageObject | Search for all occurrences
  TableObject | Search for all occurrences
  TableCellObject | Search for all occurrences
  UserObject | Search for all occurrences

Definition at line 255 of file qtextformat.h.

                         {
            NoObject,
            ImageObject,
            TableObject,
            TableCellObject,

            UserObject = 0x1000
        };

enum PageBreakFlag

Search for all occurrences

Enumerator:

  PageBreak_Auto | Search for all occurrences
  PageBreak_AlwaysBefore | Search for all occurrences
  PageBreak_AlwaysAfter | Search for all occurrences

Definition at line 264 of file qtextformat.h.

                           {
            PageBreak_Auto = 0,
            PageBreak_AlwaysBefore = 0x001,
            PageBreak_AlwaysAfter  = 0x010
            // PageBreak_AlwaysInside = 0x100
        };

## Constructor & Destructor Documentation

QTextFormat | ( |  | ) |

QTextFormat | ( | int | type | ) | `[explicit]`

QTextFormat | ( | const QTextFormat & | rhs | ) |

~QTextFormat | ( |  | ) |

## Member Function Documentation

QTextFormat& operator= | ( | const QTextFormat & | rhs | ) |

void merge | ( | const QTextFormat & | other | ) |

Search for all occurrences

bool isValid | ( |  | ) | const `[inline]`

Search for all occurrences

Reimplemented in QTextCharFormat, QTextBlockFormat, QTextListFormat, QTextImageFormat, QTextFrameFormat, QTextTableFormat, and QTextTableCellFormat.

Definition at line 282 of file qtextformat.h.

    { return type() != InvalidFormat; }

int type | ( |  | ) | const

Search for all occurrences

int objectIndex | ( |  | ) | const

Search for all occurrences

void setObjectIndex | ( | int | object | ) |

Search for all occurrences

QVariant property | ( | int | propertyId | ) | const

Search for all occurrences

void setProperty | ( | int | propertyId,
|  | const QVariant & | value
| ) |  |

Search for all occurrences

void clearProperty | ( | int | propertyId | ) |

Search for all occurrences

bool hasProperty | ( | int | propertyId | ) | const

Search for all occurrences

bool boolProperty | ( | int | propertyId | ) | const

Search for all occurrences

int intProperty | ( | int | propertyId | ) | const

Search for all occurrences

qreal doubleProperty | ( | int | propertyId | ) | const

Search for all occurrences

QString stringProperty | ( | int | propertyId | ) | const

Search for all occurrences

QColor colorProperty | ( | int | propertyId | ) | const

Search for all occurrences

QPen penProperty | ( | int | propertyId | ) | const

Search for all occurrences

QBrush brushProperty | ( | int | propertyId | ) | const

Search for all occurrences

QTextLength lengthProperty | ( | int | propertyId | ) | const

Search for all occurrences

QVector<QTextLength> lengthVectorProperty | ( | int | propertyId | ) | const

Search for all occurrences

void setProperty | ( | int | propertyId,
|  | const QVector< QTextLength > & | lengths
| ) |  |

Search for all occurrences

QMap<int, QVariant> properties | ( |  | ) | const

Search for all occurrences

int propertyCount | ( |  | ) | const

Search for all occurrences

void setObjectType | ( | int | type | ) | `[inline]`

Search for all occurrences

Definition at line 362 of file qtextformat.h.

    { setProperty(ObjectType, atype); }

int objectType | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 310 of file qtextformat.h.

        { return intProperty(ObjectType); }

bool isCharFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 313 of file qtextformat.h.

    { return type() == CharFormat; }

bool isBlockFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 314 of file qtextformat.h.

    { return type() == BlockFormat; }

bool isListFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 315 of file qtextformat.h.

    { return type() == ListFormat; }

bool isFrameFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 316 of file qtextformat.h.

    { return type() == FrameFormat; }

bool isImageFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 317 of file qtextformat.h.

    { return type() == CharFormat && objectType() == ImageObject; }

bool isTableFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 318 of file qtextformat.h.

    { return type() == FrameFormat && objectType() == TableObject; }

bool isTableCellFormat | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 319 of file qtextformat.h.

    { return type() == CharFormat && objectType() == TableCellObject; }

QTextBlockFormat toBlockFormat | ( |  | ) | const

Search for all occurrences

QTextCharFormat toCharFormat | ( |  | ) | const

Search for all occurrences

QTextListFormat toListFormat | ( |  | ) | const

Search for all occurrences

QTextTableFormat toTableFormat | ( |  | ) | const

Search for all occurrences

QTextFrameFormat toFrameFormat | ( |  | ) | const

Search for all occurrences

QTextImageFormat toImageFormat | ( |  | ) | const

Search for all occurrences

QTextTableCellFormat toTableCellFormat | ( |  | ) | const

Search for all occurrences

bool operator== | ( | const QTextFormat & | rhs | ) | const

bool operator!= | ( | const QTextFormat & | rhs | ) | const `[inline]`

Definition at line 330 of file qtextformat.h.

    { return !operator==(rhs); }

operator QVariant | ( |  | ) | const

void setLayoutDirection | ( | Qt::LayoutDirection | direction | ) | `[inline]`

Search for all occurrences

Definition at line 333 of file qtextformat.h.

            { setProperty(QTextFormat::LayoutDirection, direction); }

Qt::LayoutDirection layoutDirection | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 335 of file qtextformat.h.

            { return Qt::LayoutDirection(intProperty(QTextFormat::LayoutDirection)); }

void setBackground | ( | const QBrush & | brush | ) | `[inline]`

Search for all occurrences

Definition at line 338 of file qtextformat.h.

        { setProperty(BackgroundBrush, brush); }

QBrush background | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 340 of file qtextformat.h.

        { return brushProperty(BackgroundBrush); }

void clearBackground | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 342 of file qtextformat.h.

        { clearProperty(BackgroundBrush); }

void setForeground | ( | const QBrush & | brush | ) | `[inline]`

Search for all occurrences

Definition at line 345 of file qtextformat.h.

        { setProperty(ForegroundBrush, brush); }

QBrush foreground | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 347 of file qtextformat.h.

        { return brushProperty(ForegroundBrush); }

void clearForeground | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 349 of file qtextformat.h.

        { clearProperty(ForegroundBrush); }

## Friends And Related Function Documentation

friend class QTextFormatCollection `[friend]`

Search for all occurrences

Definition at line 356 of file qtextformat.h.

friend class QTextCharFormat `[friend]`

Search for all occurrences

Definition at line 357 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:

- QtGui/qtextformat.h

QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat
QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat QTextFormat