#[repr(C)]
pub struct QTextBlockFormat { /* private fields */ }
Expand description

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

C++ class: QTextBlockFormat.

C++ documentation:

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with setAlignment(). Margins are controlled by setTopMargin(), setBottomMargin(), setLeftMargin(), setRightMargin(). Overall indentation is set with setIndent(), the indentation of the first line with setTextIndent().

Line spacing is set with setLineHeight() and retrieved via lineHeight() and lineHeightType(). The types of line spacing available are in the LineHeightTypes enum.

Line breaking can be enabled and disabled with setNonBreakableLines().

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the OutlinePen, ForegroundBrush, and BackgroundBrush QTextFormat::Property values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

Implementations§

source§

impl QTextBlockFormat

source

pub unsafe fn alignment(&self) -> QFlags<AlignmentFlag>

Returns the paragraph's alignment.

Calls C++ function: QFlags<Qt::AlignmentFlag> QTextBlockFormat::alignment() const.

C++ documentation:

Returns the paragraph’s alignment.

See also setAlignment().

source

pub unsafe fn bottom_margin(&self) -> c_double

Returns the paragraph's bottom margin.

Calls C++ function: double QTextBlockFormat::bottomMargin() const.

C++ documentation:

Returns the paragraph’s bottom margin.

See also setBottomMargin() and topMargin().

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QTextBlockFormat>> ) -> Ref<QTextBlockFormat>

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

Calls C++ function: QTextBlockFormat& QTextBlockFormat::operator=(const QTextBlockFormat& other).

C++ documentation:

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with setAlignment(). Margins are controlled by setTopMargin(), setBottomMargin(), setLeftMargin(), setRightMargin(). Overall indentation is set with setIndent(), the indentation of the first line with setTextIndent().

Line spacing is set with setLineHeight() and retrieved via lineHeight() and lineHeightType(). The types of line spacing available are in the LineHeightTypes enum.

Line breaking can be enabled and disabled with setNonBreakableLines().

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the OutlinePen, ForegroundBrush, and BackgroundBrush QTextFormat::Property values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

source

pub unsafe fn heading_level(&self) -> c_int

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Returns the paragraph's heading level if it is a heading, or 0 if not.

Calls C++ function: int QTextBlockFormat::headingLevel() const.

C++ documentation:

Returns the paragraph’s heading level if it is a heading, or 0 if not.

This function was introduced in Qt 5.12.

See also setHeadingLevel().

source

pub unsafe fn indent(&self) -> c_int

Returns the paragraph's indent.

Calls C++ function: int QTextBlockFormat::indent() const.

C++ documentation:

Returns the paragraph’s indent.

See also setIndent().

source

pub unsafe fn is_valid(&self) -> bool

Returns true if this block format is valid; otherwise returns false.

Calls C++ function: bool QTextBlockFormat::isValid() const.

C++ documentation:

Returns true if this block format is valid; otherwise returns false.

source

pub unsafe fn left_margin(&self) -> c_double

Returns the paragraph's left margin.

Calls C++ function: double QTextBlockFormat::leftMargin() const.

C++ documentation:

Returns the paragraph’s left margin.

See also setLeftMargin(), rightMargin(), and indent().

source

pub unsafe fn line_height_2a( &self, script_line_height: c_double, scaling: c_double ) -> c_double

Returns the height of the lines in the paragraph based on the height of the script line given by scriptLineHeight and the specified scaling factor.

Calls C++ function: double QTextBlockFormat::lineHeight(double scriptLineHeight, double scaling) const.

C++ documentation:

Returns the height of the lines in the paragraph based on the height of the script line given by scriptLineHeight and the specified scaling factor.

The value that is returned is also dependent on the given LineHeightType of the paragraph as well as the LineHeight setting that has been set for the paragraph.

The scaling is needed for heights that include a fixed number of pixels, to scale them appropriately for printing.

This function was introduced in Qt 4.8.

See also LineHeightTypes, setLineHeight(), and lineHeightType().

source

