QTextCharFormat Class Reference

#include <qtextformat.h>

Class Description

Definition at line 372 of file qtextformat.h.

+ Inheritance diagram for QTextCharFormat:

Public Types

enum  VerticalAlignment {
  AlignNormal = 0, AlignSuperScript, AlignSubScript, AlignMiddle,
  AlignTop, AlignBottom, AlignBaseline
}
 
enum  UnderlineStyle {
  NoUnderline, SingleUnderline, DashUnderline, DotLine,
  DashDotLine, DashDotDotLine, WaveUnderline, SpellCheckUnderline
}
 
- Public Types inherited from QTextFormat
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

 QTextCharFormat ()
 
bool isValid () const
 
void setFont (const QFont &font)
 
QFont font () const
 
void setFontFamily (const QString &family)
 
QString fontFamily () const
 
void setFontPointSize (qreal size)
 
qreal fontPointSize () const
 
void setFontWeight (int weight)
 
int fontWeight () const
 
void setFontItalic (bool italic)
 
bool fontItalic () const
 
void setFontCapitalization (QFont::Capitalization capitalization)
 
QFont::Capitalization fontCapitalization () const
 
void setFontLetterSpacing (qreal spacing)
 
qreal fontLetterSpacing () const
 
void setFontWordSpacing (qreal spacing)
 
qreal fontWordSpacing () const
 
void setFontUnderline (bool underline)
 
bool fontUnderline () const
 
void setFontOverline (bool overline)
 
bool fontOverline () const
 
void setFontStrikeOut (bool strikeOut)
 
bool fontStrikeOut () const
 
void setUnderlineColor (const QColor &color)
 
QColor underlineColor () const
 
void setFontFixedPitch (bool fixedPitch)
 
bool fontFixedPitch () const
 
void setFontStyleHint (QFont::StyleHint hint, QFont::StyleStrategy strategy=QFont::PreferDefault)
 
void setFontStyleStrategy (QFont::StyleStrategy strategy)
 
QFont::StyleHint fontStyleHint () const
 
QFont::StyleStrategy fontStyleStrategy () const
 
void setFontHintingPreference (QFont::HintingPreference hintingPreference)
 
QFont::HintingPreference fontHintingPreference () const
 
void setFontKerning (bool enable)
 
bool fontKerning () const
 
void setUnderlineStyle (UnderlineStyle style)
 
UnderlineStyle underlineStyle () const
 
void setVerticalAlignment (VerticalAlignment alignment)
 
VerticalAlignment verticalAlignment () const
 
void setTextOutline (const QPen &pen)
 
QPen textOutline () const
 
void setToolTip (const QString &tip)
 
QString toolTip () const
 
void setAnchor (bool anchor)
 
bool isAnchor () const
 
void setAnchorHref (const QString &value)
 
QString anchorHref () const
 
void setAnchorName (const QString &name)
 
QString anchorName () const
 
void setAnchorNames (const QStringList &names)
 
QStringList anchorNames () const
 
void setTableCellRowSpan (int tableCellRowSpan)
 
int tableCellRowSpan () const
 
void setTableCellColumnSpan (int tableCellColumnSpan)
 
int tableCellColumnSpan () const
 
- Public Member Functions inherited from QTextFormat
 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 ()
 

Protected Member Functions

 QTextCharFormat (const QTextFormat &fmt)
 

Friends

class QTextFormat
 

Member Enumeration Documentation

Enumerator
AlignNormal 
AlignSuperScript 
AlignSubScript 
AlignMiddle 
AlignTop 
AlignBottom 
AlignBaseline 

Definition at line 375 of file qtextformat.h.

Enumerator
NoUnderline 
SingleUnderline 
DashUnderline 
DotLine 
DashDotLine 
DashDotDotLine 
WaveUnderline 
SpellCheckUnderline 

Definition at line 384 of file qtextformat.h.

Constructor & Destructor Documentation

QTextCharFormat ( const QTextFormat fmt)
explicitprotected

Member Function Documentation

bool isValid ( ) const
inline

Definition at line 397 of file qtextformat.h.

397 { return isCharFormat(); }
bool isCharFormat() const
Definition: qtextformat.h:318
void setFont ( const QFont font)
QFont font ( ) const
void setFontFamily ( const QString family)
inline

Definition at line 401 of file qtextformat.h.

402  { setProperty(FontFamily, family); }
void setProperty(int propertyId, const QVariant &value)
QString fontFamily ( ) const
inline

Definition at line 403 of file qtextformat.h.

404  { return stringProperty(FontFamily); }
QString stringProperty(int propertyId) const
void setFontPointSize ( qreal  size)
inline

Definition at line 406 of file qtextformat.h.

void setProperty(int propertyId, const QVariant &value)
GLsizeiptr size
Definition: GLee.h:1561
qreal fontPointSize ( ) const
inline

Definition at line 408 of file qtextformat.h.

409  { return doubleProperty(FontPointSize); }
qreal doubleProperty(int propertyId) const
void setFontWeight ( int  weight)
inline

