QTextBlockFormat Class Reference

#include <qtextformat.h>

Class Description

Definition at line 545 of file qtextformat.h.

+ Inheritance diagram for QTextBlockFormat:

Public Types

enum  LineHeightTypes {
  SingleHeight = 0, ProportionalHeight = 1, FixedHeight = 2, MinimumHeight = 3,
  LineDistanceHeight = 4
}
 
- 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

 QTextBlockFormat ()
 
bool isValid () const
 
void setAlignment (Qt::Alignment alignment)
 
Qt::Alignment alignment () const
 
void setTopMargin (qreal margin)
 
qreal topMargin () const
 
void setBottomMargin (qreal margin)
 
qreal bottomMargin () const
 
void setLeftMargin (qreal margin)
 
qreal leftMargin () const
 
void setRightMargin (qreal margin)
 
qreal rightMargin () const
 
void setTextIndent (qreal aindent)
 
qreal textIndent () const
 
void setIndent (int indent)
 
int indent () const
 
void setLineHeight (qreal height, int heightType)
 
qreal lineHeight (qreal scriptLineHeight, qreal scaling) const
 
qreal lineHeight () const
 
int lineHeightType () const
 
void setNonBreakableLines (bool b)
 
bool nonBreakableLines () const
 
void setPageBreakPolicy (PageBreakFlags flags)
 
PageBreakFlags pageBreakPolicy () const
 
void setTabPositions (const QList< QTextOption::Tab > &tabs)
 
QList< QTextOption::TabtabPositions () 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

 QTextBlockFormat (const QTextFormat &fmt)
 

Friends

class QTextFormat
 

Member Enumeration Documentation

Enumerator
SingleHeight 
ProportionalHeight 
FixedHeight 
MinimumHeight 
LineDistanceHeight 

Definition at line 548 of file qtextformat.h.

Constructor & Destructor Documentation

QTextBlockFormat ( const QTextFormat fmt)
explicitprotected

Member Function Documentation

bool isValid ( ) const
inline

Definition at line 558 of file qtextformat.h.

558 { return isBlockFormat(); }
bool isBlockFormat() const
Definition: qtextformat.h:319
void setAlignment ( Qt::Alignment  alignment)
inline

Definition at line 619 of file qtextformat.h.

620 { setProperty(BlockAlignment, int(aalignment)); }
void setProperty(int propertyId, const QVariant &value)
Qt::Alignment alignment ( ) const
inline

Definition at line 561 of file qtextformat.h.

562  { int a = intProperty(BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); }
GLubyte GLubyte GLubyte a
Definition: GLee.h:5404
int intProperty(int propertyId) const
void setTopMargin ( qreal  margin)
inline

Definition at line 564 of file qtextformat.h.

565  { setProperty(BlockTopMargin, margin); }
void setProperty(int propertyId, const QVariant &value)
qreal topMargin ( ) const
inline

Definition at line 566 of file qtextformat.h.

567  { return doubleProperty(BlockTopMargin); }
qreal doubleProperty(int propertyId) const
void setBottomMargin ( qreal  margin)
inline

Definition at line 569 of file qtextformat.h.

570  { setProperty(BlockBottomMargin, margin); }
void setProperty(int propertyId, const QVariant &value)
qreal bottomMargin ( ) const
inline

Definition at line 571 of file qtextformat.h.

572  { return doubleProperty(BlockBottomMargin); }
qreal doubleProperty(int propertyId) const
void setLeftMargin ( qreal  margin)
inline

Definition at line 574 of file qtextformat.h.

575  { setProperty(BlockLeftMargin, margin); }
void setProperty(int propertyId, const QVariant &value)
qreal leftMargin ( ) const
inline

Definition at line 576 of file qtextformat.h.

577  { return doubleProperty(BlockLeftMargin); }
qreal doubleProperty(int propertyId) const
void setRightMargin ( qreal  margin)
inline

Definition at line 579 of file qtextformat.h.

580  { setProperty(BlockRightMargin, margin); }
void setProperty(int propertyId, const QVariant &value)
qreal rightMargin ( ) const
inline

Definition at line 581 of file qtextformat.h.

582  { return doubleProperty(BlockRightMargin); }
qreal doubleProperty(int propertyId) const
void setTextIndent ( qreal  aindent)
inline

Definition at line 584 of file qtextformat.h.

585  { setProperty(TextIndent, aindent); }
void setProperty(int propertyId, const QVariant &value)
qreal textIndent ( ) const
inline

Definition at line 586 of file qtextformat.h.

587  { return doubleProperty(TextIndent); }
qreal doubleProperty(int propertyId) const
void setIndent ( int  indent)
inline

Definition at line 622 of file qtextformat.h.

623 { setProperty(BlockIndent, aindent); }
void setProperty(int propertyId, const QVariant &value)
int indent ( ) const
inline

Definition at line 590 of file qtextformat.h.

591  { return intProperty(BlockIndent); }
int intProperty(int propertyId) const
void setLineHeight ( qreal  height,
int  heightType 
)
inline

Definition at line 593 of file qtextformat.h.

void setProperty(int propertyId, const QVariant &value)
GLenum GLsizei GLsizei height
Definition: GLee.h:883
qreal lineHeight ( qreal  scriptLineHeight,
qreal  scaling = 1.0 
) const
inline

Definition at line 625 of file qtextformat.h.

626 {
627  switch(intProperty(LineHeightType)) {
628  case SingleHeight:
629  return(scriptLineHeight);
630  case ProportionalHeight:
631  return(scriptLineHeight * doubleProperty(LineHeight) / 100.0);
632  case FixedHeight:
633  return(doubleProperty(LineHeight) * scaling);
634  case MinimumHeight:
635  return(qMax(scriptLineHeight, doubleProperty(LineHeight) * scaling));
636  case LineDistanceHeight:
637  return(scriptLineHeight + doubleProperty(LineHeight) * scaling);
638  }
639  return(0);
640 }
qreal doubleProperty(int propertyId) const
int intProperty(int propertyId) const
qreal lineHeight ( ) const
inline

Definition at line 596 of file qtextformat.h.

597  { return doubleProperty(LineHeight); }
qreal doubleProperty(int propertyId) const
int lineHeightType ( ) const
inline

Definition at line 598 of file qtextformat.h.

599  { return intProperty(LineHeightType); }
int intProperty(int propertyId) const
void setNonBreakableLines ( bool  b)
inline

Definition at line 601 of file qtextformat.h.

void setProperty(int propertyId, const QVariant &value)
GLubyte GLubyte b
Definition: GLee.h:5404
bool nonBreakableLines ( ) const
inline

Definition at line 603 of file qtextformat.h.

bool boolProperty(int propertyId) const
void setPageBreakPolicy ( PageBreakFlags  flags)
inline

Definition at line 606 of file qtextformat.h.

607  { setProperty(PageBreakPolicy, int(flags)); }
void setProperty(int propertyId, const QVariant &value)
PageBreakFlags pageBreakPolicy ( ) const
inline

Definition at line 608 of file qtextformat.h.

609  { return PageBreakFlags(intProperty(PageBreakPolicy)); }
int intProperty(int propertyId) const
void setTabPositions ( const QList< QTextOption::Tab > &  tabs)
QList<QTextOption::Tab> tabPositions ( ) const

Friends And Related Function Documentation

friend class QTextFormat
friend

Definition at line 616 of file qtextformat.h.


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