pub unsafe fn line_height_0a(&self) -> c_double

This returns the LineHeight property for the paragraph.

Calls C++ function: double QTextBlockFormat::lineHeight() const.

C++ documentation:

This returns the LineHeight property for the paragraph.

This function was introduced in Qt 4.8.

See also LineHeightTypes, setLineHeight(), and lineHeightType().

source

pub unsafe fn line_height_type(&self) -> c_int

This returns the LineHeightType property of the paragraph.

Calls C++ function: int QTextBlockFormat::lineHeightType() const.

C++ documentation:

This returns the LineHeightType property of the paragraph.

This function was introduced in Qt 4.8.

See also LineHeightTypes, setLineHeight(), and lineHeight().

source

pub unsafe fn marker(&self) -> MarkerType

Available on cpp_lib_version="5.14.0" only.

Returns the paragraph's marker if one has been set, or NoMarker if not.

Calls C++ function: QTextBlockFormat::MarkerType QTextBlockFormat::marker() const.

C++ documentation:

Returns the paragraph’s marker if one has been set, or NoMarker if not.

This function was introduced in Qt 5.14.

See also setMarker().

source

pub unsafe fn new() -> CppBox<QTextBlockFormat>

Constructs a new QTextBlockFormat.

Calls C++ function: [constructor] void QTextBlockFormat::QTextBlockFormat().

C++ documentation:

Constructs a new QTextBlockFormat.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QTextBlockFormat>> ) -> CppBox<QTextBlockFormat>

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

Calls C++ function: [constructor] void QTextBlockFormat::QTextBlockFormat(const QTextBlockFormat& other).

C++ documentation:

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with setAlignment(). Margins are controlled by setTopMargin(), setBottomMargin(), setLeftMargin(), setRightMargin(). Overall indentation is set with setIndent(), the indentation of the first line with setTextIndent().

Line spacing is set with setLineHeight() and retrieved via lineHeight() and lineHeightType(). The types of line spacing available are in the LineHeightTypes enum.

Line breaking can be enabled and disabled with setNonBreakableLines().

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the OutlinePen, ForegroundBrush, and BackgroundBrush QTextFormat::Property values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

source

pub unsafe fn non_breakable_lines(&self) -> bool

Returns true if the lines in the paragraph are non-breakable; otherwise returns false.

Calls C++ function: bool QTextBlockFormat::nonBreakableLines() const.

C++ documentation:

Returns true if the lines in the paragraph are non-breakable; otherwise returns false.

See also setNonBreakableLines().

source

pub unsafe fn page_break_policy(&self) -> QFlags<PageBreakFlag>

Returns the currently set page break policy for the paragraph. The default is QTextFormat::PageBreak_Auto.

Calls C++ function: QFlags<QTextFormat::PageBreakFlag> QTextBlockFormat::pageBreakPolicy() const.

C++ documentation:

Returns the currently set page break policy for the paragraph. The default is QTextFormat::PageBreak_Auto.

This function was introduced in Qt 4.2.

See also setPageBreakPolicy().

source

pub unsafe fn right_margin(&self) -> c_double

Returns the paragraph's right margin.

Calls C++ function: double QTextBlockFormat::rightMargin() const.

C++ documentation:

Returns the paragraph’s right margin.

See also setRightMargin() and leftMargin().

source

pub unsafe fn set_alignment(&self, alignment: QFlags<AlignmentFlag>)

Sets the paragraph's alignment.

Calls C++ function: void QTextBlockFormat::setAlignment(QFlags<Qt::AlignmentFlag> alignment).

C++ documentation:

Sets the paragraph’s alignment.

See also alignment().

source

pub unsafe fn set_bottom_margin(&self, margin: c_double)

Sets the paragraph's bottom margin.

Calls C++ function: void QTextBlockFormat::setBottomMargin(double margin).

C++ documentation:

Sets the paragraph’s bottom margin.

See also bottomMargin(), setTopMargin(), setLeftMargin(), and setRightMargin().

source

