PythonQt.QtGui.QTextLayout · declarations 001
Back to PythonQt.QtGui.QTextLayout
CursorMode
instance-attribute
CursorMode: 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
FormatRange
instance-attribute
FormatRange: type
PythonQtInstanceWrapper object
SkipCharacters
instance-attribute
SkipCharacters: Any
SkipWords
instance-attribute
SkipWords: Any
additionalFormats
additionalFormats() -> tuple
X.additionalFormats() -> tuple
Upstream PySide2 reference signatures (binding differences may apply):
additionalFormats(self) -> typing.List[PySide2.QtGui.QTextLayout.FormatRange]
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#additionalFormats
beginLayout
beginLayout() -> None
X.beginLayout()
Supplemental documentation: Qt 5 reference:
void QTextLayout::beginLayout()
Begins the layout process.
Warning: This will invalidate the layout, so all existing QTextLine objects that refer to the previous contents should now be discarded.
See also endLayout().
Upstream PySide2 reference signatures (binding differences may apply):
beginLayout(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#beginLayout
boundingRect
boundingRect() -> Any
X.boundingRect() -> PythonQt.QtCore.QRectF
Supplemental documentation: Qt 5 reference:
QRectF QTextLayout::boundingRect() const
The smallest rectangle that contains all the lines in the layout.
Upstream PySide2 reference signatures (binding differences may apply):
boundingRect(self) -> PySide2.QtCore.QRectF
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#boundingRect
cacheEnabled
cacheEnabled() -> bool
X.cacheEnabled() -> bool
Supplemental documentation: Qt 5 reference:
bool QTextLayout::cacheEnabled() const
Returns true if the complete layout information is cached; otherwise returns false.
See also setCacheEnabled().
Upstream PySide2 reference signatures (binding differences may apply):
cacheEnabled(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#cacheEnabled
clearAdditionalFormats
clearAdditionalFormats() -> None
X.clearAdditionalFormats()
Upstream PySide2 reference signatures (binding differences may apply):
clearAdditionalFormats(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#clearAdditionalFormats
clearFormats
clearFormats() -> None
X.clearFormats()
Supplemental documentation: Qt 5 reference:
void QTextLayout::clearFormats()
Clears the list of additional formats supported by the text layout.
This function was introduced in Qt 5.6.
See also formats() and setFormats().
Upstream PySide2 reference signatures (binding differences may apply):
clearFormats(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#clearFormats
clearLayout
clearLayout() -> None
X.clearLayout()
Supplemental documentation: Qt 5 reference:
void QTextLayout::clearLayout()
Clears the line information in the layout. After having called this function, lineCount() returns 0.
Warning: This will invalidate the layout, so all existing QTextLine objects that refer to the previous contents should now be discarded.
This function was introduced in Qt 4.4.
Upstream PySide2 reference signatures (binding differences may apply):
clearLayout(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#clearLayout
createLine
createLine() -> Any
X.createLine() -> PythonQt.QtGui.QTextLine
Supplemental documentation: Qt 5 reference:
QTextLine QTextLayout::createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise returns an invalid text line.
The text layout creates a new line object that starts after the last line in the layout, or at the beginning if the layout is empty. The layout maintains an internal cursor, and each line is filled with text from the cursor position onwards when the QTextLine::setLineWidth() function is called.
Once QTextLine::setLineWidth() is called, a new line can be created and filled with text. Repeating this process will lay out the whole block of text contained in the QTextLayout. If there is no text left to be inserted into the layout, the QTextLine returned will not be valid (isValid() will return false).
Upstream PySide2 reference signatures (binding differences may apply):
createLine(self) -> PySide2.QtGui.QTextLine
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#createLine
cursorMoveStyle
cursorMoveStyle() -> Any
X.cursorMoveStyle()
Supplemental documentation: Qt 5 reference:
Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const
The cursor movement style of this QTextLayout. The default is Qt::LogicalMoveStyle.
See also setCursorMoveStyle().
Upstream PySide2 reference signatures (binding differences may apply):
cursorMoveStyle(self) -> PySide2.QtCore.Qt.CursorMoveStyle
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#cursorMoveStyle
draw
draw(p: Any, pos: Any, selections: Any, clip: Any) -> None
X.draw(p, pos, selections, clip)
Supplemental documentation: Qt 5 reference:
void QTextLayout::draw(QPainter *p, const QPointF \&pos, const QVector\<QTextLayout::FormatRange> \&selections \= QVector\<FormatRange>(), const QRectF \&clip \= QRectF()) const
Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.
Upstream PySide2 reference signatures (binding differences may apply):
draw(self, p: PySide2.QtGui.QPainter, pos: PySide2.QtCore.QPointF, selections: typing.List[PySide2.QtGui.QTextLayout.FormatRange]=..., clip: PySide2.QtCore.QRectF=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#draw
drawCursor
drawCursor(p: Any, pos: Any, cursorPosition: int, width: Any) -> None
X.drawCursor(p, pos, cursorPosition, width)
Supplemental documentation: Qt 5 reference:
void QTextLayout::drawCursor(QPainter *painter, const QPointF \&position, int cursorPosition, int width) const
Draws a text cursor with the current pen and the specified width at the given position using the painter specified. The corresponding position within the text is specified by cursorPosition.
void QTextLayout::drawCursor(QPainter *painter, const QPointF \&position, int cursorPosition) const
This is an overloaded function.
Draws a text cursor with the current pen at the given position using the painter specified. The corresponding position within the text is specified by cursorPosition.
Upstream PySide2 reference signatures (binding differences may apply):
drawCursor(self, p: PySide2.QtGui.QPainter, pos: PySide2.QtCore.QPointF, cursorPosition: int) -> None
drawCursor(self, p: PySide2.QtGui.QPainter, pos: PySide2.QtCore.QPointF, cursorPosition: int, width: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#drawCursor
endLayout
endLayout() -> None
X.endLayout()
Supplemental documentation: Qt 5 reference:
void QTextLayout::endLayout()
Ends the layout process.
See also beginLayout().
Upstream PySide2 reference signatures (binding differences may apply):
endLayout(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#endLayout
font
font() -> Any
X.font() -> PythonQt.QtGui.QFont
Supplemental documentation: Qt 5 reference:
QFont QTextLayout::font() const
Returns the current font that is used for the layout, or a default font if none is set.
See also setFont().
Upstream PySide2 reference signatures (binding differences may apply):
font(self) -> PySide2.QtGui.QFont
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#font
formats
formats() -> tuple
X.formats() -> tuple
Supplemental documentation: Qt 5 reference:
QVector\<QTextLayout::FormatRange> QTextLayout::formats() const
Returns the list of additional formats supported by the text layout.
This function was introduced in Qt 5.6.
See also setFormats() and clearFormats().
Upstream PySide2 reference signatures (binding differences may apply):
formats(self) -> typing.List[PySide2.QtGui.QTextLayout.FormatRange]
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#formats
glyphRuns
glyphRuns(*args: Any, **kwargs: Any) -> Any
X.glyphRuns(from, length) -> tuple
Supplemental documentation: Qt 5 reference:
QList\<QGlyphRun> QTextLayout::glyphRuns(int from \= -1, int length \= -1) const
Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.
If from is less than zero, then the glyph run will begin at the first character in the layout. If length is less than zero, it will span the entire string from the start position.
This function was introduced in Qt 4.8.
See also draw() and QPainter::drawGlyphRun().
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#glyphRuns
isValidCursorPosition
isValidCursorPosition(pos: int) -> bool
X.isValidCursorPosition(pos) -> bool
Supplemental documentation: Qt 5 reference:
bool QTextLayout::isValidCursorPosition(int pos) const
/ Returns true if position pos is a valid cursor position.
In a Unicode context some positions in the text are not valid cursor positions, because the position is inside a Unicode surrogate or a grapheme cluster.
A grapheme cluster is a sequence of two or more Unicode characters that form one indivisible entity on the screen. For example the latin character `Ä' can be represented in Unicode by two characters, `A' (0x41), and the combining diaresis (0x308). A text cursor can only validly be positioned before or after these two characters, never between them since that wouldn't make sense. In indic languages every syllable forms a grapheme cluster.
Upstream PySide2 reference signatures (binding differences may apply):
isValidCursorPosition(self, pos: int) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#isValidCursorPosition
leftCursorPosition
leftCursorPosition(oldPos: int) -> int
X.leftCursorPosition(oldPos) -> int
Supplemental documentation: Qt 5 reference:
int QTextLayout::leftCursorPosition(int oldPos) const
Returns the cursor position to the left of oldPos, next to it. It's dependent on the visual position of characters, after bi-directional reordering.
See also rightCursorPosition() and previousCursorPosition().
Upstream PySide2 reference signatures (binding differences may apply):
leftCursorPosition(self, oldPos: int) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#leftCursorPosition
lineAt
lineAt(i: int) -> Any
X.lineAt(i) -> PythonQt.QtGui.QTextLine
Supplemental documentation: Qt 5 reference:
QTextLine QTextLayout::lineAt(int i) const
Returns the i-th line of text in this text layout.
See also lineCount() and lineForTextPosition().
Upstream PySide2 reference signatures (binding differences may apply):
lineAt(self, i: int) -> PySide2.QtGui.QTextLine
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#lineAt
lineCount
lineCount() -> int
X.lineCount() -> int
Supplemental documentation: Qt 5 reference:
int QTextLayout::lineCount() const
Returns the number of lines in this text layout.
See also lineAt().
Upstream PySide2 reference signatures (binding differences may apply):
lineCount(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#lineCount
lineForTextPosition
lineForTextPosition(pos: int) -> Any
X.lineForTextPosition(pos) -> PythonQt.QtGui.QTextLine
Supplemental documentation: Qt 5 reference:
QTextLine QTextLayout::lineForTextPosition(int pos) const
Returns the line that contains the cursor position specified by pos.
See also isValidCursorPosition() and lineAt().
Upstream PySide2 reference signatures (binding differences may apply):
lineForTextPosition(self, pos: int) -> PySide2.QtGui.QTextLine
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#lineForTextPosition
maximumWidth
maximumWidth() -> float
X.maximumWidth() -> float
Supplemental documentation: Qt 5 reference:
qreal QTextLayout::maximumWidth() const
The maximum width the layout could expand to; this is essentially the width of the entire text.
Warning: This function only returns a valid value after the layout has been done.
See also minimumWidth().
Upstream PySide2 reference signatures (binding differences may apply):
maximumWidth(self) -> float
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#maximumWidth
minimumWidth
minimumWidth() -> float
X.minimumWidth() -> float
Supplemental documentation: Qt 5 reference:
qreal QTextLayout::minimumWidth() const
The minimum width the layout needs. This is the width of the layout's smallest non-breakable substring.
Warning: This function only returns a valid value after the layout has been done.
See also maximumWidth().
Upstream PySide2 reference signatures (binding differences may apply):
minimumWidth(self) -> float
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#minimumWidth
nextCursorPosition
nextCursorPosition(oldPos: int, mode: Any) -> int
X.nextCursorPosition(oldPos, mode) -> int
Supplemental documentation: Qt 5 reference:
int QTextLayout::nextCursorPosition(int oldPos, QTextLayout::CursorMode mode \= SkipCharacters) const
Returns the next valid cursor position after oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.
See also isValidCursorPosition() and previousCursorPosition().
Upstream PySide2 reference signatures (binding differences may apply):
nextCursorPosition(self, oldPos: int, mode: PySide2.QtGui.QTextLayout.CursorMode=...) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#nextCursorPosition
position
position() -> Any
X.position() -> PythonQt.QtCore.QPointF
Supplemental documentation: Qt 5 reference:
QPointF QTextLayout::position() const
The global position of the layout. This is independent of the bounding rectangle and of the layout process.
This function was introduced in Qt 4.2.
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/qtextlayout.html#position
preeditAreaPosition
preeditAreaPosition() -> int
X.preeditAreaPosition() -> int
Supplemental documentation: Qt 5 reference:
int QTextLayout::preeditAreaPosition() const
Returns the position of the area in the text layout that will be processed before editing occurs.
See also preeditAreaText().
Upstream PySide2 reference signatures (binding differences may apply):
preeditAreaPosition(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#preeditAreaPosition
preeditAreaText
preeditAreaText() -> str
X.preeditAreaText() -> str
Supplemental documentation: Qt 5 reference:
QString QTextLayout::preeditAreaText() const
Returns the text that is inserted in the layout before editing occurs.
See also preeditAreaPosition().
Upstream PySide2 reference signatures (binding differences may apply):
preeditAreaText(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#preeditAreaText
previousCursorPosition
previousCursorPosition(oldPos: int, mode: Any) -> int
X.previousCursorPosition(oldPos, mode) -> int
Supplemental documentation: Qt 5 reference:
int QTextLayout::previousCursorPosition(int oldPos, QTextLayout::CursorMode mode \= SkipCharacters) const
Returns the first valid cursor position before oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.
See also isValidCursorPosition() and nextCursorPosition().
Upstream PySide2 reference signatures (binding differences may apply):
previousCursorPosition(self, oldPos: int, mode: PySide2.QtGui.QTextLayout.CursorMode=...) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#previousCursorPosition
rightCursorPosition
rightCursorPosition(oldPos: int) -> int
X.rightCursorPosition(oldPos) -> int
Supplemental documentation: Qt 5 reference:
int QTextLayout::rightCursorPosition(int oldPos) const
Returns the cursor position to the right of oldPos, next to it. It's dependent on the visual position of characters, after bi-directional reordering.
See also leftCursorPosition() and nextCursorPosition().
Upstream PySide2 reference signatures (binding differences may apply):
rightCursorPosition(self, oldPos: int) -> int
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#rightCursorPosition
setAdditionalFormats
setAdditionalFormats(overrides: Any) -> None
X.setAdditionalFormats(overrides)
Upstream PySide2 reference signatures (binding differences may apply):
setAdditionalFormats(self, overrides: typing.Sequence[PySide2.QtGui.QTextLayout.FormatRange]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setAdditionalFormats
setCacheEnabled
setCacheEnabled(enable: bool) -> None
X.setCacheEnabled(enable)
Supplemental documentation: Qt 5 reference:
void QTextLayout::setCacheEnabled(bool enable)
Enables caching of the complete layout information if enable is true; otherwise disables layout caching. Usually QTextLayout throws most of the layouting information away after a call to endLayout() to reduce memory consumption. If you however want to draw the laid out text directly afterwards enabling caching might speed up drawing significantly.
See also cacheEnabled().
Upstream PySide2 reference signatures (binding differences may apply):
setCacheEnabled(self, enable: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setCacheEnabled
setCursorMoveStyle
setCursorMoveStyle(style: Any) -> None
X.setCursorMoveStyle(style)
Supplemental documentation: Qt 5 reference:
void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
Sets the visual cursor movement style to the given style. If the QTextLayout is backed by a document, you can ignore this and use the option in QTextDocument, this option is for widgets like QLineEdit or custom widgets without a QTextDocument. Default value is Qt::LogicalMoveStyle.
See also cursorMoveStyle().
Upstream PySide2 reference signatures (binding differences may apply):
setCursorMoveStyle(self, style: PySide2.QtCore.Qt.CursorMoveStyle) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setCursorMoveStyle
setFlags
setFlags(arg0: flags) -> None
X.setFlags(flags)
Upstream PySide2 reference signatures (binding differences may apply):
setFlags(self, flags: int) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setFlags
setFont
setFont(f: Any) -> None
X.setFont(f)
Supplemental documentation: Qt 5 reference:
void QTextLayout::setFont(const QFont \&font)
Sets the layout's font to the given font. The layout is invalidated and must be laid out again.
See also font().
Upstream PySide2 reference signatures (binding differences may apply):
setFont(self, f: PySide2.QtGui.QFont) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setFont
setFormats
setFormats(overrides: Any) -> None
X.setFormats(overrides)
Supplemental documentation: Qt 5 reference:
void QTextLayout::setFormats(const QVector\<QTextLayout::FormatRange> \&formats)
Sets the additional formats supported by the text layout to formats. The formats are applied with preedit area text in place.
This function was introduced in Qt 5.6.
See also formats() and clearFormats().
Upstream PySide2 reference signatures (binding differences may apply):
setFormats(self, overrides: typing.List[PySide2.QtGui.QTextLayout.FormatRange]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setFormats
setPosition
setPosition(p: Any) -> None
X.setPosition(p)
Supplemental documentation: Qt 5 reference:
void QTextLayout::setPosition(const QPointF \&p)
Moves the text layout to point p.
See also position().
Upstream PySide2 reference signatures (binding differences may apply):
setPosition(self, p: PySide2.QtCore.QPointF) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setPosition
setPreeditArea
setPreeditArea(position: int, text: str) -> None
X.setPreeditArea(position, text)
Supplemental documentation: Qt 5 reference:
void QTextLayout::setPreeditArea(int position, const QString \&text)
Sets the position and text of the area in the layout that is processed before editing occurs. The layout is invalidated and must be laid out again.
See also preeditAreaPosition() and preeditAreaText().
Upstream PySide2 reference signatures (binding differences may apply):
setPreeditArea(self, position: int, text: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qtextlayout.html#setPreeditArea