Skip to content

PythonQt.QtGui.QTextLine · declarations 001

Back to PythonQt.QtGui.QTextLine

CursorBetweenCharacters instance-attribute

CursorBetweenCharacters: Any

CursorOnCharacter instance-attribute

CursorOnCharacter: Any

CursorPosition instance-attribute

CursorPosition: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

Leading instance-attribute

Leading: Any

Trailing instance-attribute

Trailing: Any

ascent

ascent() -> float

X.ascent() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::ascent() const

Returns the line's ascent.

See also descent() and height().

Upstream PySide2 reference signatures (binding differences may apply):

ascent(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#ascent

cursorToX

cursorToX(cursorPos: int, edge: Any) -> float

X.cursorToX(cursorPos, edge) -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::cursorToX(int *cursorPos, QTextLine::Edge edge \= Leading) const

Converts the cursor position cursorPos to the corresponding x position inside the line, taking account of the edge.

If cursorPos is not a valid cursor position, the nearest valid cursor position will be used instead, and cursorPos will be modified to point to this valid cursor position.

See also xToCursor().

qreal QTextLine::cursorToX(int cursorPos, QTextLine::Edge edge \= Leading) const

This is an overloaded function.

Upstream PySide2 reference signatures (binding differences may apply):

cursorToX(self, cursorPos: int, edge: PySide2.QtGui.QTextLine.Edge=...) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#cursorToX

descent

descent() -> float

X.descent() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::descent() const

Returns the line's descent.

See also ascent() and height().

Upstream PySide2 reference signatures (binding differences may apply):

descent(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#descent

draw

draw(p: Any, point: Any, selection: Any) -> None

X.draw(p, point, selection)

Supplemental documentation: Qt 5 reference:

void QTextLine::draw(QPainter *painter, const QPointF \&position, const QTextLayout::FormatRange *selection \= nullptr) const

Draws a line on the given painter at the specified position. The selection is reserved for internal use.

Upstream PySide2 reference signatures (binding differences may apply):

draw(self, p: PySide2.QtGui.QPainter, point: PySide2.QtCore.QPointF, selection: typing.Optional[PySide2.QtGui.QTextLayout.FormatRange]=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#draw

glyphRuns

glyphRuns(*args: Any, **kwargs: Any) -> Any

X.glyphRuns(from, length) -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QGlyphRun> QTextLine::glyphRuns(int from \= -1, int length \= -1) const

Returns the glyph indexes and positions for all glyphs in this QTextLine for characters in the range defined by from and length. The from index is relative to the beginning of the text in the containing QTextLayout, and the range must be within the range of QTextLine as given by functions textStart() and textLength().

If from is negative, it will default to textStart(), and if length is negative it will default to the return value of textLength().

This function was introduced in Qt 5.0.

See also QTextLayout::glyphRuns().

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#glyphRuns

height

height() -> float

X.height() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::height() const

Returns the line's height. This is equal to ascent() + descent() if leading is not included. If leading is included, this equals to ascent() + descent() + leading().

See also ascent(), descent(), leading(), and setLeadingIncluded().

Upstream PySide2 reference signatures (binding differences may apply):

height(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#height

horizontalAdvance

horizontalAdvance() -> float

X.horizontalAdvance() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::horizontalAdvance() const

Returns the horizontal advance of the text. The advance of the text is the distance from its position to the next position at which text would naturally be drawn.

By adding the advance to the position of the text line and using this as the position of a second text line, you will be able to position the two lines side-by-side without gaps in-between.

This function was introduced in Qt 4.7.

Upstream PySide2 reference signatures (binding differences may apply):

horizontalAdvance(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#horizontalAdvance

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

bool QTextLine::isValid() const

Returns true if this text line is valid; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#isValid

leading

leading() -> float

X.leading() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::leading() const

Returns the line's leading.

This function was introduced in Qt 4.6.

See also ascent(), descent(), and height().

Upstream PySide2 reference signatures (binding differences may apply):

leading(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#leading

leadingIncluded

leadingIncluded() -> bool

X.leadingIncluded() -> bool

Supplemental documentation: Qt 5 reference:

bool QTextLine::leadingIncluded() const

Returns true if positive leading is included into the line's height; otherwise returns false.

By default, leading is not included.

This function was introduced in Qt 4.6.

See also setLeadingIncluded().

Upstream PySide2 reference signatures (binding differences may apply):

leadingIncluded(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#leadingIncluded

lineNumber

lineNumber() -> int

X.lineNumber() -> int

Supplemental documentation: Qt 5 reference:

int QTextLine::lineNumber() const

Returns the position of the line in the text engine.

Upstream PySide2 reference signatures (binding differences may apply):

lineNumber(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#lineNumber

naturalTextRect

naturalTextRect() -> Any

X.naturalTextRect() -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

QRectF QTextLine::naturalTextRect() const

Returns the rectangle covered by the line.

Upstream PySide2 reference signatures (binding differences may apply):

naturalTextRect(self) -> PySide2.QtCore.QRectF

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#naturalTextRect

naturalTextWidth

naturalTextWidth() -> float

X.naturalTextWidth() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::naturalTextWidth() const

Returns the width of the line that is occupied by text. This is always \<\= to width(), and is the minimum width that could be used by layout() without changing the line break position.

Upstream PySide2 reference signatures (binding differences may apply):

naturalTextWidth(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#naturalTextWidth

position

position() -> Any

X.position() -> PythonQt.QtCore.QPointF

Supplemental documentation: Qt 5 reference:

QPointF QTextLine::position() const

Returns the line's position relative to the text layout's position.

See also setPosition().

Upstream PySide2 reference signatures (binding differences may apply):

position(self) -> PySide2.QtCore.QPointF

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#position

rect

rect() -> Any

X.rect() -> PythonQt.QtCore.QRectF

Supplemental documentation: Qt 5 reference:

QRectF QTextLine::rect() const

Returns the line's bounding rectangle.

See also x(), y(), textLength(), and width().

Upstream PySide2 reference signatures (binding differences may apply):

rect(self) -> PySide2.QtCore.QRectF

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#rect

setLeadingIncluded

setLeadingIncluded(included: bool) -> None

X.setLeadingIncluded(included)

Supplemental documentation: Qt 5 reference:

void QTextLine::setLeadingIncluded(bool included)

Includes positive leading into the line's height if included is true; otherwise does not include leading.

By default, leading is not included.

Note that negative leading is ignored, it must be handled in the code using the text lines by letting the lines overlap.

This function was introduced in Qt 4.6.

See also leadingIncluded().

Upstream PySide2 reference signatures (binding differences may apply):

setLeadingIncluded(self, included: bool) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#setLeadingIncluded

setLineWidth

setLineWidth(width: float) -> None

X.setLineWidth(width)

Supplemental documentation: Qt 5 reference:

void QTextLine::setLineWidth(qreal width)

Lays out the line with the given width. The line is filled from its starting position with as many characters as will fit into the line. In case the text cannot be split at the end of the line, it will be filled with additional characters to the next whitespace or end of the text.

Upstream PySide2 reference signatures (binding differences may apply):

setLineWidth(self, width: float) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#setLineWidth

setNumColumns

setNumColumns(columns: int, alignmentWidth: Any) -> None

X.setNumColumns(columns, alignmentWidth)

Supplemental documentation: Qt 5 reference:

void QTextLine::setNumColumns(int numColumns)

Lays out the line. The line is filled from its starting position with as many characters as are specified by numColumns. In case the text cannot be split until numColumns characters, the line will be filled with as many characters to the next whitespace or end of the text.

void QTextLine::setNumColumns(int numColumns, qreal alignmentWidth)

Lays out the line. The line is filled from its starting position with as many characters as are specified by numColumns. In case the text cannot be split until numColumns characters, the line will be filled with as many characters to the next whitespace or end of the text. The provided alignmentWidth is used as reference width for alignment.

Upstream PySide2 reference signatures (binding differences may apply):

setNumColumns(self, columns: int) -> None
setNumColumns(self, columns: int, alignmentWidth: float) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#setNumColumns

setPosition

setPosition(pos: Any) -> None

X.setPosition(pos)

Supplemental documentation: Qt 5 reference:

void QTextLine::setPosition(const QPointF \&pos)

Moves the line to position pos.

See also position().

Upstream PySide2 reference signatures (binding differences may apply):

setPosition(self, pos: PySide2.QtCore.QPointF) -> None

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#setPosition

textLength

textLength() -> int

X.textLength() -> int

Supplemental documentation: Qt 5 reference:

int QTextLine::textLength() const

Returns the length of the text in the line.

See also naturalTextWidth().

Upstream PySide2 reference signatures (binding differences may apply):

textLength(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#textLength

textStart

textStart() -> int

X.textStart() -> int

Supplemental documentation: Qt 5 reference:

int QTextLine::textStart() const

Returns the start of the line from the beginning of the string passed to the QTextLayout.

Upstream PySide2 reference signatures (binding differences may apply):

textStart(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#textStart

width

width() -> float

X.width() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::width() const

Returns the line's width as specified by the layout() function.

See also naturalTextWidth(), x(), y(), textLength(), and rect().

Upstream PySide2 reference signatures (binding differences may apply):

width(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#width

x

x() -> float

X.x() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::x() const

Returns the line's x position.

See also rect(), y(), textLength(), and width().

Upstream PySide2 reference signatures (binding differences may apply):

x(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#x

xToCursor

xToCursor(x: float, arg__2: Any) -> int

X.xToCursor(x, arg__2) -> int

Supplemental documentation: Qt 5 reference:

int QTextLine::xToCursor(qreal x, QTextLine::CursorPosition cpos \= CursorBetweenCharacters) const

Converts the x-coordinate x, to the nearest matching cursor position, depending on the cursor position type, cpos. Note that result cursor position includes possible preedit area text.

See also cursorToX().

Upstream PySide2 reference signatures (binding differences may apply):

xToCursor(self, x: float, edge: PySide2.QtGui.QTextLine.CursorPosition=...) -> int

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#xToCursor

y

y() -> float

X.y() -> float

Supplemental documentation: Qt 5 reference:

qreal QTextLine::y() const

Returns the line's y position.

See also x(), rect(), textLength(), and width().

Upstream PySide2 reference signatures (binding differences may apply):

y(self) -> float

Source: https://doc.qt.io/archives/qt-5.15/qtextline.html#y