Definition at line 411 of file qtextformat.h.

412  { if (weight == QFont::Normal) weight = 0; setProperty(FontWeight, weight); }
void setProperty(int propertyId, const QVariant &value)
int fontWeight ( ) const
inline

Definition at line 413 of file qtextformat.h.

414  { int weight = intProperty(FontWeight); if (weight == 0) weight = QFont::Normal; return weight; }
int intProperty(int propertyId) const
void setFontItalic ( bool  italic)
inline

Definition at line 415 of file qtextformat.h.

416  { setProperty(FontItalic, italic); }
void setProperty(int propertyId, const QVariant &value)
bool fontItalic ( ) const
inline

Definition at line 417 of file qtextformat.h.

418  { return boolProperty(FontItalic); }
bool boolProperty(int propertyId) const
void setFontCapitalization ( QFont::Capitalization  capitalization)
inline

Definition at line 419 of file qtextformat.h.

420  { setProperty(FontCapitalization, capitalization); }
void setProperty(int propertyId, const QVariant &value)
QFont::Capitalization fontCapitalization ( ) const
inline

Definition at line 421 of file qtextformat.h.

422  { return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); }
Capitalization
Definition: qfont.h:129
int intProperty(int propertyId) const
void setFontLetterSpacing ( qreal  spacing)
inline

Definition at line 423 of file qtextformat.h.

424  { setProperty(FontLetterSpacing, spacing); }
void setProperty(int propertyId, const QVariant &value)
qreal fontLetterSpacing ( ) const
inline

Definition at line 425 of file qtextformat.h.

426  { return doubleProperty(FontLetterSpacing); }
qreal doubleProperty(int propertyId) const
void setFontWordSpacing ( qreal  spacing)
inline

Definition at line 427 of file qtextformat.h.

428  { setProperty(FontWordSpacing, spacing); }
void setProperty(int propertyId, const QVariant &value)
qreal fontWordSpacing ( ) const
inline

Definition at line 429 of file qtextformat.h.

430  { return doubleProperty(FontWordSpacing); }
qreal doubleProperty(int propertyId) const
void setFontUnderline ( bool  underline)
inline
bool fontUnderline ( ) const
void setFontOverline ( bool  overline)
inline

Definition at line 436 of file qtextformat.h.

437  { setProperty(FontOverline, overline); }
void setProperty(int propertyId, const QVariant &value)
bool fontOverline ( ) const
inline

Definition at line 438 of file qtextformat.h.

439  { return boolProperty(FontOverline); }
bool boolProperty(int propertyId) const
void setFontStrikeOut ( bool  strikeOut)
inline

Definition at line 441 of file qtextformat.h.

442  { setProperty(FontStrikeOut, strikeOut); }
void setProperty(int propertyId, const QVariant &value)
bool fontStrikeOut ( ) const
inline

Definition at line 443 of file qtextformat.h.

444  { return boolProperty(FontStrikeOut); }
bool boolProperty(int propertyId) const
void setUnderlineColor ( const QColor color)
inline

Definition at line 446 of file qtextformat.h.

447  { setProperty(TextUnderlineColor, color); }
void setProperty(int propertyId, const QVariant &value)
QColor underlineColor ( ) const
inline

Definition at line 448 of file qtextformat.h.

449  { return colorProperty(TextUnderlineColor); }
QColor colorProperty(int propertyId) const
void setFontFixedPitch ( bool  fixedPitch)
inline

Definition at line 451 of file qtextformat.h.

452  { setProperty(FontFixedPitch, fixedPitch); }
void setProperty(int propertyId, const QVariant &value)
bool fontFixedPitch ( ) const
inline

Definition at line 453 of file qtextformat.h.

454  { return boolProperty(FontFixedPitch); }
bool boolProperty(int propertyId) const
void setFontStyleHint ( QFont::StyleHint  hint,
QFont::StyleStrategy  strategy = QFont::PreferDefault 
)
inline

Definition at line 456 of file qtextformat.h.

void setProperty(int propertyId, const QVariant &value)
void setFontStyleStrategy ( QFont::StyleStrategy  strategy)
inline

Definition at line 458 of file qtextformat.h.

459  { setProperty(FontStyleStrategy, strategy); }
void setProperty(int propertyId, const QVariant &value)
QFont::StyleHint fontStyleHint ( ) const
inline

Definition at line 460 of file qtextformat.h.

461  { return static_cast<QFont::StyleHint>(intProperty(FontStyleHint)); }
StyleHint
Definition: qfont.h:69
int intProperty(int propertyId) const
QFont::StyleStrategy fontStyleStrategy ( ) const
inline

Definition at line 462 of file qtextformat.h.

463  { return static_cast<QFont::StyleStrategy>(intProperty(FontStyleStrategy)); }
StyleStrategy
Definition: qfont.h:81
int intProperty(int propertyId) const
void setFontHintingPreference ( QFont::HintingPreference  hintingPreference)
inline

Definition at line 465 of file qtextformat.h.