pub unsafe fn set_heading_level(&self, alevel: c_int)

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Sets the paragraph's heading level, where 1 is the highest-level heading type (usually with the largest possible heading font size), and increasing values are progressively deeper into the document (and usually with smaller font sizes). For example when reading an HTML H1 tag, the heading level is set to 1. Setting the heading level does not automatically change the font size; however QTextDocumentFragment::fromHtml() sets both the heading level and the font size simultaneously.

Calls C++ function: void QTextBlockFormat::setHeadingLevel(int alevel).

C++ documentation:

Sets the paragraph’s heading level, where 1 is the highest-level heading type (usually with the largest possible heading font size), and increasing values are progressively deeper into the document (and usually with smaller font sizes). For example when reading an HTML H1 tag, the heading level is set to 1. Setting the heading level does not automatically change the font size; however QTextDocumentFragment::fromHtml() sets both the heading level and the font size simultaneously.

If the paragraph is not a heading, the level should be set to 0 (the default).

This function was introduced in Qt 5.12.

See also headingLevel().

source

pub unsafe fn set_indent(&self, indent: c_int)

Sets the paragraph's indentation. Margins are set independently of indentation with setLeftMargin() and setTextIndent(). The indentation is an integer that is multiplied with the document-wide standard indent, resulting in the actual indent of the paragraph.

Calls C++ function: void QTextBlockFormat::setIndent(int indent).

C++ documentation:

Sets the paragraph’s indentation. Margins are set independently of indentation with setLeftMargin() and setTextIndent(). The indentation is an integer that is multiplied with the document-wide standard indent, resulting in the actual indent of the paragraph.

See also indent() and QTextDocument::indentWidth().

source

pub unsafe fn set_left_margin(&self, margin: c_double)

Sets the paragraph's left margin. Indentation can be applied separately with setIndent().

Calls C++ function: void QTextBlockFormat::setLeftMargin(double margin).

C++ documentation:

Sets the paragraph’s left margin. Indentation can be applied separately with setIndent().

See also leftMargin(), setRightMargin(), setTopMargin(), and setBottomMargin().

source

pub unsafe fn set_line_height(&self, height: c_double, height_type: c_int)

Sets the line height for the paragraph to the value given by height which is dependent on heightType in the way described by the LineHeightTypes enum.

Calls C++ function: void QTextBlockFormat::setLineHeight(double height, int heightType).

C++ documentation:

Sets the line height for the paragraph to the value given by height which is dependent on heightType in the way described by the LineHeightTypes enum.

This function was introduced in Qt 4.8.

See also LineHeightTypes, lineHeight(), and lineHeightType().

source

pub unsafe fn set_marker(&self, marker: MarkerType)

Available on cpp_lib_version="5.14.0" only.

Sets the type of adornment that should be rendered alongside the paragraph to marker. For example, a list item can be adorned with a checkbox, either checked or unchecked, as a replacement for its bullet. The default is NoMarker.

Calls C++ function: void QTextBlockFormat::setMarker(QTextBlockFormat::MarkerType marker).

C++ documentation:

Sets the type of adornment that should be rendered alongside the paragraph to marker. For example, a list item can be adorned with a checkbox, either checked or unchecked, as a replacement for its bullet. The default is NoMarker.

This function was introduced in Qt 5.14.

See also marker().

source

pub unsafe fn set_non_breakable_lines(&self, b: bool)

If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.

Calls C++ function: void QTextBlockFormat::setNonBreakableLines(bool b).

C++ documentation:

If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable.

See also nonBreakableLines().

source

pub unsafe fn set_page_break_policy(&self, flags: QFlags<PageBreakFlag>)

Sets the page break policy for the paragraph to policy.

Calls C++ function: void QTextBlockFormat::setPageBreakPolicy(QFlags<QTextFormat::PageBreakFlag> flags).

C++ documentation:

Sets the page break policy for the paragraph to policy.

This function was introduced in Qt 4.2.

See also pageBreakPolicy().

source

pub unsafe fn set_right_margin(&self, margin: c_double)

