[][src]Struct qt_gui::QTextFormat

#[repr(C)]pub struct QTextFormat { /* fields omitted */ }

The QTextFormat class provides formatting information for a QTextDocument.

C++ class: QTextFormat.

C++ documentation:

The QTextFormat class provides formatting information for a QTextDocument.

A QTextFormat is a generic class used for describing the format of parts of a QTextDocument. The derived classes QTextCharFormat, QTextBlockFormat, QTextListFormat, and QTextTableFormat are usually more useful, and describe the formatting that is applied to specific parts of the document.

A format has a FormatType which specifies the kinds of text item it can format; e.g. a block of text, a list, a table, etc. A format also has various properties (some specific to particular format types), as described by the Property enum. Every property has a corresponding Property.

The format type is given by type(), and the format can be tested with isCharFormat(), isBlockFormat(), isListFormat(), isTableFormat(), isFrameFormat(), and isImageFormat(). If the type is determined, it can be retrieved with toCharFormat(), toBlockFormat(), toListFormat(), toTableFormat(), toFrameFormat(), and toImageFormat().

A format's properties can be set with the setProperty() functions, and retrieved with boolProperty(), intProperty(), doubleProperty(), and stringProperty() as appropriate. All the property IDs used in the format can be retrieved with allPropertyIds(). One format can be merged into another using merge().

A format's object index can be set with setObjectIndex(), and retrieved with objectIndex(). These methods can be used to associate the format with a QTextObject. It is used to represent lists, frames, and tables inside the document.

Methods

impl QTextFormat[src]

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

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().

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

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.

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

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.

pub unsafe fn clear_background(&self)[src]

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().

pub unsafe fn clear_foreground(&self)[src]

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().

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

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.

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

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.

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

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.

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

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.

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

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().

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

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.

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

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.

pub unsafe fn is_block_format(&self) -> bool[src]

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.

pub unsafe fn is_char_format(&self) -> bool[src]

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.

pub unsafe fn is_empty(&self) -> bool[src]

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().

pub unsafe fn is_frame_format(&self) -> bool[src]

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.

pub unsafe fn is_image_format(&self) -> bool[src]

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.

pub unsafe fn is_list_format(&self) -> bool[src]

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.

pub unsafe fn is_table_cell_format(&self) -> bool[src]

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.

pub unsafe fn is_table_format(&self) -> bool[src]

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.

pub unsafe fn is_valid(&self) -> bool[src]

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.

pub unsafe fn layout_direction(&self) -> LayoutDirection[src]

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().

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

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.

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

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.

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

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.

pub unsafe fn new_0a() -> CppBox<QTextFormat>[src]

Creates a new text format with an InvalidFormat.

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

C++ documentation:

Creates a new text format with an InvalidFormat.

See also FormatType.

pub unsafe fn new_1a(type_: c_int) -> CppBox<QTextFormat>[src]

Creates a new text format of the given type.

Calls C++ function: [constructor] void QTextFormat::QTextFormat(int type).

C++ documentation:

Creates a new text format of the given type.

See also FormatType.

pub unsafe fn new_copy(
    rhs: impl CastInto<Ref<QTextFormat>>
) -> CppBox<QTextFormat>
[src]

Creates a new text format with the same attributes as the other text format.

Calls C++ function: [constructor] void QTextFormat::QTextFormat(const QTextFormat& rhs).

C++ documentation:

Creates a new text format with the same attributes as the other text format.

pub unsafe fn object_index(&self) -> c_int[src]

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().

pub unsafe fn object_type(&self) -> c_int[src]

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().

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

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.

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

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.

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

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.

pub unsafe fn property_count(&self) -> c_int[src]

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.

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

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().

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

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().

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

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().

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

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().

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

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().

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

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.

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

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.

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

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

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.

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

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.

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

Returns this format as a block format.

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

C++ documentation:

Returns this format as a block format.

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

Returns this format as a character format.

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

C++ documentation:

Returns this format as a character format.

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

Returns this format as a frame format.

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

C++ documentation:

Returns this format as a frame format.

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

Returns this format as an image format.

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

C++ documentation:

Returns this format as an image format.

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

Returns this format as a list format.

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

C++ documentation:

Returns this format as a list format.

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

Returns the text format as a QVariant

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

C++ documentation:

Returns the text format as a QVariant

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

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.

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

Returns this format as a table format.

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

C++ documentation:

Returns this format as a table format.

pub unsafe fn type_(&self) -> c_int[src]

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

impl CppDeletable for QTextFormat[src]

unsafe fn delete(&self)[src]

Destroys this text format.

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

C++ documentation:

Destroys this text format.

impl PartialEq<Ref<QTextFormat>> for QTextFormat[src]

fn eq(&self, rhs: &Ref<QTextFormat>) -> bool[src]

Returns true if this text format is the same as the other text format.

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

C++ documentation:

Returns true if this text format is the same as the other text format.

impl StaticDowncast<QTextBlockFormat> for QTextFormat[src]

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

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

impl StaticDowncast<QTextCharFormat> for QTextFormat[src]

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextCharFormat>[src]

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

impl StaticDowncast<QTextFrameFormat> for QTextFormat[src]

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextFrameFormat>[src]

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

impl StaticDowncast<QTextImageFormat> for QTextFormat[src]

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextImageFormat>[src]

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

impl StaticDowncast<QTextListFormat> for QTextFormat[src]

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextListFormat>[src]

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

impl StaticDowncast<QTextTableCellFormat> for QTextFormat[src]

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextTableCellFormat>[src]

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

impl StaticDowncast<QTextTableFormat> for QTextFormat[src]

unsafe fn static_downcast(ptr: Ptr<QTextFormat>) -> Ptr<QTextTableFormat>[src]

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

impl StaticUpcast<QTextFormat> for QTextCharFormat[src]

unsafe fn static_upcast(ptr: Ptr<QTextCharFormat>) -> Ptr<QTextFormat>[src]

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

impl StaticUpcast<QTextFormat> for QTextBlockFormat[src]

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

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

impl StaticUpcast<QTextFormat> for QTextListFormat[src]

unsafe fn static_upcast(ptr: Ptr<QTextListFormat>) -> Ptr<QTextFormat>[src]

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

impl StaticUpcast<QTextFormat> for QTextImageFormat[src]

unsafe fn static_upcast(ptr: Ptr<QTextImageFormat>) -> Ptr<QTextFormat>[src]

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

impl StaticUpcast<QTextFormat> for QTextFrameFormat[src]

unsafe fn static_upcast(ptr: Ptr<QTextFrameFormat>) -> Ptr<QTextFormat>[src]

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

impl StaticUpcast<QTextFormat> for QTextTableFormat[src]

unsafe fn static_upcast(ptr: Ptr<QTextTableFormat>) -> Ptr<QTextFormat>[src]

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

impl StaticUpcast<QTextFormat> for QTextTableCellFormat[src]

unsafe fn static_upcast(ptr: Ptr<QTextTableCellFormat>) -> Ptr<QTextFormat>[src]

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.