466  {
467  setProperty(FontHintingPreference, hintingPreference);
468  }
void setProperty(int propertyId, const QVariant &value)
QFont::HintingPreference fontHintingPreference ( ) const
inline

Definition at line 470 of file qtextformat.h.

471  {
473  }
HintingPreference
Definition: qfont.h:96
int intProperty(int propertyId) const
void setFontKerning ( bool  enable)
inline

Definition at line 475 of file qtextformat.h.

476  { setProperty(FontKerning, enable); }
void setProperty(int propertyId, const QVariant &value)
bool fontKerning ( ) const
inline

Definition at line 477 of file qtextformat.h.

478  { return boolProperty(FontKerning); }
bool boolProperty(int propertyId) const
void setUnderlineStyle ( UnderlineStyle  style)
UnderlineStyle underlineStyle ( ) const
inline

Definition at line 481 of file qtextformat.h.

482  { return static_cast<UnderlineStyle>(intProperty(TextUnderlineStyle)); }
int intProperty(int propertyId) const
void setVerticalAlignment ( VerticalAlignment  alignment)
inline

Definition at line 484 of file qtextformat.h.

485  { setProperty(TextVerticalAlignment, alignment); }
void setProperty(int propertyId, const QVariant &value)
VerticalAlignment verticalAlignment ( ) const
inline

Definition at line 486 of file qtextformat.h.

487  { return static_cast<VerticalAlignment>(intProperty(TextVerticalAlignment)); }
int intProperty(int propertyId) const
void setTextOutline ( const QPen pen)
inline

Definition at line 489 of file qtextformat.h.

490  { setProperty(TextOutline, pen); }
void setProperty(int propertyId, const QVariant &value)
QPen textOutline ( ) const
inline

Definition at line 491 of file qtextformat.h.

492  { return penProperty(TextOutline); }
QPen penProperty(int propertyId) const
void setToolTip ( const QString tip)
inline

Definition at line 494 of file qtextformat.h.

495  { setProperty(TextToolTip, tip); }
void setProperty(int propertyId, const QVariant &value)
QString toolTip ( ) const
inline

Definition at line 496 of file qtextformat.h.

497  { return stringProperty(TextToolTip); }
QString stringProperty(int propertyId) const
void setAnchor ( bool  anchor)
inline

Definition at line 499 of file qtextformat.h.

500  { setProperty(IsAnchor, anchor); }
void setProperty(int propertyId, const QVariant &value)
bool isAnchor ( ) const
inline

Definition at line 501 of file qtextformat.h.

502  { return boolProperty(IsAnchor); }
bool boolProperty(int propertyId) const
void setAnchorHref ( const QString value)
inline

Definition at line 504 of file qtextformat.h.

505  { setProperty(AnchorHref, value); }
void setProperty(int propertyId, const QVariant &value)
QString anchorHref ( ) const
inline

Definition at line 506 of file qtextformat.h.

507  { return stringProperty(AnchorHref); }
QString stringProperty(int propertyId) const
void setAnchorName ( const QString name)
inline

Definition at line 509 of file qtextformat.h.

510  { setAnchorNames(QStringList(name)); }
void setAnchorNames(const QStringList &names)
Definition: qtextformat.h:513
QString anchorName ( ) const
void setAnchorNames ( const QStringList names)
inline

Definition at line 513 of file qtextformat.h.

514  { setProperty(AnchorName, names); }
void setProperty(int propertyId, const QVariant &value)
QStringList anchorNames ( ) const
void setTableCellRowSpan ( int  tableCellRowSpan)
inline

Definition at line 529 of file qtextformat.h.

530 {
531  if (_tableCellRowSpan <= 1)
532  clearProperty(TableCellRowSpan); // the getter will return 1 here.
533  else
534  setProperty(TableCellRowSpan, _tableCellRowSpan);
535 }
void clearProperty(int propertyId)
void setProperty(int propertyId, const QVariant &value)
int tableCellRowSpan ( ) const
inline

Definition at line 518 of file qtextformat.h.

519  { int s = intProperty(TableCellRowSpan); if (s == 0) s = 1; return s; }
GLdouble s
Definition: GLee.h:1173
int intProperty(int propertyId) const
void setTableCellColumnSpan ( int  tableCellColumnSpan)
inline

Definition at line 537 of file qtextformat.h.

538 {
539  if (_tableCellColumnSpan <= 1)
540  clearProperty(TableCellColumnSpan); // the getter will return 1 here.
541  else
542  setProperty(TableCellColumnSpan, _tableCellColumnSpan);
543 }
void clearProperty(int propertyId)
void setProperty(int propertyId, const QVariant &value)
int tableCellColumnSpan ( ) const
inline

Definition at line 521 of file qtextformat.h.

522  { int s = intProperty(TableCellColumnSpan); if (s == 0) s = 1; return s; }
GLdouble s
Definition: GLee.h:1173
int intProperty(int propertyId) const

Friends And Related Function Documentation

friend class QTextFormat
friend

Definition at line 526 of file qtextformat.h.


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