API reference - Class QTextLine

Notation used in Ruby API documentation

Module: QtGui

Description: Binding of QTextLine

Sub-classes: CursorPosition, QFlags_CursorPosition, Edge, QFlags_Edge

Public constructors

new QTextLinenewConstructor QTextLine::QTextLine()

Public methods

[const]QTextLine ptr_const_castReturns a non-const reference to self.
void_createEnsures the C++ object is created
void_destroyExplicitly destroys the object
[const]bool_destroyed?Returns a value indicating whether the object was already destroyed
[const]bool_is_const_object?Returns a value indicating whether the reference is a const reference
void_manageMarks the object as managed by the script side.
void_unmanageMarks the object as no longer owned by the script side.
[const]doubleascentMethod double QTextLine::ascent()
voidassign(const QTextLine other)Assigns another object to self
[const]doublecursorToX(int cursorPos,
const QTextLine_Edge edge = QTextLine::Leading)
Method double QTextLine::cursorToX(int cursorPos, QTextLine::Edge edge)
[const]doubledescentMethod double QTextLine::descent()
[const]voiddraw(QPainter ptr p,
const QPointF point,
const QTextLayout_FormatRange ptr selection = nullptr)
Method void QTextLine::draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection)
[const]new QTextLine ptrdupCreates a copy of self
[const]QGlyphRun[]glyphRuns(int from = -1,
int length = -1)
Method QList<QGlyphRun> QTextLine::glyphRuns(int from, int length)
[const]doubleheightMethod double QTextLine::height()
[const]doublehorizontalAdvanceMethod double QTextLine::horizontalAdvance()
[const]boolisValid?Method bool QTextLine::isValid()
[const]doubleleadingMethod double QTextLine::leading()
[const]boolleadingIncludedMethod bool QTextLine::leadingIncluded()
voidleadingIncluded=(bool included)Method void QTextLine::setLeadingIncluded(bool included)
[const]intlineNumberMethod int QTextLine::lineNumber()
[const]QRectFnaturalTextRectMethod QRectF QTextLine::naturalTextRect()
[const]doublenaturalTextWidthMethod double QTextLine::naturalTextWidth()
[const]QPointFpositionMethod QPointF QTextLine::position()
voidposition=(const QPointF pos)Method void QTextLine::setPosition(const QPointF &pos)
[const]QRectFrectMethod QRectF QTextLine::rect()
voidsetLeadingIncluded(bool included)Method void QTextLine::setLeadingIncluded(bool included)
voidsetLineWidth(double width)Method void QTextLine::setLineWidth(double width)
voidsetNumColumns(int columns)Method void QTextLine::setNumColumns(int columns)
voidsetNumColumns(int columns,
double alignmentWidth)
Method void QTextLine::setNumColumns(int columns, double alignmentWidth)
voidsetPosition(const QPointF pos)Method void QTextLine::setPosition(const QPointF &pos)
[const]inttextLengthMethod int QTextLine::textLength()
[const]inttextStartMethod int QTextLine::textStart()
[const]doublewidthMethod double QTextLine::width()
[const]doublexMethod double QTextLine::x()
[const]intxToCursor(double x,
const QTextLine_CursorPosition arg2 = QTextLine::CursorBetweenCharacters)
Method int QTextLine::xToCursor(double x, QTextLine::CursorPosition)
[const]doubleyMethod double QTextLine::y()

Public static methods and constants

[static,const]QTextLine_CursorPositionCursorBetweenCharactersEnum constant QTextLine::CursorBetweenCharacters
[static,const]QTextLine_CursorPositionCursorOnCharacterEnum constant QTextLine::CursorOnCharacter
[static,const]QTextLine_EdgeLeadingEnum constant QTextLine::Leading
[static,const]QTextLine_EdgeTrailingEnum constant QTextLine::Trailing

Deprecated methods (protected, public, static, non-static and constructors)

voidcreateUse of this method is deprecated. Use _create instead
voiddestroyUse of this method is deprecated. Use _destroy instead
[const]booldestroyed?Use of this method is deprecated. Use _destroyed? instead
[const]boolis_const_object?Use of this method is deprecated. Use _is_const_object? instead

Detailed description

CursorBetweenCharacters

Signature: [static,const] QTextLine_CursorPosition CursorBetweenCharacters

Description: Enum constant QTextLine::CursorBetweenCharacters

Python specific notes:
The object exposes a readable attribute 'CursorBetweenCharacters'. This is the getter.

CursorOnCharacter

Signature: [static,const] QTextLine_CursorPosition CursorOnCharacter

Description: Enum constant QTextLine::CursorOnCharacter

Python specific notes:
The object exposes a readable attribute 'CursorOnCharacter'. This is the getter.

Leading

Signature: [static,const] QTextLine_Edge Leading

Description: Enum constant QTextLine::Leading

Python specific notes:
The object exposes a readable attribute 'Leading'. This is the getter.

Trailing

Signature: [static,const] QTextLine_Edge Trailing

Description: Enum constant QTextLine::Trailing

Python specific notes:
The object exposes a readable attribute 'Trailing'. This is the getter.

_const_cast

Signature: [const] QTextLine ptr _const_cast

Description: Returns a non-const reference to self.

Basically, this method allows turning a const object reference to a non-const one. This method is provided as last resort to remove the constness from an object. Usually there is a good reason for a const object reference, so using this method may have undesired side effects.

This method has been introduced in version 0.29.6.

_create

Signature: void _create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

_destroy

Signature: void _destroy

Description: Explicitly destroys the object

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

_destroyed?

Signature: [const] bool _destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

_is_const_object?

Signature: [const] bool _is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

