Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtGui.QTextLine Class Reference

The QTextLine class represents a line of text inside a QTextLayout. More...

Inheritance diagram for QtGui.QTextLine:
Collaboration diagram for QtGui.QTextLine:

Public Types

enum  CursorPosition { CursorBetweenCharacters = 0, CursorOnCharacter = 1 }
 
enum  Edge { Leading = 0, Trailing = 1 }
 

Public Member Functions

 QTextLine ()
  More...
 
 QTextLine (QTextLine copy)
 
virtual void CreateProxy ()
 
new double CursorToX (ref int cursorPos, QTextLine.Edge edge=QTextLine.Edge.Leading)
  More...
 
new double CursorToX (int cursorPos, QTextLine.Edge edge=QTextLine.Edge.Leading)
  More...
 
new void Draw (QPainter p, QPointF point, QTextLayout.FormatRange selection=null)
  More...
 
new void SetLineWidth (double width)
  More...
 
new void SetNumColumns (int columns)
  More...
 
new void SetNumColumns (int columns, double alignmentWidth)
  More...
 
new int XToCursor (double x, QTextLine.CursorPosition cpos=QTextLine.CursorPosition.CursorBetweenCharacters)
  More...
 
new void Dispose ()
 

Protected Member Functions

 QTextLine (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

bool LeadingIncluded [get, set]
  More...
 
QPointF Position [get, set]
  More...
 
double Ascent [get]
  More...
 
double Descent [get]
  More...
 
double Height [get]
  More...
 
double HorizontalAdvance [get]
  More...
 
bool IsValid [get]
  More...
 
double Leading [get]
  More...
 
int LineNumber [get]
  More...
 
QRectF NaturalTextRect [get]
  More...
 
double NaturalTextWidth [get]
  More...
 
QRectF Rect [get]
  More...
 
int TextLength [get]
  More...
 
int TextStart [get]
  More...
 
double Width [get]
  More...
 
double X [get]
  More...
 
double Y [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

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

Member Enumeration Documentation

Enumerator
CursorBetweenCharacters 
CursorOnCharacter 
Enumerator
Leading 
Trailing 

Constructor & Destructor Documentation

QtGui.QTextLine.QTextLine ( System.Type  dummy)
protected
QtGui.QTextLine.QTextLine ( )

Creates an invalid line.

Here is the call graph for this function:

QtGui.QTextLine.QTextLine ( QTextLine  copy)

Here is the call graph for this function:

Member Function Documentation

virtual void QtGui.QTextLine.CreateProxy ( )
virtual

Here is the caller graph for this function:

new double QtGui.QTextLine.CursorToX ( ref int  cursorPos,
QTextLine.Edge  edge = QTextLine.Edge.Leading 
)

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 cpos will be modified to point to this valid cursor position.

See also xToCursor().

new double QtGui.QTextLine.CursorToX ( int  cursorPos,
QTextLine.Edge  edge = QTextLine.Edge.Leading 
)

This is an overloaded function.

new void QtGui.QTextLine.Dispose ( )
new void QtGui.QTextLine.Draw ( QPainter  p,
QPointF  point,
QTextLayout.FormatRange  selection = null 
)

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

new void QtGui.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.

new void QtGui.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.

new void QtGui.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.

new int QtGui.QTextLine.XToCursor ( double  x,
QTextLine.CursorPosition  cpos = QTextLine.CursorPosition.CursorBetweenCharacters 
)

Converts the x-coordinate x, to the nearest matching cursor position, depending on the cursor position type, cpos.

See also cursorToX().

Member Data Documentation

SmokeInvocation QtGui.QTextLine.interceptor
protected

Property Documentation

double QtGui.QTextLine.Ascent
get

Returns the line's ascent.

See also descent() and height().

double QtGui.QTextLine.Descent
get

Returns the line's descent.

See also ascent() and height().

double QtGui.QTextLine.Height
get

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

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

double QtGui.QTextLine.HorizontalAdvance
get

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.

bool QtGui.QTextLine.IsValid
get

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

double QtGui.QTextLine.Leading
get

Returns the line's leading.

This function was introduced in Qt 4.6.

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

bool QtGui.QTextLine.LeadingIncluded
getset

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.

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.

int QtGui.QTextLine.LineNumber
get

Returns the position of the line in the text engine.

QRectF QtGui.QTextLine.NaturalTextRect
get

Returns the rectangle covered by the line.

double QtGui.QTextLine.NaturalTextWidth
get

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.

QPointF QtGui.QTextLine.Position
getset

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

Moves the line to position pos.

QRectF QtGui.QTextLine.Rect
get

Returns the line's bounding rectangle.

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

virtual System.IntPtr QtGui.QTextLine.SmokeObject
getset
int QtGui.QTextLine.TextLength
get

Returns the length of the text in the line.

See also naturalTextWidth().

int QtGui.QTextLine.TextStart
get

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

double QtGui.QTextLine.Width
get

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

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

double QtGui.QTextLine.X
get

Returns the line's x position.

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

double QtGui.QTextLine.Y
get

Returns the line's y position.

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