Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QTextTable Class Reference
[QtGui module]

The QTextTable class represents a table in a QTextDocument. More...

 #include <QTextTable>

Inherits QTextFrame.

Public Functions

  • QTextTableCell cellAt ( int row, int column ) const
  • QTextTableCell cellAt ( int position ) const
  • QTextTableCell cellAt ( const QTextCursor & cursor ) const
  • int columns () const
  • QTextTableFormat format () const
  • void insertColumns ( int index, int columns )
  • void insertRows ( int index, int rows )
  • void mergeCells ( int row, int column, int numRows, int numCols )
  • void mergeCells ( const QTextCursor & cursor )
  • void removeColumns ( int index, int columns )
  • void removeRows ( int index, int rows )
  • void resize ( int rows, int columns )
  • QTextCursor rowEnd ( const QTextCursor & cursor ) const
  • QTextCursor rowStart ( const QTextCursor & cursor ) const
  • int rows () const
  • void setFormat ( const QTextTableFormat & format )
  • void splitCell ( int row, int column, int numRows, int numCols )

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 5 static public members inherited from QObject
  • 1 protected function inherited from QTextObject
  • 7 protected functions inherited from QObject

Detailed Description

The QTextTable class represents a table in a QTextDocument.

A table is a group of cells ordered into rows and columns. Each table contains at least one row and one column. Each cell contains a block, and is surrounded by a frame.

Tables are usually created and inserted into a document with the QTextCursor::insertTable() function. For example, we can insert a table with three rows and two columns at the current cursor position in an editor using the following lines of code:

     QTextCursor cursor(editor->textCursor());
     cursor.movePosition(QTextCursor::Start);

     QTextTable *table = cursor.insertTable(rows, columns, tableFormat);

The table format is either defined when the table is created or changed later with setFormat().

The table currently being edited by the cursor is found with QTextCursor::currentTable(). This allows its format or dimensions to be changed after it has been inserted into a document.

A table's size can be changed with resize(), or by using insertRows(), insertColumns(), removeRows(), or removeColumns(). Use cellAt() to retrieve table cells.

The starting and ending positions of table rows can be found by moving a cursor within a table, and using the rowStart() and rowEnd() functions to obtain cursors at the start and end of each row.

See also QTextTableFormat.


Member Function Documentation

QTextTableCell QTextTable::cellAt ( int row, int column ) const

Returns the table cell at the given row and column in the table.

See also columns() and rows().

QTextTableCell QTextTable::cellAt ( int position ) const

This is an overloaded member function, provided for convenience.

Returns the table cell that contains the character at the given position in the document.

QTextTableCell QTextTable::cellAt ( const QTextCursor & cursor ) const

This is an overloaded member function, provided for convenience.

Returns the table cell containing the given cursor.

int QTextTable::columns () const

Returns the number of columns in the table.

See also rows().

QTextTableFormat QTextTable::format () const

Returns the table's format.

See also setFormat().

void QTextTable::insertColumns ( int index, int columns )

Inserts a number of columns before the column with the specified index.

See also insertRows(), resize(), removeRows(), and removeColumns().

void QTextTable::insertRows ( int index, int rows )

Inserts a number of rows before the row with the specified index.

See also resize(), insertColumns(), removeRows(), and removeColumns().

void QTextTable::mergeCells ( int row, int column, int numRows, int numCols )

Merges the cell at the specified row and column with the adjacent cells into one cell. The new cell will span numRows rows and numCols columns. If numRows or numCols is less than the current number of rows or columns the cell spans then this method does nothing.

This function was introduced in Qt 4.1.

void QTextTable::mergeCells ( const QTextCursor & cursor )

This is an overloaded member function, provided for convenience.

Merges the cells selected by the provided cursor.

This function was introduced in Qt 4.1.

void QTextTable::removeColumns ( int index, int columns )

Removes a number of columns starting with the column at the specified index.

See also insertRows(), insertColumns(), removeRows(), and resize().

void QTextTable::removeRows ( int index, int rows )

Removes a number of rows starting with the row at the specified index.

See also insertRows(), insertColumns(), resize(), and removeColumns().

void QTextTable::resize ( int rows, int columns )

Resizes the table to contain the required number of rows and columns.

See also insertRows(), insertColumns(), removeRows(), and removeColumns().

QTextCursor QTextTable::rowEnd ( const QTextCursor & cursor ) const

Returns a cursor pointing to the end of the row that contains the given cursor.

See also rowStart().

QTextCursor QTextTable::rowStart ( const QTextCursor & cursor ) const

Returns a cursor pointing to the start of the row that contains the given cursor.

See also rowEnd().

int QTextTable::rows () const

Returns the number of rows in the table.

See also columns().

void QTextTable::setFormat ( const QTextTableFormat & format )

Sets the table's format.

See also format().

void QTextTable::splitCell ( int row, int column, int numRows, int numCols )

Splits the specified cell at row and column into an array of multiple cells with dimensions specified by numRows and numCols.

This function was introduced in Qt 4.1.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 59
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Labs au hasard

Logo

Construire l'avenir : (ré-)introduction aux composants de Qt Quick

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web