Sets the paragraph's right margin.

Calls C++ function: void QTextBlockFormat::setRightMargin(double margin).

C++ documentation:

Sets the paragraph’s right margin.

See also rightMargin(), setLeftMargin(), setTopMargin(), and setBottomMargin().

source

pub unsafe fn set_tab_positions(&self, tabs: impl CastInto<Ref<QListOfTab>>)

Sets the tab positions for the text block to those specified by tabs.

Calls C++ function: void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab>& tabs).

C++ documentation:

Sets the tab positions for the text block to those specified by tabs.

This function was introduced in Qt 4.4.

See also tabPositions().

source

pub unsafe fn set_text_indent(&self, aindent: c_double)

Sets the indent for the first line in the block. This allows the first line of a paragraph to be indented differently to the other lines, enhancing the readability of the text.

Calls C++ function: void QTextBlockFormat::setTextIndent(double aindent).

C++ documentation:

Sets the indent for the first line in the block. This allows the first line of a paragraph to be indented differently to the other lines, enhancing the readability of the text.

See also textIndent(), setLeftMargin(), setRightMargin(), setTopMargin(), and setBottomMargin().

source

pub unsafe fn set_top_margin(&self, margin: c_double)

Sets the paragraph's top margin.

Calls C++ function: void QTextBlockFormat::setTopMargin(double margin).

C++ documentation:

Sets the paragraph’s top margin.

See also topMargin(), setBottomMargin(), setLeftMargin(), and setRightMargin().

source

pub unsafe fn tab_positions(&self) -> CppBox<QListOfTab>

Returns a list of tab positions defined for the text block.

Calls C++ function: QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const.

C++ documentation:

Returns a list of tab positions defined for the text block.

This function was introduced in Qt 4.4.

See also setTabPositions().

source

pub unsafe fn text_indent(&self) -> c_double

Returns the paragraph's text indent.

Calls C++ function: double QTextBlockFormat::textIndent() const.

C++ documentation:

Returns the paragraph’s text indent.

See also setTextIndent().

source

pub unsafe fn top_margin(&self) -> c_double

Returns the paragraph's top margin.

Calls C++ function: double QTextBlockFormat::topMargin() const.

C++ documentation:

Returns the paragraph’s top margin.

See also setTopMargin() and bottomMargin().

Methods from Deref<Target = QTextFormat>§

source

pub unsafe fn background(&self) -> CppBox<QBrush>

Returns the brush used to paint the document's background.

Calls C++ function: QBrush QTextFormat::background() const.

C++ documentation:

Returns the brush used to paint the document’s background.

See also setBackground(), clearBackground(), and foreground().

source

pub unsafe fn bool_property(&self, property_id: c_int) -> bool

Returns the value of the property specified by propertyId. If the property isn't of QTextFormat::Bool type, false is returned instead.

Calls C++ function: bool QTextFormat::boolProperty(int propertyId) const.

C++ documentation:

Returns the value of the property specified by propertyId. If the property isn’t of QTextFormat::Bool type, false is returned instead.

See also setProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn brush_property(&self, property_id: c_int) -> CppBox<QBrush>

Returns the value of the property given by propertyId; if the property isn't of QVariant::Brush type, Qt::NoBrush is returned instead.

Calls C++ function: QBrush QTextFormat::brushProperty(int propertyId) const.

C++ documentation:

Returns the value of the property given by propertyId; if the property isn’t of QVariant::Brush type, Qt::NoBrush is returned instead.

See also setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn clear_background(&self)

Clears the brush used to paint the document's background. The default brush will be used.

Calls C++ function: void QTextFormat::clearBackground().

C++ documentation:

Clears the brush used to paint the document’s background. The default brush will be used.

See also background(), setBackground(), and clearForeground().

source

pub unsafe fn clear_foreground(&self)

Clears the brush used to paint the document's foreground. The default brush will be used.

Calls C++ function: void QTextFormat::clearForeground().

C++ documentation:

Clears the brush used to paint the document’s foreground. The default brush will be used.

