![]() |
Qt 6.x
The Qt SDK
|
\reentrant More...
#include <qtextformat.h>
Public Member Functions | |
QTextFrameFormat () | |
Constructs a text frame format object with the default properties. | |
bool | isValid () const |
Returns true if the format description is valid; otherwise returns false . | |
void | setPosition (Position f) |
Sets the policy for positioning frames with this frame format. | |
Position | position () const |
Returns the positioning policy for frames with this frame format. | |
void | setBorder (qreal border) |
Sets the width (in pixels) of the frame's border. | |
qreal | border () const |
Returns the width of the border in pixels. | |
void | setBorderBrush (const QBrush &brush) |
QBrush | borderBrush () const |
void | setBorderStyle (BorderStyle style) |
BorderStyle | borderStyle () const |
void | setMargin (qreal margin) |
Sets the frame's margin in pixels. | |
qreal | margin () const |
Returns the width of the frame's external margin in pixels. | |
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 | setPadding (qreal padding) |
Sets the width of the frame's internal padding in pixels. | |
qreal | padding () const |
Returns the width of the frame's internal padding in pixels. | |
void | setWidth (qreal width) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Convenience method that sets the width of the frame's border rectangle's width to the specified fixed width. | |
void | setWidth (const QTextLength &length) |
Sets the frame's border rectangle's width. | |
QTextLength | width () const |
Returns the width of the frame's border rectangle. | |
void | setHeight (qreal height) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the frame's height. | |
void | setHeight (const QTextLength &height) |
Sets the frame's height. | |
QTextLength | height () const |
Returns the height of the frame's border rectangle. | |
void | setPageBreakPolicy (PageBreakFlags flags) |
PageBreakFlags | pageBreakPolicy () const |
![]() | |
QTextFormat () | |
Creates a new text format with an InvalidFormat . | |
QTextFormat (int type) | |
Creates a new text format of the given type. | |
QTextFormat (const QTextFormat &rhs) | |
Creates a new text format with the same attributes as the other text format. | |
QTextFormat & | operator= (const QTextFormat &rhs) |
Assigns the other text format to this text format, and returns a reference to this text format. | |
~QTextFormat () | |
Destroys this text format. | |
void | swap (QTextFormat &other) |
void | merge (const QTextFormat &other) |
Merges the other format with this format; where there are conflicts the other format takes precedence. | |
bool | isValid () const |
Returns true if the format is valid (i.e. | |
bool | isEmpty () const |
int | type () const |
Returns the type of this format. | |
int | objectIndex () const |
Returns the index of the format object, or -1 if the format object is invalid. | |
void | setObjectIndex (int object) |
Sets the format object's object index. | |
QVariant | property (int propertyId) const |
Returns the property specified by the given propertyId. | |
void | setProperty (int propertyId, const QVariant &value) |
Sets the property specified by the propertyId to the given value. | |
void | clearProperty (int propertyId) |
Clears the value of the property given by propertyId. | |
bool | hasProperty (int propertyId) const |
Returns true if the text format has a property with the given propertyId; otherwise returns false . | |
bool | boolProperty (int propertyId) const |
Returns the value of the property specified by propertyId. | |
int | intProperty (int propertyId) const |
Returns the value of the property specified by propertyId. | |
qreal | doubleProperty (int propertyId) const |
Returns the value of the property specified by propertyId. | |
QString | stringProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QString type, an empty string is returned instead. | |
QColor | colorProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QColor type, an invalid color is returned instead. | |
QPen | penProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QPen type, Qt::NoPen is returned instead. | |
QBrush | brushProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QMetaType::QBrush type, Qt::NoBrush is returned instead. | |
QTextLength | lengthProperty (int propertyId) const |
Returns the value of the property given by propertyId. | |
QList< QTextLength > | lengthVectorProperty (int propertyId) const |
Returns the value of the property given by propertyId. | |
void | setProperty (int propertyId, const QList< QTextLength > &lengths) |
Sets the value of the property given by propertyId to value. | |
QMap< int, QVariant > | properties () const |
Returns a map with all properties of this text format. | |
int | propertyCount () const |
void | setObjectType (int type) |
Sets the text format's object type to type. | |
int | objectType () const |
Returns the text format's object type. | |
bool | isCharFormat () const |
Returns true if this text format is a CharFormat ; otherwise returns false . | |
bool | isBlockFormat () const |
Returns true if this text format is a BlockFormat ; otherwise returns false . | |
bool | isListFormat () const |
Returns true if this text format is a ListFormat ; otherwise returns false . | |
bool | isFrameFormat () const |
Returns true if this text format is a FrameFormat ; otherwise returns false . | |
bool | isImageFormat () const |
Returns true if this text format is an image format; otherwise returns false . | |
bool | isTableFormat () const |
Returns true if this text format is a TableFormat ; otherwise returns false . | |
bool | isTableCellFormat () const |
QTextBlockFormat | toBlockFormat () const |
Returns this format as a block format. | |
QTextCharFormat | toCharFormat () const |
Returns this format as a character format. | |
QTextListFormat | toListFormat () const |
Returns this format as a list format. | |
QTextTableFormat | toTableFormat () const |
Returns this format as a table format. | |
QTextFrameFormat | toFrameFormat () const |
Returns this format as a frame format. | |
QTextImageFormat | toImageFormat () const |
Returns this format as an image format. | |
QTextTableCellFormat | toTableCellFormat () const |
bool | operator== (const QTextFormat &rhs) const |
Returns true if this text format is the same as the other text format. | |
bool | operator!= (const QTextFormat &rhs) const |
Returns true if this text format is different from the other text format. | |
operator QVariant () const | |
Returns the text format as a QVariant. | |
void | setLayoutDirection (Qt::LayoutDirection direction) |
Sets the document's layout direction to the specified direction. | |
Qt::LayoutDirection | layoutDirection () const |
Returns the document's layout direction. | |
void | setBackground (const QBrush &brush) |
Sets the brush use to paint the document's background to the brush specified. | |
QBrush | background () const |
Returns the brush used to paint the document's background. | |
void | clearBackground () |
Clears the brush used to paint the document's background. | |
void | setForeground (const QBrush &brush) |
Sets the foreground brush to the specified brush. | |
QBrush | foreground () const |
Returns the brush used to render foreground details, such as text, frame outlines, and table borders. | |
void | clearForeground () |
Clears the brush used to paint the document's foreground. | |
Protected Member Functions | |
QTextFrameFormat (const QTextFormat &fmt) | |
Friends | |
class | QTextFormat |
Q_GUI_EXPORT QDataStream & | operator<< (QDataStream &, const QTextFrameFormat &) |
Q_GUI_EXPORT QDataStream & | operator>> (QDataStream &, QTextFrameFormat &) |
\reentrant
The QTextFrameFormat class provides formatting information for frames in a QTextDocument. \inmodule QtGui
A text frame groups together one or more blocks of text, providing a layer of structure larger than the paragraph. The format of a frame specifies how it is rendered and positioned on the screen. It does not directly specify the behavior of the text formatting within, but provides constraints on the layout of its children.
The frame format defines the width() and height() of the frame on the screen. Each frame can have a border() that surrounds its contents with a rectangular box. The border is surrounded by a margin() around the frame, and the contents of the frame are kept separate from the border by the frame's padding(). This scheme is similar to the box model used by Cascading Style Sheets for HTML pages.
The position() of a frame is set using setPosition() and determines how it is located relative to the surrounding text.
The validity of a QTextFrameFormat object can be determined with the isValid() function.
Definition at line 832 of file qtextformat.h.
This enum describes different border styles for the text frame.
\value BorderStyle_None \value BorderStyle_Dotted \value BorderStyle_Dashed \value BorderStyle_Solid \value BorderStyle_Double \value BorderStyle_DotDash \value BorderStyle_DotDotDash \value BorderStyle_Groove \value BorderStyle_Ridge \value BorderStyle_Inset \value BorderStyle_Outset
Definition at line 847 of file qtextformat.h.
This enum describes how a frame is located relative to the surrounding text.
\value InFlow \value FloatLeft \value FloatRight
Enumerator | |
---|---|
InFlow | |
FloatLeft | |
FloatRight |
Definition at line 839 of file qtextformat.h.
QTextFrameFormat::QTextFrameFormat | ( | ) |
Constructs a text frame format object with the default properties.
Definition at line 2856 of file qtextformat.cpp.
References BorderStyle_Outset, Qt::darkGray, setBorderBrush(), and setBorderStyle().
|
explicitprotected |
Creates a new frame format with the same attributes as the given text format.
Definition at line 2869 of file qtextformat.cpp.
|
inline |
Returns the width of the border in pixels.
Definition at line 867 of file qtextformat.h.
Referenced by QQuickTextNodeEngine::addFrameDecorations(), QTextDocumentLayoutPrivate::layoutFrame(), and QTextOdfWriter::tableCellStyleElement().
|
inline |
Returns the brush used for the frame's border.
Definition at line 872 of file qtextformat.h.
Referenced by QQuickTextNodeEngine::addFrameDecorations(), and QTextOdfWriter::tableCellStyleElement().
|
inline |
Returns the style of the frame's border.
Definition at line 877 of file qtextformat.h.
Referenced by QQuickTextNodeEngine::addFrameDecorations(), and QTextOdfWriter::tableCellStyleElement().
qreal QTextFrameFormat::bottomMargin | ( | ) | const |
Returns the width of the frame's bottom margin in pixels.
Definition at line 2990 of file qtextformat.cpp.
References QTextFormat::doubleProperty(), QTextFormat::FrameBottomMargin, QTextFormat::hasProperty(), and margin().
Referenced by QQuickTextNodeEngine::addFrameDecorations(), and QTextDocumentLayoutPrivate::layoutFrame().
|
inline |
Returns the height of the frame's border rectangle.
Definition at line 908 of file qtextformat.h.
Referenced by QTextDocumentLayoutPrivate::layoutFrame().
|
inline |
Returns true
if the format description is valid; otherwise returns false
.
Definition at line 837 of file qtextformat.h.
qreal QTextFrameFormat::leftMargin | ( | ) | const |
Returns the width of the frame's left margin in pixels.
Definition at line 3010 of file qtextformat.cpp.
References QTextFormat::doubleProperty(), QTextFormat::FrameLeftMargin, QTextFormat::hasProperty(), and margin().
Referenced by QQuickTextNodeEngine::addFrameDecorations(), and QTextDocumentLayoutPrivate::layoutFrame().
|
inline |
Returns the width of the frame's external margin in pixels.
Definition at line 881 of file qtextformat.h.
Referenced by bottomMargin(), leftMargin(), rightMargin(), and topMargin().
|
inline |
Returns the width of the frame's internal padding in pixels.
Definition at line 897 of file qtextformat.h.
Referenced by QTextDocumentLayoutPrivate::layoutFrame().
|
inline |
Returns the currently set page break policy for the frame/table. The default is QTextFormat::PageBreak_Auto.
Definition at line 913 of file qtextformat.h.
Referenced by QTextDocumentLayoutPrivate::layoutFlow().
|
inline |
Returns the positioning policy for frames with this frame format.
Definition at line 863 of file qtextformat.h.
Referenced by QQuickTextNode::addTextDocument(), QTextDocumentLayoutPrivate::floatMargins(), QTextDocumentLayoutPrivate::layoutFlow(), and QQuickTextEdit::updatePaintNode().
qreal QTextFrameFormat::rightMargin | ( | ) | const |
Returns the width of the frame's right margin in pixels.
Definition at line 3030 of file qtextformat.cpp.
References QTextFormat::doubleProperty(), QTextFormat::FrameRightMargin, QTextFormat::hasProperty(), and margin().
Referenced by QQuickTextNodeEngine::addFrameDecorations(), and QTextDocumentLayoutPrivate::layoutFrame().
Sets the width (in pixels) of the frame's border.
Definition at line 925 of file qtextformat.h.
References QTextFormat::FrameBorder, and setProperty().
Referenced by QTextTableFormat::QTextTableFormat().
Sets the brush used for the frame's border.
Definition at line 870 of file qtextformat.h.
References setProperty().
Referenced by QTextFrameFormat().
|
inline |
Sets the style of the frame's border.
Definition at line 875 of file qtextformat.h.
References setProperty().
Referenced by QTextFrameFormat().
Sets the frame's bottom margin in pixels.
Definition at line 942 of file qtextformat.h.
References QTextFormat::FrameBottomMargin, and QTextFormat::setProperty().
|
inline |
Sets the frame's height.
Definition at line 936 of file qtextformat.h.
References QTextFormat::FrameHeight, and QTextFormat::setProperty().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the frame's height.
Definition at line 934 of file qtextformat.h.
References QTextLength::FixedLength, QTextFormat::FrameHeight, and QTextFormat::setProperty().
Sets the frame's left margin in pixels.
Definition at line 945 of file qtextformat.h.
References QTextFormat::FrameLeftMargin, and QTextFormat::setProperty().
Sets the frame's margin in pixels.
This method also sets the left, right, top and bottom margins of the frame to the same value. The individual margins override the general margin.
Definition at line 2941 of file qtextformat.cpp.
References QTextFormat::FrameBottomMargin, QTextFormat::FrameLeftMargin, QTextFormat::FrameMargin, QTextFormat::FrameRightMargin, QTextFormat::FrameTopMargin, and QTextFormat::setProperty().
Referenced by QTextDocumentPrivate::rootFrame(), QTextDocument::setDocumentMargin(), and QTextHtmlExporter::toHtml().
Sets the width of the frame's internal padding in pixels.
Definition at line 928 of file qtextformat.h.
References QTextFormat::FramePadding, and QTextFormat::setProperty().
|
inline |
Sets the page break policy for the frame/table to policy.
Definition at line 911 of file qtextformat.h.
References setProperty().
Sets the policy for positioning frames with this frame format.
Definition at line 861 of file qtextformat.h.
References setProperty().
Referenced by QTextCursor::insertImage().
Sets the frame's right margin in pixels.
Definition at line 948 of file qtextformat.h.
References QTextFormat::FrameRightMargin, and QTextFormat::setProperty().
Sets the frame's top margin in pixels.
Definition at line 939 of file qtextformat.h.
References QTextFormat::FrameTopMargin, and QTextFormat::setProperty().
|
inline |
Sets the frame's border rectangle's width.
Definition at line 901 of file qtextformat.h.
References setProperty().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Convenience method that sets the width of the frame's border rectangle's width to the specified fixed width.
Definition at line 931 of file qtextformat.h.
References QTextLength::FixedLength, QTextFormat::FrameWidth, and QTextFormat::setProperty().
qreal QTextFrameFormat::topMargin | ( | ) | const |
Returns the width of the frame's top margin in pixels.
Definition at line 2970 of file qtextformat.cpp.
References QTextFormat::doubleProperty(), QTextFormat::FrameTopMargin, QTextFormat::hasProperty(), and margin().
Referenced by QQuickTextNodeEngine::addFrameDecorations(), and QTextDocumentLayoutPrivate::layoutFrame().
|
inline |
Returns the width of the frame's border rectangle.
Definition at line 903 of file qtextformat.h.
Referenced by QTextDocumentLayoutPrivate::layoutFrame().
|
friend |
Definition at line 494 of file qtextformat.cpp.
|
friend |
Definition at line 499 of file qtextformat.cpp.
|
friend |
Definition at line 918 of file qtextformat.h.