QTextFrameFormat 类

QTextFrameFormat 类提供格式化信息为框架在 QTextDocument . 更多...

头: #include <QTextFrameFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承: QTextFormat
继承者:

QTextTableFormat

注意: 此类的所有函数 可重入 .

公共类型

enum BorderStyle { BorderStyle_None, BorderStyle_Dotted, BorderStyle_Dashed, BorderStyle_Solid, BorderStyle_Double, …, BorderStyle_Outset }
enum Position { InFlow, FloatLeft, FloatRight }

公共函数

QTextFrameFormat ()
qreal border () const
QBrush borderBrush () const
QTextFrameFormat::BorderStyle borderStyle () const
qreal bottomMargin () const
QTextLength height () const
bool isValid () const
qreal leftMargin () const
qreal margin () const
qreal padding () const
QTextFormat::PageBreakFlags pageBreakPolicy () const
QTextFrameFormat::Position position () const
qreal rightMargin () const
void setBorder (qreal width )
void setBorderBrush (const QBrush & brush )
void setBorderStyle (QTextFrameFormat::BorderStyle style )
void setBottomMargin (qreal margin )
void setHeight (const QTextLength & height )
void setHeight (qreal height )
void setLeftMargin (qreal margin )
void setMargin (qreal margin )
void setPadding (qreal width )
void setPageBreakPolicy (QTextFormat::PageBreakFlags policy )
void setPosition (QTextFrameFormat::Position policy )
void setRightMargin (qreal margin )
void setTopMargin (qreal margin )
void setWidth (const QTextLength & width )
void setWidth (qreal width )
qreal topMargin () const
QTextLength width () const

详细描述

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 () 和 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 () 函数。

另请参阅 QTextFrame and QTextBlockFormat .

成员类型文档编制

enum QTextFrameFormat:: BorderStyle

This enum describes different border styles for the text frame.

常量
QTextFrameFormat::BorderStyle_None 0
QTextFrameFormat::BorderStyle_Dotted 1
QTextFrameFormat::BorderStyle_Dashed 2
QTextFrameFormat::BorderStyle_Solid 3
QTextFrameFormat::BorderStyle_Double 4
QTextFrameFormat::BorderStyle_DotDash 5
QTextFrameFormat::BorderStyle_DotDotDash 6
QTextFrameFormat::BorderStyle_Groove 7
QTextFrameFormat::BorderStyle_Ridge 8
QTextFrameFormat::BorderStyle_Inset 9
QTextFrameFormat::BorderStyle_Outset 10

另请参阅 borderStyle () 和 FrameBorderStyle .

enum QTextFrameFormat:: Position

This enum describes how a frame is located relative to the surrounding text.

常量
QTextFrameFormat::InFlow 0
QTextFrameFormat::FloatLeft 1
QTextFrameFormat::FloatRight 2

另请参阅 position () 和 CssFloat .

成员函数文档编制

QTextFrameFormat:: QTextFrameFormat ()

Constructs a text frame format object with the default properties.

qreal QTextFrameFormat:: border () const

Returns the width of the border in pixels.

另请参阅 setBorder ().

QBrush QTextFrameFormat:: borderBrush () const

Returns the brush used for the frame's border.

另请参阅 setBorderBrush ().

QTextFrameFormat::BorderStyle QTextFrameFormat:: borderStyle () const

Returns the style of the frame's border.

另请参阅 setBorderStyle ().

qreal QTextFrameFormat:: bottomMargin () const

Returns the width of the frame's bottom margin in pixels.

另请参阅 setBottomMargin ().

QTextLength QTextFrameFormat:: height () const

Returns the height of the frame's border rectangle.

另请参阅 setHeight ().

bool QTextFrameFormat:: isValid () const

返回 true if the format description is valid; otherwise returns false .

qreal QTextFrameFormat:: leftMargin () const

Returns the width of the frame's left margin in pixels.

另请参阅 setLeftMargin ().

qreal QTextFrameFormat:: margin () const

Returns the width of the frame's external margin in pixels.

另请参阅 setMargin ().

qreal QTextFrameFormat:: padding () const

Returns the width of the frame's internal padding in pixels.

另请参阅 setPadding ().

QTextFormat::PageBreakFlags QTextFrameFormat:: pageBreakPolicy () const

Returns the currently set page break policy for the frame/table. The default is QTextFormat::PageBreak_Auto .

另请参阅 setPageBreakPolicy ().

QTextFrameFormat::Position QTextFrameFormat:: position () const

Returns the positioning policy for frames with this frame format.

另请参阅 setPosition ().

qreal QTextFrameFormat:: rightMargin () const

Returns the width of the frame's right margin in pixels.

另请参阅 setRightMargin ().

void QTextFrameFormat:: setBorder ( qreal width )

设置 width (in pixels) of the frame's border.

另请参阅 border ().

void QTextFrameFormat:: setBorderBrush (const QBrush & brush )

设置 brush used for the frame's border.

另请参阅 borderBrush ().

void QTextFrameFormat:: setBorderStyle ( QTextFrameFormat::BorderStyle style )

设置 style of the frame's border.

另请参阅 borderStyle ().

void QTextFrameFormat:: setBottomMargin ( qreal margin )

Sets the frame's bottom margin (以像素为单位)。

另请参阅 bottomMargin ().

void QTextFrameFormat:: setHeight (const QTextLength & height )

Sets the frame's height .

另请参阅 height ().

void QTextFrameFormat:: setHeight ( qreal height )

这是重载函数。

Sets the frame's height .

void QTextFrameFormat:: setLeftMargin ( qreal margin )

Sets the frame's left margin (以像素为单位)。

另请参阅 leftMargin ().

void QTextFrameFormat:: setMargin ( qreal margin )

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.

另请参阅 margin ().

void QTextFrameFormat:: setPadding ( qreal width )

设置 width of the frame's internal padding in pixels.

另请参阅 padding ().

void QTextFrameFormat:: setPageBreakPolicy ( QTextFormat::PageBreakFlags policy )

Sets the page break policy for the frame/table to policy .

另请参阅 pageBreakPolicy ().

void QTextFrameFormat:: setPosition ( QTextFrameFormat::Position policy )

设置 policy for positioning frames with this frame format.

另请参阅 position ().

void QTextFrameFormat:: setRightMargin ( qreal margin )

Sets the frame's right margin (以像素为单位)。

另请参阅 rightMargin ().

void QTextFrameFormat:: setTopMargin ( qreal margin )

Sets the frame's top margin (以像素为单位)。

另请参阅 topMargin ().

void QTextFrameFormat:: setWidth (const QTextLength & width )

Sets the frame's border rectangle's width .

另请参阅 width () 和 QTextLength .

void QTextFrameFormat:: setWidth ( qreal width )

这是重载函数。

Convenience method that sets the width of the frame's border rectangle's width to the specified fixed width .

qreal QTextFrameFormat:: topMargin () const

Returns the width of the frame's top margin in pixels.

另请参阅 setTopMargin ().

QTextLength QTextFrameFormat:: width () const

Returns the width of the frame's border rectangle.

另请参阅 setWidth () 和 QTextLength .