See also foreground(), setForeground(), and clearBackground().

source

pub unsafe fn clear_property(&self, property_id: c_int)

Clears the value of the property given by propertyId

Calls C++ function: void QTextFormat::clearProperty(int propertyId).

C++ documentation:

Clears the value of the property given by propertyId

See also Property.

source

pub unsafe fn color_property(&self, property_id: c_int) -> CppBox<QColor>

Returns the value of the property given by propertyId; if the property isn't of QVariant::Color type, an invalid color is returned instead.

Calls C++ function: QColor QTextFormat::colorProperty(int propertyId) const.

C++ documentation:

Returns the value of the property given by propertyId; if the property isn’t of QVariant::Color type, an invalid color is returned instead.

See also setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn copy_from( &self, rhs: impl CastInto<Ref<QTextFormat>> ) -> Ref<QTextFormat>

Assigns the other text format to this text format, and returns a reference to this text format.

Calls C++ function: QTextFormat& QTextFormat::operator=(const QTextFormat& rhs).

C++ documentation:

Assigns the other text format to this text format, and returns a reference to this text format.

source

pub unsafe fn double_property(&self, property_id: c_int) -> c_double

Returns the value of the property specified by propertyId. If the property isn't of QVariant::Double or QMetaType::Float type, 0 is returned instead.

Calls C++ function: double QTextFormat::doubleProperty(int propertyId) const.

C++ documentation:

Returns the value of the property specified by propertyId. If the property isn’t of QVariant::Double or QMetaType::Float type, 0 is returned instead.

See also setProperty(), boolProperty(), intProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn foreground(&self) -> CppBox<QBrush>

Returns the brush used to render foreground details, such as text, frame outlines, and table borders.

Calls C++ function: QBrush QTextFormat::foreground() const.

C++ documentation:

Returns the brush used to render foreground details, such as text, frame outlines, and table borders.

See also setForeground(), clearForeground(), and background().

source

pub unsafe fn has_property(&self, property_id: c_int) -> bool

Returns true if the text format has a property with the given propertyId; otherwise returns false.

Calls C++ function: bool QTextFormat::hasProperty(int propertyId) const.

C++ documentation:

Returns true if the text format has a property with the given propertyId; otherwise returns false.

See also properties() and Property.

source

pub unsafe fn int_property(&self, property_id: c_int) -> c_int

Returns the value of the property specified by propertyId. If the property is not of QTextFormat::Integer type, 0 is returned instead.

Calls C++ function: int QTextFormat::intProperty(int propertyId) const.

C++ documentation:

Returns the value of the property specified by propertyId. If the property is not of QTextFormat::Integer type, 0 is returned instead.

See also setProperty(), boolProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn is_block_format(&self) -> bool

Returns true if this text format is a BlockFormat; otherwise returns false.

Calls C++ function: bool QTextFormat::isBlockFormat() const.

C++ documentation:

Returns true if this text format is a BlockFormat; otherwise returns false.

source

pub unsafe fn is_char_format(&self) -> bool

Returns true if this text format is a CharFormat; otherwise returns false.

Calls C++ function: bool QTextFormat::isCharFormat() const.

C++ documentation:

Returns true if this text format is a CharFormat; otherwise returns false.

source

pub unsafe fn is_empty(&self) -> bool

Returns true if the format does not store any properties; false otherwise.

Calls C++ function: bool QTextFormat::isEmpty() const.

C++ documentation:

Returns true if the format does not store any properties; false otherwise.

This function was introduced in Qt 5.3.

See also propertyCount() and properties().

source

pub unsafe fn is_frame_format(&self) -> bool

Returns true if this text format is a FrameFormat; otherwise returns false.

Calls C++ function: bool QTextFormat::isFrameFormat() const.

C++ documentation:

Returns true if this text format is a FrameFormat; otherwise returns false.

source

pub unsafe fn is_image_format(&self) -> bool

Returns true if this text format is an image format; otherwise returns false.

Calls C++ function: bool QTextFormat::isImageFormat() const.

