Qt 4.0: QTextFrameFormat Class Reference

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QTextFrameFormat Class Reference
[QtGui module]

The QTextFrameFormat class provides formatting information for frames in a QTextDocument. More...

    #include <QTextFrameFormat>

Inherits QTextFormat.

Inherited by QTextTableFormat.

- List of all members, including inherited members

### Public Types

- enum Position { InFlow, FloatLeft, FloatRight }

### Public Functions

- QTextFrameFormat ()
- qreal border () const
- QTextLength height () const
- bool isValid () const
- qreal margin () const
- qreal padding () const
- Position position () const
- void setBorder ( qreal width )
- void setHeight ( const QTextLength & height )
- void setHeight ( qreal height )
- void setMargin ( qreal margin )
- void setPadding ( qreal width )
- void setPosition ( Position policy )
- void setWidth ( const QTextLength & width )
- void setWidth ( qreal width )
- QTextLength width () const

- 46 public functions inherited from QTextFormat

## Detailed Description

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.

See also QTextFrame and QTextBlockFormat.

## Member Type Documentation

### enum QTextFrameFormat::Position

Constant | Value
--- | ---
`QTextFrameFormat::InFlow` | `0`
`QTextFrameFormat::FloatLeft` | `1`
`QTextFrameFormat::FloatRight` | `2`

## Member Function Documentation

### QTextFrameFormat::QTextFrameFormat ()

Constructs a text frame format object with the default properties.

### qreal QTextFrameFormat::border () const

Returns the width of the border in pixels.

See also setBorder().

### QTextLength QTextFrameFormat::height () const

Returns the height of the frame's border rectangle.

See also setHeight().

### bool QTextFrameFormat::isValid () const

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

### qreal QTextFrameFormat::margin () const

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

See also setMargin().

### qreal QTextFrameFormat::padding () const

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

See also setPadding().

### Position QTextFrameFormat::position () const

Returns the positioning policy for frames with this frame format.

See also setPosition().

### void QTextFrameFormat::setBorder ( qreal width )

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

See also border().

### void QTextFrameFormat::setHeight ( const QTextLength & height )

Sets the frame's height.

See also height().

### void QTextFrameFormat::setHeight ( qreal height )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the frame's height.

### void QTextFrameFormat::setMargin ( qreal margin )

Sets the frame's margin in pixels.

See also margin().

### void QTextFrameFormat::setPadding ( qreal width )

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

See also padding().

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

Sets the policy for positioning frames with this frame format.

See also position().

### void QTextFrameFormat::setWidth ( const QTextLength & width )

Sets the frame's border rectangle's width.

See also width() and QTextLength.

### void QTextFrameFormat::setWidth ( qreal width )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

### QTextLength QTextFrameFormat::width () const

Returns the width of the frame's border rectangle.

See also setWidth() and QTextLength.