QTextFrameFormat Class
The QTextFrameFormat class provides formatting information for frames in a QTextDocument. 更多...
头文件: | #include <QTextFrameFormat> |
qmake: | QT += gui |
基类: | QTextFormat |
派生类: |
Note: All functions in this class are reentrant.
公有类型
enum | BorderStyle { BorderStyle_None, BorderStyle_Dotted, BorderStyle_Dashed, BorderStyle_Solid, ..., BorderStyle_Outset } |
enum | Position { InFlow, FloatLeft, FloatRight } |
公有函数
QTextFrameFormat() | |
qreal | border() const |
QBrush | borderBrush() const |
BorderStyle | borderStyle() const |
qreal | bottomMargin() const |
QTextLength | height() const |
bool | isValid() const |
qreal | leftMargin() const |
qreal | margin() const |
qreal | padding() const |
PageBreakFlags | pageBreakPolicy() const |
Position | position() const |
qreal | rightMargin() const |
void | setBorder(qreal width) |
void | setBorderBrush(const QBrush &brush) |
void | setBorderStyle(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(PageBreakFlags policy) |
void | setPosition(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 |
- 51 个公有函数继承自 QTextFormat
详细描述
The QTextFrameFormat class provides formatting information for frames in a QTextDocument.
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.
参见 QTextFrame and QTextBlockFormat.
成员类型
enum QTextFrameFormat::BorderStyle
This enum describes different border styles for the text frame.
Constant | Value |
---|---|
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 |
This enum was introduced or modified in Qt 4.3.
参见 borderStyle() and FrameBorderStyle.
enum QTextFrameFormat::Position
This enum describes how a frame is located relative to the surrounding text.
Constant | Value |
---|---|
QTextFrameFormat::InFlow | 0 |
QTextFrameFormat::FloatLeft | 1 |
QTextFrameFormat::FloatRight | 2 |
成员函数
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.
This function was introduced in Qt 4.3.
参见 setBorderBrush().
BorderStyle QTextFrameFormat::borderStyle() const
Returns the style of the frame's border.
This function was introduced in Qt 4.3.
参见 setBorderStyle().
qreal QTextFrameFormat::bottomMargin() const
Returns the width of the frame's bottom margin in pixels.
This function was introduced in Qt 4.3.
参见 setBottomMargin().
QTextLength QTextFrameFormat::height() const
Returns the height of the frame's border rectangle.
参见 setHeight().
bool QTextFrameFormat::isValid() const
Returns 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.
This function was introduced in Qt 4.3.
参见 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().
PageBreakFlags QTextFrameFormat::pageBreakPolicy() const
Returns the currently set page break policy for the frame/table. The default is QTextFormat::PageBreak_Auto.
This function was introduced in Qt 4.2.
参见 setPageBreakPolicy().
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.
This function was introduced in Qt 4.3.
参见 setRightMargin().
void QTextFrameFormat::setBorder(qreal width)
Sets the width (in pixels) of the frame's border.
参见 border().
void QTextFrameFormat::setBorderBrush(const QBrush &brush)
Sets the brush used for the frame's border.
This function was introduced in Qt 4.3.
参见 borderBrush().
void QTextFrameFormat::setBorderStyle(BorderStyle style)
Sets the style of the frame's border.
This function was introduced in Qt 4.3.
参见 borderStyle().
void QTextFrameFormat::setBottomMargin(qreal margin)
Sets the frame's bottom margin in pixels.
This function was introduced in Qt 4.3.
参见 bottomMargin().
void QTextFrameFormat::setHeight(const QTextLength &height)
Sets the frame's height.
参见 height().
void QTextFrameFormat::setHeight(qreal height)
This is an overloaded function.
Sets the frame's height.
void QTextFrameFormat::setLeftMargin(qreal margin)
Sets the frame's left margin in pixels.
This function was introduced in Qt 4.3.
参见 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)
Sets the width of the frame's internal padding in pixels.
参见 padding().
void QTextFrameFormat::setPageBreakPolicy(PageBreakFlags policy)
Sets the page break policy for the frame/table to policy.
This function was introduced in Qt 4.2.
参见 pageBreakPolicy().
void QTextFrameFormat::setPosition(Position policy)
Sets the policy for positioning frames with this frame format.
参见 position().
void QTextFrameFormat::setRightMargin(qreal margin)
Sets the frame's right margin in pixels.
This function was introduced in Qt 4.3.
参见 rightMargin().
void QTextFrameFormat::setTopMargin(qreal margin)
Sets the frame's top margin in pixels.
This function was introduced in Qt 4.3.
参见 topMargin().
void QTextFrameFormat::setWidth(const QTextLength &width)
Sets the frame's border rectangle's width.
参见 width() and QTextLength.
void QTextFrameFormat::setWidth(qreal width)
This is an overloaded function.
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.
This function was introduced in Qt 4.3.
参见 setTopMargin().
QTextLength QTextFrameFormat::width() const
Returns the width of the frame's border rectangle.
参见 setWidth() and QTextLength.