C++ documentation:

Returns true if this text format is an image format; otherwise returns false.

source

pub unsafe fn is_list_format(&self) -> bool

Returns true if this text format is a ListFormat; otherwise returns false.

Calls C++ function: bool QTextFormat::isListFormat() const.

C++ documentation:

Returns true if this text format is a ListFormat; otherwise returns false.

source

pub unsafe fn is_table_cell_format(&self) -> bool

Returns true if this text format is a TableCellFormat; otherwise returns false.

Calls C++ function: bool QTextFormat::isTableCellFormat() const.

C++ documentation:

Returns true if this text format is a TableCellFormat; otherwise returns false.

This function was introduced in Qt 4.4.

source

pub unsafe fn is_table_format(&self) -> bool

Returns true if this text format is a TableFormat; otherwise returns false.

Calls C++ function: bool QTextFormat::isTableFormat() const.

C++ documentation:

Returns true if this text format is a TableFormat; otherwise returns false.

source

pub unsafe fn is_valid(&self) -> bool

Returns true if the format is valid (i.e. is not InvalidFormat); otherwise returns false.

Calls C++ function: bool QTextFormat::isValid() const.

C++ documentation:

Returns true if the format is valid (i.e. is not InvalidFormat); otherwise returns false.

source

pub unsafe fn layout_direction(&self) -> LayoutDirection

Returns the document's layout direction.

Calls C++ function: Qt::LayoutDirection QTextFormat::layoutDirection() const.

C++ documentation:

Returns the document’s layout direction.

See also setLayoutDirection().

source

pub unsafe fn length_property(&self, property_id: c_int) -> CppBox<QTextLength>

Returns the value of the property given by propertyId.

Calls C++ function: QTextLength QTextFormat::lengthProperty(int propertyId) const.

C++ documentation:

Returns the value of the property given by propertyId.

See also setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn length_vector_property( &self, property_id: c_int ) -> CppBox<QVectorOfQTextLength>

Returns the value of the property given by propertyId. If the property isn't of QTextFormat::LengthVector type, an empty length vector is returned instead.

Calls C++ function: QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const.

C++ documentation:

Returns the value of the property given by propertyId. If the property isn’t of QTextFormat::LengthVector type, an empty length vector is returned instead.

See also setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), colorProperty(), lengthProperty(), and Property.

source

pub unsafe fn merge(&self, other: impl CastInto<Ref<QTextFormat>>)

Merges the other format with this format; where there are conflicts the other format takes precedence.

Calls C++ function: void QTextFormat::merge(const QTextFormat& other).

C++ documentation:

Merges the other format with this format; where there are conflicts the other format takes precedence.

source

pub unsafe fn object_index(&self) -> c_int

Returns the index of the format object, or -1 if the format object is invalid.

Calls C++ function: int QTextFormat::objectIndex() const.

C++ documentation:

Returns the index of the format object, or -1 if the format object is invalid.

See also setObjectIndex().

source

pub unsafe fn object_type(&self) -> c_int

Returns the text format's object type.

Calls C++ function: int QTextFormat::objectType() const.

C++ documentation:

Returns the text format’s object type.

See also ObjectTypes and setObjectType().

source

pub unsafe fn pen_property(&self, property_id: c_int) -> CppBox<QPen>

Returns the value of the property given by propertyId; if the property isn't of QVariant::Pen type, Qt::NoPen is returned instead.

Calls C++ function: QPen QTextFormat::penProperty(int propertyId) const.

C++ documentation:

Returns the value of the property given by propertyId; if the property isn’t of QVariant::Pen type, Qt::NoPen is returned instead.

See also setProperty(), boolProperty(), intProperty(), doubleProperty(), stringProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn properties(&self) -> CppBox<QMapOfIntQVariant>

Returns a map with all properties of this text format.

Calls C++ function: QMap<int, QVariant> QTextFormat::properties() const.

C++ documentation:

Returns a map with all properties of this text format.

source

pub unsafe fn property(&self, property_id: c_int) -> CppBox<QVariant>

