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

The QTextBlock class provides a container for text fragments in a QTextDocument. More...

Inheritance diagram for QtGui.QTextBlock:
Collaboration diagram for QtGui.QTextBlock:

Classes

class  iterator
 The QTextBlock::iterator class provides an iterator for reading the contents of a QTextBlock. More...
 

Public Member Functions

override bool Equals (object o)
 
override int GetHashCode ()
 
 QTextBlock ()
 
 QTextBlock (QTextBlock o)
  More...
 
virtual void CreateProxy ()
 
new QTextBlock.iterator Begin ()
  More...
 
new void ClearLayout ()
  More...
 
new bool Contains (int position)
  More...
 
new QTextBlock.iterator End ()
  More...
 
new void SetVisible (bool visible)
  More...
 
new void Dispose ()
 

Static Public Member Functions

static bool operator!= (QTextBlock one, QTextBlock o)
  More...
 
static bool operator< (QTextBlock one, QTextBlock o)
  More...
 
static bool operator== (QTextBlock one, QTextBlock o)
  More...
 
static bool operator> (QTextBlock one, QTextBlock o)
 

Protected Member Functions

 QTextBlock (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

int LineCount [get, set]
  More...
 
int Revision [get, set]
  More...
 
QTextBlockUserData UserData [get, set]
  More...
 
int UserState [get, set]
  More...
 
QTextBlockFormat BlockFormat [get]
  More...
 
int BlockFormatIndex [get]
  More...
 
int BlockNumber [get]
  More...
 
QTextCharFormat CharFormat [get]
  More...
 
int CharFormatIndex [get]
  More...
 
QTextDocument Document [get]
  More...
 
int FirstLineNumber [get]
  More...
 
int FragmentIndex [get]
 
bool IsValid [get]
  More...
 
bool IsVisible [get]
  More...
 
QTextLayout Layout [get]
  More...
 
int Length [get]
  More...
 
QTextBlock Next [get]
  More...
 
int Position [get]
  More...
 
QTextBlock Previous [get]
  More...
 
string Text [get]
  More...
 
Qt.LayoutDirection TextDirection [get]
  More...
 
QTextList TextList [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QTextBlock class provides a container for text fragments in a QTextDocument.

A text block encapsulates a block or paragraph of text in a QTextDocument. QTextBlock provides read-only access to the block/paragraph structure of QTextDocuments. It is mainly of use if you want to implement your own layouts for the visual representation of a QTextDocument, or if you want to iterate over a document and write out the contents in your own custom format.

Text blocks are created by their parent documents. If you need to create a new text block, or modify the contents of a document while examining its contents, use the cursor-based interface provided by QTextCursor instead.

Each text block is located at a specific position() in a document(). The contents of the block can be obtained by using the text() function. The length() function determines the block's size within the document (including formatting characters). The visual properties of the block are determined by its text layout(), its charFormat(), and its blockFormat().

The next() and previous() functions enable iteration over consecutive valid blocks in a document under the condition that the document is not modified by other means during the iteration process. Note that, although blocks are returned in sequence, adjacent blocks may come from different places in the document structure. The validity of a block can be determined by calling isValid().

QTextBlock provides comparison operators to make it easier to work with blocks: operator==() compares two block for equality, operator!=() compares two blocks for inequality, and operator<() determines whether a block precedes another in the same document.

See also QTextBlockFormat, QTextCharFormat, and QTextFragment.

Constructor & Destructor Documentation

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

Here is the call graph for this function:

Here is the caller graph for this function:

QtGui.QTextBlock.QTextBlock ( QTextBlock  o)

Copies the other text block's attributes to this text block.

Here is the call graph for this function:

Member Function Documentation

new QTextBlock.iterator QtGui.QTextBlock.Begin ( )

Returns a text block iterator pointing to the beginning of the text block.

See also end().

new void QtGui.QTextBlock.ClearLayout ( )

Clears the QTextLayout that is used to lay out and display the block's contents.

This function was introduced in Qt 4.4.

See also layout().

new bool QtGui.QTextBlock.Contains ( int  position)

Returns true if the given position is located within the text block; otherwise returns false.

virtual void QtGui.QTextBlock.CreateProxy ( )
virtual

Here is the caller graph for this function:

new void QtGui.QTextBlock.Dispose ( )
new QTextBlock.iterator QtGui.QTextBlock.End ( )

Returns a text block iterator pointing to the end of the text block.

See also begin(), next(), and previous().

override bool QtGui.QTextBlock.Equals ( object  o)

Here is the call graph for this function:

override int QtGui.QTextBlock.GetHashCode ( )
static bool QtGui.QTextBlock.operator!= ( QTextBlock  one,
QTextBlock  o 
)
static

Returns true if this text block is different from the other text block.

static bool QtGui.QTextBlock.operator< ( QTextBlock  one,
QTextBlock  o 
)
static

Returns true if this text block occurs before the other text block in the document.

static bool QtGui.QTextBlock.operator== ( QTextBlock  one,
QTextBlock  o 
)
static

Returns true if this text block is the same as the other text block.

static bool QtGui.QTextBlock.operator> ( QTextBlock  one,
QTextBlock  o 
)
static
new void QtGui.QTextBlock.SetVisible ( bool  visible)

Sets the block's visibility to visible.

This function was introduced in Qt 4.4.

See also isVisible().

Member Data Documentation

SmokeInvocation QtGui.QTextBlock.interceptor
protected

Property Documentation

QTextBlockFormat QtGui.QTextBlock.BlockFormat
get

Returns the QTextBlockFormat that describes block-specific properties.

See also charFormat().

int QtGui.QTextBlock.BlockFormatIndex
get

Returns an index into the document's internal list of block formats for the text block's format.

See also QTextDocument::allFormats().

int QtGui.QTextBlock.BlockNumber
get

Returns the number of this block, or -1 if the block is invalid.

This function was introduced in Qt 4.4.

See also QTextCursor::blockNumber().

QTextCharFormat QtGui.QTextBlock.CharFormat
get

Returns the QTextCharFormat that describes the block's character format. The block's character format is used when inserting text into an empty block.

See also blockFormat().

int QtGui.QTextBlock.CharFormatIndex
get

Returns an index into the document's internal list of character formats for the text block's character format.

See also QTextDocument::allFormats().

QTextDocument QtGui.QTextBlock.Document
get

Returns the text document this text block belongs to, or 0 if the text block does not belong to any document.

int QtGui.QTextBlock.FirstLineNumber
get

Returns the first line number of this block, or -1 if the block is invalid. Unless the layout supports it, the line number is identical to the block number.

This function was introduced in Qt 4.5.

See also QTextBlock::blockNumber().

int QtGui.QTextBlock.FragmentIndex
get
bool QtGui.QTextBlock.IsValid
get

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

bool QtGui.QTextBlock.IsVisible
get

Returns true if the block is visible; otherwise returns false.

This function was introduced in Qt 4.4.

See also setVisible().

QTextLayout QtGui.QTextBlock.Layout
get

Returns the QTextLayout that is used to lay out and display the block's contents.

Note that the returned QTextLayout object can only be modified from the documentChanged implementation of a QAbstractTextDocumentLayout subclass. Any changes applied from the outside cause undefined behavior.

See also clearLayout().

int QtGui.QTextBlock.Length
get

Returns the length of the block in characters.

Note: The length returned includes all formatting characters, for example, newline.

See also text(), charFormat(), and blockFormat().

int QtGui.QTextBlock.LineCount
getset

Returns the line count. Not all document layouts support this feature.

This function was introduced in Qt 4.5.

Sets the line count to count.

This function was introduced in Qt 4.5.

QTextBlock QtGui.QTextBlock.Next
get

Returns the text block in the document after this block, or an empty text block if this is the last one.

Note that the next block may be in a different frame or table to this block.

See also previous(), begin(), and end().

int QtGui.QTextBlock.Position
get

Returns the index of the block's first character within the document.

QTextBlock QtGui.QTextBlock.Previous
get

Returns the text block in the document before this block, or an empty text block if this is the first one.

Note that the next block may be in a different frame or table to this block.

See also next(), begin(), and end().

int QtGui.QTextBlock.Revision
getset

Returns the blocks revision.

This function was introduced in Qt 4.4.

Sets a blocks revision to rev.

This function was introduced in Qt 4.4.

virtual System.IntPtr QtGui.QTextBlock.SmokeObject
getset
string QtGui.QTextBlock.Text
get

Returns the block's contents as plain text.

See also length(), charFormat(), and blockFormat().

Qt.LayoutDirection QtGui.QTextBlock.TextDirection
get

Returns the resolved text direction.

If the block has no explicit direction set, it will resolve the direction from the blocks content. Returns either Qt::LeftToRight or Qt::RightToLeft.

This function was introduced in Qt 4.7.

See also QTextFormat::layoutDirection(), QString::isRightToLeft(), and Qt::LayoutDirection.

QTextList QtGui.QTextBlock.TextList
get

If the block represents a list item, returns the list that the item belongs to; otherwise returns 0.

QTextBlockUserData QtGui.QTextBlock.UserData
getset

Returns a pointer to a QTextBlockUserData object if previously set with setUserData() or a null pointer.

This function was introduced in Qt 4.1.

Attaches the given data object to the text block.

QTextBlockUserData can be used to store custom settings. The ownership is passed to the underlying text document, i.e. the provided QTextBlockUserData object will be deleted if the corresponding text block gets deleted. The user data object is not stored in the undo history, so it will not be available after undoing the deletion of a text block.

For example, if you write a programming editor in an IDE, you may want to let your user set breakpoints visually in your code for an integrated debugger. In a programming editor a line of text usually corresponds to one QTextBlock. The QTextBlockUserData interface allows the developer to store data for each QTextBlock, like for example in which lines of the source code the user has a breakpoint set. Of course this could also be stored externally, but by storing it inside the QTextDocument, it will for example be automatically deleted when the user deletes the associated line. It's really just a way to store custom information in the QTextDocument without using custom properties in QTextFormat which would affect the undo/redo stack.

This function was introduced in Qt 4.1.

int QtGui.QTextBlock.UserState
getset

Returns the integer value previously set with setUserState() or -1.

This function was introduced in Qt 4.1.

Stores the specified state integer value in the text block. This may be useful for example in a syntax highlighter to store a text parsing state.

This function was introduced in Qt 4.1.