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  · 

QTableWidgetItem Class Reference
[QtGui module]

The QTableWidgetItem class provides an item for use with the QTableWidget class. More...

#include <QTableWidgetItem>

Public Functions

Static Public Members

Related Non-Members

  • QDataStream & operator<< ( QDataStream & out, const QTableWidgetItem & item )
  • QDataStream & operator>> ( QDataStream & in, QTableWidgetItem & item )

Detailed Description

The QTableWidgetItem class provides an item for use with the QTableWidget class.

Table items are used to hold pieces of information for table widgets. Items usually contain text, icons, or checkboxes

The QTableWidgetItem class is a convenience class that replaces the QTableItem class in Qt 3. It provides an item for use with the QTableWidget class.

Items are usually constructed with a table widget as their parent then inserted at a particular position specified by row and column numbers:

        QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
            pow(row, column+1)));
        tableWidget->setItem(row, column, newItem);

Each item can have its own background color which is set with the setBackgroundColor() function. The current background color can be found with backgroundColor(). The text label for each item can be rendered with its own font and text color. These are specified with the setFont() and setTextColor() functions, and read with font() and textColor().

Items can be made checkable by setting the appropriate flag value with the setFlags() function. The current state of the item's flags can be read with flags().

See also QTableWidget.


Member Function Documentation

QTableWidgetItem::QTableWidgetItem ( int type = Type )

Constructs a table item of the specified type that does not belong to any table.

See also type().

QTableWidgetItem::QTableWidgetItem ( const QString & text, int type = Type )

Constructs a table item with the given text.

See also type().

QTableWidgetItem::~QTableWidgetItem ()   [virtual]

Destroys the table item.

QColor QTableWidgetItem::backgroundColor () const

Returns the color used to render the item's background.

See also textColor() and setBackgroundColor().

Qt::CheckState QTableWidgetItem::checkState () const

Returns the checked state of the list item (see Qt::CheckState).

See also setCheckState() and flags().

QTableWidgetItem * QTableWidgetItem::clone () const   [virtual]

Creates an exact copy of the item.

QVariant QTableWidgetItem::data ( int role ) const   [virtual]

Returns the item's data for the given role.

See also setData().

Qt::ItemFlags QTableWidgetItem::flags () const

Returns the flags used to describe the item. These determine whether the item can be checked, edited, and selected.

See also setFlags().

QFont QTableWidgetItem::font () const

Returns the font used to render the item's text.

See also setFont().

QIcon QTableWidgetItem::icon () const

Returns the item's icon.

See also setIcon().

void QTableWidgetItem::read ( QDataStream & in )   [virtual]

Reads the item from stream in.

See also write().

void QTableWidgetItem::setBackgroundColor ( const QColor & color )

Sets the item's background color to the specified color.

See also backgroundColor() and setTextColor().

void QTableWidgetItem::setCheckState ( Qt::CheckState state )

Sets the check state of the table item to be state.

See also checkState().

void QTableWidgetItem::setData ( int role, const QVariant & value )   [virtual]

Sets the item's data for the given role to the specified value.

See also data().

void QTableWidgetItem::setFlags ( Qt::ItemFlags flags )

Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.

See also flags().

void QTableWidgetItem::setFont ( const QFont & font )

Sets the font used to display the item's text to the given font.

See also font(), setText(), and setTextColor().

void QTableWidgetItem::setIcon ( const QIcon & icon )

Sets the item's icon to the icon specified.

See also icon() and setText().

void QTableWidgetItem::setStatusTip ( const QString & statusTip )

Sets the item's status tip to the string specified by statusTip.

See also statusTip(), setToolTip(), and setWhatsThis().

void QTableWidgetItem::setText ( const QString & text )

Sets the item's text to the text specified.

See also text(), setFont(), and setTextColor().

void QTableWidgetItem::setTextAlignment ( int alignment )

Sets the text alignment for the item's text to the alignment specified (see Qt::AlignmentFlag).

See also textAlignment().

void QTableWidgetItem::setTextColor ( const QColor & color )

Sets the color used to display the item's text to the given color.

See also textColor(), setFont(), and setText().

void QTableWidgetItem::setToolTip ( const QString & toolTip )

Sets the item's tooltip to the string specified by toolTip.

See also toolTip(), setStatusTip(), and setWhatsThis().

void QTableWidgetItem::setWhatsThis ( const QString & whatsThis )

Sets the item's "What's This?" help to the string specified by whatsThis.

See also whatsThis(), setStatusTip(), and setToolTip().

QString QTableWidgetItem::statusTip () const

Returns the item's status tip.

See also setStatusTip().

QTableWidget * QTableWidgetItem::tableWidget () const

Returns the table widget that contains the item.

QString QTableWidgetItem::text () const

Returns the item's text.

See also setText().

int QTableWidgetItem::textAlignment () const

Returns the text alignment for the item's text (see Qt::AlignmentFlag).

See also setTextAlignment().

QColor QTableWidgetItem::textColor () const

Returns the color used to render the item's text.

See also backgroundColor() and setTextColor().

QString QTableWidgetItem::toolTip () const

Returns the item's tooltip.

See also setToolTip().

int QTableWidgetItem::type () const

Returns the type passed to the QTableWidgetItem constructor.

QString QTableWidgetItem::whatsThis () const

Returns the item's "What's This?" help.

See also setWhatsThis().

void QTableWidgetItem::write ( QDataStream & out ) const   [virtual]

Writes the item to stream out.

See also read().

bool QTableWidgetItem::operator< ( const QTableWidgetItem & other ) const   [virtual]

Returns true if the item is less than the other item; otherwise returns false.

QTableWidgetItem & QTableWidgetItem::operator= ( const QTableWidgetItem & other )

Assigns other's data and flags to this item. Note that type() and tableWidget() are not copied.

This function is useful when reimplementing clone().

See also data() and flags().


Member Variable Documentation

const int QTableWidgetItem::Type

The default type for table widget items.

See also UserType and type().

const int QTableWidgetItem::UserType

The minimum value for custom types. Values below UserType are reserved by Qt.

See also Type and type().


Related Non-Members

QDataStream & operator<< ( QDataStream & out, const QTableWidgetItem & item )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Writes the table widget item item to stream out.

This operator uses QTableWidgetItem::write().

See also Format of the QDataStream Operators.

QDataStream & operator>> ( QDataStream & in, QTableWidgetItem & item )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Reads a table widget item from stream in into item.

This operator uses QTableWidgetItem::read().

See also Format of the QDataStream Operators.

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. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  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.0
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