Returns the property specified by the given propertyId.

Calls C++ function: QVariant QTextFormat::property(int propertyId) const.

C++ documentation:

Returns the property specified by the given propertyId.

See also setProperty() and Property.

source

pub unsafe fn property_count(&self) -> c_int

Returns the number of properties stored in the format.

Calls C++ function: int QTextFormat::propertyCount() const.

C++ documentation:

Returns the number of properties stored in the format.

This function was introduced in Qt 4.3.

source

pub unsafe fn set_background(&self, brush: impl CastInto<Ref<QBrush>>)

Sets the brush use to paint the document's background to the brush specified.

Calls C++ function: void QTextFormat::setBackground(const QBrush& brush).

C++ documentation:

Sets the brush use to paint the document’s background to the brush specified.

See also background(), clearBackground(), and setForeground().

source

pub unsafe fn set_foreground(&self, brush: impl CastInto<Ref<QBrush>>)

Sets the foreground brush to the specified brush. The foreground brush is mostly used to render text.

Calls C++ function: void QTextFormat::setForeground(const QBrush& brush).

C++ documentation:

Sets the foreground brush to the specified brush. The foreground brush is mostly used to render text.

See also foreground(), clearForeground(), and setBackground().

source

pub unsafe fn set_layout_direction(&self, direction: LayoutDirection)

Sets the document's layout direction to the specified direction.

Calls C++ function: void QTextFormat::setLayoutDirection(Qt::LayoutDirection direction).

C++ documentation:

Sets the document’s layout direction to the specified direction.

See also layoutDirection().

source

pub unsafe fn set_object_index(&self, object: c_int)

Sets the format object's object index.

Calls C++ function: void QTextFormat::setObjectIndex(int object).

C++ documentation:

Sets the format object’s object index.

See also objectIndex().

source

pub unsafe fn set_object_type(&self, type_: c_int)

Sets the text format's object type to type.

Calls C++ function: void QTextFormat::setObjectType(int type).

C++ documentation:

Sets the text format’s object type to type.

See also ObjectTypes and objectType().

source

pub unsafe fn set_property_int_q_variant( &self, property_id: c_int, value: impl CastInto<Ref<QVariant>> )

Sets the property specified by the propertyId to the given value.

Calls C++ function: void QTextFormat::setProperty(int propertyId, const QVariant& value).

C++ documentation:

Sets the property specified by the propertyId to the given value.

See also property() and Property.

source

pub unsafe fn set_property_int_q_vector_of_q_text_length( &self, property_id: c_int, lengths: impl CastInto<Ref<QVectorOfQTextLength>> )

Sets the value of the property given by propertyId to value.

Calls C++ function: void QTextFormat::setProperty(int propertyId, const QVector<QTextLength>& lengths).

C++ documentation:

Sets the value of the property given by propertyId to value.

See also lengthVectorProperty() and Property.

source

pub unsafe fn string_property(&self, property_id: c_int) -> CppBox<QString>

Returns the value of the property given by propertyId; if the property isn't of QVariant::String type, an empty string is returned instead.

Calls C++ function: QString QTextFormat::stringProperty(int propertyId) const.

C++ documentation:

Returns the value of the property given by propertyId; if the property isn’t of QVariant::String type, an empty string is returned instead.

See also setProperty(), boolProperty(), intProperty(), doubleProperty(), colorProperty(), lengthProperty(), lengthVectorProperty(), and Property.

source

pub unsafe fn swap(&self, other: impl CastInto<Ref<QTextFormat>>)

Swaps this text format with other. This function is very fast and never fails.

Calls C++ function: void QTextFormat::swap(QTextFormat& other).

C++ documentation:

Swaps this text format with other. This function is very fast and never fails.

This function was introduced in Qt 5.0.

source

pub unsafe fn to_block_format(&self) -> CppBox<QTextBlockFormat>

Returns this format as a block format.

Calls C++ function: QTextBlockFormat QTextFormat::toBlockFormat() const.

