#[repr(C)]pub struct QTextLine { /* private fields */ }
Expand description
The QTextLine class represents a line of text inside a QTextLayout.
C++ class: QTextLine
.
The QTextLine class represents a line of text inside a QTextLayout.
A text line is usually created by QTextLayout::createLine().
After being created, the line can be filled using the setLineWidth() or setNumColumns() functions. A line has a number of attributes including the rectangle it occupies, rect(), its coordinates, x() and y(), its textLength(), width() and naturalTextWidth(), and its ascent() and descent() relative to the text. The position of the cursor in terms of the line is available from cursorToX() and its inverse from xToCursor(). A line can be moved with setPosition().
Implementations§
source§impl QTextLine
impl QTextLine
sourcepub unsafe fn ascent(&self) -> c_double
pub unsafe fn ascent(&self) -> c_double
Returns the line's ascent.
Calls C++ function: double QTextLine::ascent() const
.
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QTextLine>>
) -> Ref<QTextLine>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QTextLine>> ) -> Ref<QTextLine>
The QTextLine class represents a line of text inside a QTextLayout.
Calls C++ function: QTextLine& QTextLine::operator=(const QTextLine& other)
.
The QTextLine class represents a line of text inside a QTextLayout.
A text line is usually created by QTextLayout::createLine().
After being created, the line can be filled using the setLineWidth() or setNumColumns() functions. A line has a number of attributes including the rectangle it occupies, rect(), its coordinates, x() and y(), its textLength(), width() and naturalTextWidth(), and its ascent() and descent() relative to the text. The position of the cursor in terms of the line is available from cursorToX() and its inverse from xToCursor(). A line can be moved with setPosition().
sourcepub unsafe fn cursor_to_x_int_edge(
&self,
cursor_pos: *mut c_int,
edge: Edge
) -> c_double
pub unsafe fn cursor_to_x_int_edge( &self, cursor_pos: *mut c_int, edge: Edge ) -> c_double
Converts the cursor position cursorPos to the corresponding x position inside the line, taking account of the edge.
Calls C++ function: double QTextLine::cursorToX(int* cursorPos, QTextLine::Edge edge = …) 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().
sourcepub unsafe fn cursor_to_x_int_edge2(
&self,
cursor_pos: c_int,
edge: Edge
) -> c_double
pub unsafe fn cursor_to_x_int_edge2( &self, cursor_pos: c_int, edge: Edge ) -> c_double
This is an overloaded function.
Calls C++ function: double QTextLine::cursorToX(int cursorPos, QTextLine::Edge edge = …) const
.
This is an overloaded function.
sourcepub unsafe fn cursor_to_x_int(&self, cursor_pos: *mut c_int) -> c_double
pub unsafe fn cursor_to_x_int(&self, cursor_pos: *mut c_int) -> c_double
Converts the cursor position cursorPos to the corresponding x position inside the line, taking account of the edge.
Calls C++ function: double QTextLine::cursorToX(int* cursorPos) 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().
sourcepub unsafe fn cursor_to_x_int2(&self, cursor_pos: c_int) -> c_double
pub unsafe fn cursor_to_x_int2(&self, cursor_pos: c_int) -> c_double
This is an overloaded function.
Calls C++ function: double QTextLine::cursorToX(int cursorPos) const
.
This is an overloaded function.
sourcepub unsafe fn descent(&self) -> c_double
pub unsafe fn descent(&self) -> c_double
Returns the line's descent.
Calls C++ function: double QTextLine::descent() const
.
sourcepub unsafe fn draw_3a(
&self,
p: impl CastInto<Ptr<QPainter>>,
point: impl CastInto<Ref<QPointF>>,
selection: impl CastInto<Ptr<FormatRange>>
)
pub unsafe fn draw_3a( &self, p: impl CastInto<Ptr<QPainter>>, point: impl CastInto<Ref<QPointF>>, selection: impl CastInto<Ptr<FormatRange>> )
Draws a line on the given painter at the specified position. The selection is reserved for internal use.
Calls C++ function: void QTextLine::draw(QPainter* p, const QPointF& point, const QTextLayout::FormatRange* selection = …) const
.
Draws a line on the given painter at the specified position. The selection is reserved for internal use.
sourcepub unsafe fn draw_2a(
&self,
p: impl CastInto<Ptr<QPainter>>,
point: impl CastInto<Ref<QPointF>>
)
pub unsafe fn draw_2a( &self, p: impl CastInto<Ptr<QPainter>>, point: impl CastInto<Ref<QPointF>> )
Draws a line on the given painter at the specified position. The selection is reserved for internal use.
Calls C++ function: void QTextLine::draw(QPainter* p, const QPointF& point) const
.
Draws a line on the given painter at the specified position. The selection is reserved for internal use.
sourcepub unsafe fn glyph_runs_2a(
&self,
from: c_int,
length: c_int
) -> CppBox<QListOfQGlyphRun>
pub unsafe fn glyph_runs_2a( &self, from: c_int, length: c_int ) -> CppBox<QListOfQGlyphRun>
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().
Calls C++ function: QList<QGlyphRun> QTextLine::glyphRuns(int from = …, int length = …) 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().
sourcepub unsafe fn glyph_runs_1a(&self, from: c_int) -> CppBox<QListOfQGlyphRun>
pub unsafe fn glyph_runs_1a(&self, from: c_int) -> CppBox<QListOfQGlyphRun>
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().
Calls C++ function: QList<QGlyphRun> QTextLine::glyphRuns(int from = …) 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().
sourcepub unsafe fn glyph_runs_0a(&self) -> CppBox<QListOfQGlyphRun>
pub unsafe fn glyph_runs_0a(&self) -> CppBox<QListOfQGlyphRun>
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().
Calls C++ function: QList<QGlyphRun> QTextLine::glyphRuns() 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().
sourcepub unsafe fn height(&self) -> c_double
pub unsafe fn height(&self) -> c_double
sourcepub unsafe fn horizontal_advance(&self) -> c_double
pub unsafe fn horizontal_advance(&self) -> c_double
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.
Calls C++ function: double 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.
sourcepub unsafe fn is_valid(&self) -> bool
pub unsafe fn is_valid(&self) -> bool
Returns true
if this text line is valid; otherwise returns false
.
Calls C++ function: bool QTextLine::isValid() const
.
Returns true
if this text line is valid; otherwise returns false
.
sourcepub unsafe fn leading(&self) -> c_double
pub unsafe fn leading(&self) -> c_double
Returns the line's leading.
Calls C++ function: double QTextLine::leading() const
.
sourcepub unsafe fn leading_included(&self) -> bool
pub unsafe fn leading_included(&self) -> bool
Returns true
if positive leading is included into the line's height; otherwise returns false
.
Calls C++ function: 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().
sourcepub unsafe fn line_number(&self) -> c_int
pub unsafe fn line_number(&self) -> c_int
Returns the position of the line in the text engine.
Calls C++ function: int QTextLine::lineNumber() const
.
Returns the position of the line in the text engine.
sourcepub unsafe fn natural_text_rect(&self) -> CppBox<QRectF>
pub unsafe fn natural_text_rect(&self) -> CppBox<QRectF>
Returns the rectangle covered by the line.
Calls C++ function: QRectF QTextLine::naturalTextRect() const
.
Returns the rectangle covered by the line.
sourcepub unsafe fn natural_text_width(&self) -> c_double
pub unsafe fn natural_text_width(&self) -> c_double
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.
Calls C++ function: double 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.
sourcepub unsafe fn new() -> CppBox<QTextLine>
pub unsafe fn new() -> CppBox<QTextLine>
Creates an invalid line.
Calls C++ function: [constructor] void QTextLine::QTextLine()
.
Creates an invalid line.
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QTextLine>>
) -> CppBox<QTextLine>
pub unsafe fn new_copy( other: impl CastInto<Ref<QTextLine>> ) -> CppBox<QTextLine>
The QTextLine class represents a line of text inside a QTextLayout.
Calls C++ function: [constructor] void QTextLine::QTextLine(const QTextLine& other)
.
The QTextLine class represents a line of text inside a QTextLayout.
A text line is usually created by QTextLayout::createLine().
After being created, the line can be filled using the setLineWidth() or setNumColumns() functions. A line has a number of attributes including the rectangle it occupies, rect(), its coordinates, x() and y(), its textLength(), width() and naturalTextWidth(), and its ascent() and descent() relative to the text. The position of the cursor in terms of the line is available from cursorToX() and its inverse from xToCursor(). A line can be moved with setPosition().
sourcepub unsafe fn position(&self) -> CppBox<QPointF>
pub unsafe fn position(&self) -> CppBox<QPointF>
Returns the line's position relative to the text layout's position.
Calls C++ function: QPointF QTextLine::position() const
.
Returns the line’s position relative to the text layout’s position.
See also setPosition().
sourcepub unsafe fn rect(&self) -> CppBox<QRectF>
pub unsafe fn rect(&self) -> CppBox<QRectF>
Returns the line's bounding rectangle.
Calls C++ function: QRectF QTextLine::rect() const
.
Returns the line’s bounding rectangle.
See also x(), y(), textLength(), and width().
sourcepub unsafe fn set_leading_included(&self, included: bool)
pub unsafe fn set_leading_included(&self, included: bool)
Includes positive leading into the line's height if included is true; otherwise does not include leading.
Calls C++ function: 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().
sourcepub unsafe fn set_line_width(&self, width: c_double)
pub unsafe fn set_line_width(&self, width: c_double)
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.
Calls C++ function: void QTextLine::setLineWidth(double 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.
sourcepub unsafe fn set_num_columns_1a(&self, columns: c_int)
pub unsafe fn set_num_columns_1a(&self, columns: c_int)
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.
Calls C++ function: void QTextLine::setNumColumns(int columns)
.
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.
sourcepub unsafe fn set_num_columns_2a(
&self,
columns: c_int,
alignment_width: c_double
)
pub unsafe fn set_num_columns_2a( &self, columns: c_int, alignment_width: c_double )
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.
Calls C++ function: void QTextLine::setNumColumns(int columns, double 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.
sourcepub unsafe fn set_position(&self, pos: impl CastInto<Ref<QPointF>>)
pub unsafe fn set_position(&self, pos: impl CastInto<Ref<QPointF>>)
Moves the line to position pos.
Calls C++ function: void QTextLine::setPosition(const QPointF& pos)
.
Moves the line to position pos.
See also position().
sourcepub unsafe fn text_length(&self) -> c_int
pub unsafe fn text_length(&self) -> c_int
Returns the length of the text in the line.
Calls C++ function: int QTextLine::textLength() const
.
Returns the length of the text in the line.
See also naturalTextWidth().
sourcepub unsafe fn text_start(&self) -> c_int
pub unsafe fn text_start(&self) -> c_int
Returns the start of the line from the beginning of the string passed to the QTextLayout.
Calls C++ function: int QTextLine::textStart() const
.
Returns the start of the line from the beginning of the string passed to the QTextLayout.
sourcepub unsafe fn width(&self) -> c_double
pub unsafe fn width(&self) -> c_double
Returns the line's width as specified by the layout() function.
Calls C++ function: double QTextLine::width() const
.
Returns the line’s width as specified by the layout() function.
See also naturalTextWidth(), x(), y(), textLength(), and rect().
sourcepub unsafe fn x(&self) -> c_double
pub unsafe fn x(&self) -> c_double
Returns the line's x position.
Calls C++ function: double QTextLine::x() const
.
Returns the line’s x position.
See also rect(), y(), textLength(), and width().
sourcepub unsafe fn x_to_cursor_2a(&self, x: c_double, arg2: CursorPosition) -> c_int
pub unsafe fn x_to_cursor_2a(&self, x: c_double, arg2: CursorPosition) -> c_int
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.
Calls C++ function: int QTextLine::xToCursor(double x, QTextLine::CursorPosition arg2 = …) 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().
sourcepub unsafe fn x_to_cursor_1a(&self, x: c_double) -> c_int
pub unsafe fn x_to_cursor_1a(&self, x: c_double) -> c_int
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.
Calls C++ function: int QTextLine::xToCursor(double x) 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().
Trait Implementations§
source§impl CppDeletable for QTextLine
impl CppDeletable for QTextLine
source§unsafe fn delete(&self)
unsafe fn delete(&self)
The QTextLine class represents a line of text inside a QTextLayout.
Calls C++ function: [destructor] void QTextLine::~QTextLine()
.
The QTextLine class represents a line of text inside a QTextLayout.
A text line is usually created by QTextLayout::createLine().
After being created, the line can be filled using the setLineWidth() or setNumColumns() functions. A line has a number of attributes including the rectangle it occupies, rect(), its coordinates, x() and y(), its textLength(), width() and naturalTextWidth(), and its ascent() and descent() relative to the text. The position of the cursor in terms of the line is available from cursorToX() and its inverse from xToCursor(). A line can be moved with setPosition().