_manage

Signature: void _manage

Description: Marks the object as managed by the script side.

After calling this method on an object, the script side will be responsible for the management of the object. This method may be called if an object is returned from a C++ function and the object is known not to be owned by any C++ instance. If necessary, the script side may delete the object if the script's reference is no longer required.

Usually it's not required to call this method. It has been introduced in version 0.24.

_unmanage

Signature: void _unmanage

Description: Marks the object as no longer owned by the script side.

Calling this method will make this object no longer owned by the script's memory management. Instead, the object must be managed in some other way. Usually this method may be called if it is known that some C++ object holds and manages this object. Technically speaking, this method will turn the script's reference into a weak reference. After the script engine decides to delete the reference, the object itself will still exist. If the object is not managed otherwise, memory leaks will occur.

Usually it's not required to call this method. It has been introduced in version 0.24.

ascent

Signature: [const] double ascent

Description: Method double QTextLine::ascent()

assign

Signature: void assign (const QTextLine other)

Description: Assigns another object to self

create

Signature: void create

Description: Ensures the C++ object is created

Use of this method is deprecated. Use _create instead

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

cursorToX

Signature: [const] double cursorToX (int cursorPos, const QTextLine_Edge edge = QTextLine::Leading)

Description: Method double QTextLine::cursorToX(int cursorPos, QTextLine::Edge edge)

descent

Signature: [const] double descent

Description: Method double QTextLine::descent()

destroy

Signature: void destroy

Description: Explicitly destroys the object

Use of this method is deprecated. Use _destroy instead

Explicitly destroys the object on C++ side if it was owned by the script interpreter. Subsequent access to this object will throw an exception. If the object is not owned by the script, this method will do nothing.

destroyed?

Signature: [const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

Use of this method is deprecated. Use _destroyed? instead

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

draw

Signature: [const] void draw (QPainter ptr p, const QPointF point, const QTextLayout_FormatRange ptr selection = nullptr)

Description: Method void QTextLine::draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection)

dup

Signature: [const] new QTextLine ptr dup

Description: Creates a copy of self

Python specific notes:
This method also implements '__copy__' and '__deepcopy__'.

glyphRuns

Signature: [const] QGlyphRun[] glyphRuns (int from = -1, int length = -1)

Description: Method QList<QGlyphRun> QTextLine::glyphRuns(int from, int length)

height

Signature: [const] double height

Description: Method double QTextLine::height()

horizontalAdvance

Signature: [const] double horizontalAdvance

Description: Method double QTextLine::horizontalAdvance()

isValid?

Signature: [const] bool isValid?

Description: Method bool QTextLine::isValid()

is_const_object?

Signature: [const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

Use of this method is deprecated. Use _is_const_object? instead

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

leading

Signature: [const] double leading

Description: Method double QTextLine::leading()

leadingIncluded

Signature: [const] bool leadingIncluded

Description: Method bool QTextLine::leadingIncluded()

Python specific notes:
The object exposes a readable attribute 'leadingIncluded'. This is the getter.

leadingIncluded=

Signature: void leadingIncluded= (bool included)

Description: Method void QTextLine::setLeadingIncluded(bool included)

Python specific notes:
The object exposes a writable attribute 'leadingIncluded'. This is the setter.

lineNumber

Signature: [const] int lineNumber

Description: Method int QTextLine::lineNumber()

naturalTextRect

Signature: [const] QRectF naturalTextRect

Description: Method QRectF QTextLine::naturalTextRect()

naturalTextWidth

Signature: [const] double naturalTextWidth

Description: Method double QTextLine::naturalTextWidth()

new

Signature: [static] new QTextLine new

Description: Constructor QTextLine::QTextLine()

This method creates an object of class QTextLine.

Python specific notes:
This method is the default initializer of the object.

position

Signature: [const] QPointF position

Description: Method QPointF QTextLine::position()

Python specific notes:
The object exposes a readable attribute 'position'. This is the getter.

position=

Signature: void position= (const QPointF pos)

Description: Method void QTextLine::setPosition(const QPointF &pos)

Python specific notes:
The object exposes a writable attribute 'position'. This is the setter.

rect

Signature: [const] QRectF rect

Description: Method QRectF QTextLine::rect()

setLeadingIncluded

Signature: void setLeadingIncluded (bool included)

Description: Method void QTextLine::setLeadingIncluded(bool included)

Python specific notes:
The object exposes a writable attribute 'leadingIncluded'. This is the setter.

setLineWidth

Signature: void setLineWidth (double width)

Description: Method void QTextLine::setLineWidth(double width)

setNumColumns

(1) Signature: void setNumColumns (int columns)

Description: Method void QTextLine::setNumColumns(int columns)

(2) Signature: void setNumColumns (int columns, double alignmentWidth)

Description: Method void QTextLine::setNumColumns(int columns, double alignmentWidth)

setPosition

Signature: void setPosition (const QPointF pos)

Description: Method void QTextLine::setPosition(const QPointF &pos)

Python specific notes:
The object exposes a writable attribute 'position'. This is the setter.

textLength

Signature: [const] int textLength

Description: Method int QTextLine::textLength()

textStart

Signature: [const] int textStart

Description: Method int QTextLine::textStart()

width

Signature: [const] double width

Description: Method double QTextLine::width()

x

Signature: [const] double x

Description: Method double QTextLine::x()

xToCursor

Signature: [const] int xToCursor (double x, const QTextLine_CursorPosition arg2 = QTextLine::CursorBetweenCharacters)

Description: Method int QTextLine::xToCursor(double x, QTextLine::CursorPosition)

y

Signature: [const] double y

Description: Method double QTextLine::y()