C++ documentation:

Returns this format as a block format.

source

pub unsafe fn to_char_format(&self) -> CppBox<QTextCharFormat>

Returns this format as a character format.

Calls C++ function: QTextCharFormat QTextFormat::toCharFormat() const.

C++ documentation:

Returns this format as a character format.

source

pub unsafe fn to_frame_format(&self) -> CppBox<QTextFrameFormat>

Returns this format as a frame format.

Calls C++ function: QTextFrameFormat QTextFormat::toFrameFormat() const.

C++ documentation:

Returns this format as a frame format.

source

pub unsafe fn to_image_format(&self) -> CppBox<QTextImageFormat>

Returns this format as an image format.

Calls C++ function: QTextImageFormat QTextFormat::toImageFormat() const.

C++ documentation:

Returns this format as an image format.

source

pub unsafe fn to_list_format(&self) -> CppBox<QTextListFormat>

Returns this format as a list format.

Calls C++ function: QTextListFormat QTextFormat::toListFormat() const.

C++ documentation:

Returns this format as a list format.

source

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>

Returns the text format as a QVariant

Calls C++ function: QVariant QTextFormat::operator QVariant() const.

C++ documentation:

Returns the text format as a QVariant

source

pub unsafe fn to_table_cell_format(&self) -> CppBox<QTextTableCellFormat>

Returns this format as a table cell format.

Calls C++ function: QTextTableCellFormat QTextFormat::toTableCellFormat() const.

C++ documentation:

Returns this format as a table cell format.

This function was introduced in Qt 4.4.

source

pub unsafe fn to_table_format(&self) -> CppBox<QTextTableFormat>

Returns this format as a table format.

Calls C++ function: QTextTableFormat QTextFormat::toTableFormat() const.

C++ documentation:

Returns this format as a table format.

source

pub unsafe fn type_(&self) -> c_int

Returns the type of this format.

Calls C++ function: int QTextFormat::type() const.

C++ documentation:

Returns the type of this format.

See also FormatType.

Trait Implementations§

source§

impl CppDeletable for QTextBlockFormat

source§

unsafe fn delete(&self)

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

Calls C++ function: [destructor] void QTextBlockFormat::~QTextBlockFormat().

C++ documentation:

The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument.

A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a paragraph of text, a table, a list, or an image. Every block has an associated QTextBlockFormat that specifies its characteristics.

To cater for left-to-right and right-to-left languages you can set a block's direction with setDirection(). Paragraph alignment is set with setAlignment(). Margins are controlled by setTopMargin(), setBottomMargin(), setLeftMargin(), setRightMargin(). Overall indentation is set with setIndent(), the indentation of the first line with setTextIndent().

Line spacing is set with setLineHeight() and retrieved via lineHeight() and lineHeightType(). The types of line spacing available are in the LineHeightTypes enum.

Line breaking can be enabled and disabled with setNonBreakableLines().

The brush used to paint the paragraph's background is set with setBackground(), and other aspects of the text's appearance can be customized by using the setProperty() function with the OutlinePen, ForegroundBrush, and BackgroundBrush QTextFormat::Property values.

If a text block is part of a list, it can also have a list format that is accessible with the listFormat() function.

source§

impl Deref for QTextBlockFormat

source§

fn deref(&self) -> &QTextFormat

Calls C++ function: QTextFormat* static_cast<QTextFormat*>(QTextBlockFormat* ptr).

§

type Target = QTextFormat

The resulting type after dereferencing.
source§

impl StaticDowncast<QTextBlockFormat> for QTextFormat

source§

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextBlockFormat>

Calls C++ function: QTextBlockFormat* static_cast<QTextBlockFormat*>(QTextFormat* ptr).

source§

impl StaticUpcast<QTextFormat> for QTextBlockFormat

source§

unsafe fn static_upcast(ptr: Ptr<QTextBlockFormat>) -> Ptr<QTextFormat>

Calls C++ function: QTextFormat* static_cast<QTextFormat*>(QTextBlockFormat* ptr).

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.