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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Q3CheckListItem Class Reference

The Q3CheckListItem class provides checkable list view items. More...

 #include <Q3CheckListItem>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits: Q3ListViewItem.

Public Types

enum ToggleState { Off, NoChange, On }
enum Type { RadioButton, CheckBox, RadioButtonController, CheckBoxController }

Public Functions

Q3CheckListItem ( Q3CheckListItem * parent, const QString & text, Type tt = RadioButtonController )
Q3CheckListItem ( Q3CheckListItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )
Q3CheckListItem ( Q3ListViewItem * parent, const QString & text, Type tt = RadioButtonController )
Q3CheckListItem ( Q3ListViewItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )
Q3CheckListItem ( Q3ListView * parent, const QString & text, Type tt = RadioButtonController )
Q3CheckListItem ( Q3ListView * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )
Q3CheckListItem ( Q3ListViewItem * parent, const QString & text, const QPixmap & p )
Q3CheckListItem ( Q3ListView * parent, const QString & text, const QPixmap & p )
~Q3CheckListItem ()
bool isOn () const
bool isTristate () const
virtual void setOn ( bool b )
void setState ( ToggleState s )
void setTristate ( bool b )
ToggleState state () const
QString text () const
Type type () const

Reimplemented Public Functions

virtual void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align )
virtual void paintFocus ( QPainter * p, const QColorGroup & cg, const QRect & r )
virtual int rtti () const
virtual void setup ()
virtual QString text ( int n ) const
virtual int width ( const QFontMetrics & fm, const Q3ListView * lv, int column ) const

Protected Functions

virtual void stateChange ( bool b )
void turnOffChild ()

Reimplemented Protected Functions

virtual void activate ()

Detailed Description

The Q3CheckListItem class provides checkable list view items.

Q3CheckListItems are used in Q3ListViews to provide Q3ListViewItems that are checkboxes, radio buttons or controllers.

Checkbox and controller check list items may be inserted at any level in a list view. Radio button check list items must be children of a controller check list item.

The item can be checked or unchecked with setOn(). Its type can be retrieved with type() and its text retrieved with text().

List View Items

See also Q3ListViewItem and Q3ListView.

Member Type Documentation

enum Q3CheckListItem::ToggleState

This enum specifies a Q3CheckListItem's toggle state.

ConstantValue
Q3CheckListItem::Off0
Q3CheckListItem::NoChange1
Q3CheckListItem::On2

enum Q3CheckListItem::Type

This enum type specifies a Q3CheckListItem's type:

ConstantValue
Q3CheckListItem::RadioButton0
Q3CheckListItem::CheckBox1
Q3CheckListItem::RadioButtonControllerController
Q3CheckListItem::CheckBoxController?

Member Function Documentation

Q3CheckListItem::Q3CheckListItem ( Q3CheckListItem * parent, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, text text and of type tt. Note that a RadioButton must be the child of a RadioButtonController, otherwise it will not toggle.

Q3CheckListItem::Q3CheckListItem ( Q3CheckListItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, which is after after in the parent's list of children, and with text text and of type tt. Note that a RadioButton must be the child of a RadioButtonController, otherwise it will not toggle.

Q3CheckListItem::Q3CheckListItem ( Q3ListViewItem * parent, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, text text and of type tt. Note that this item must not be a RadioButton. Radio buttons must be children of a RadioButtonController.

Q3CheckListItem::Q3CheckListItem ( Q3ListViewItem * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, which is after after in the parent's list of children, with text text and of type tt. Note that this item must not be a RadioButton. Radio buttons must be children of a RadioButtonController.

Q3CheckListItem::Q3CheckListItem ( Q3ListView * parent, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, text text and of type tt. Note that tt must not be RadioButton. Radio buttons must be children of a RadioButtonController.

Q3CheckListItem::Q3CheckListItem ( Q3ListView * parent, Q3ListViewItem * after, const QString & text, Type tt = RadioButtonController )

Constructs a checkable item with parent parent, which is after after in the parent's list of children, with text text and of type tt. Note that tt must not be RadioButton. Radio buttons must be children of a RadioButtonController.

Q3CheckListItem::Q3CheckListItem ( Q3ListViewItem * parent, const QString & text, const QPixmap & p )

Constructs a RadioButtonController item with parent parent, text text and pixmap p.

Q3CheckListItem::Q3CheckListItem ( Q3ListView * parent, const QString & text, const QPixmap & p )

Constructs a RadioButtonController item with parent parent, text text and pixmap p.

Q3CheckListItem::~Q3CheckListItem ()

Destroys the item, and all its children to any depth, freeing up all allocated resources.

void Q3CheckListItem::activate () [virtual protected]

Reimplemented from Q3ListViewItem::activate().

Toggle check box or set radio button to on.

bool Q3CheckListItem::isOn () const

Returns true if the item is toggled on; otherwise returns false.

bool Q3CheckListItem::isTristate () const

Returns true if the item is tristate; otherwise returns false.

See also setTristate().

void Q3CheckListItem::paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align ) [virtual]

Reimplemented from Q3ListViewItem::paintCell().

Paints the item using the painter p and the color group cg. The item is in column column, has width width and has alignment align. (See Qt::Alignment for valid alignments.)

void Q3CheckListItem::paintFocus ( QPainter * p, const QColorGroup & cg, const QRect & r ) [virtual]

Reimplemented from Q3ListViewItem::paintFocus().

Draws the focus rectangle r using the color group cg on the painter p.

int Q3CheckListItem::rtti () const [virtual]

Reimplemented from Q3ListViewItem::rtti().

Returns 1.

Make your derived classes return their own values for rtti(), and you can distinguish between list view items. You should use values greater than 1000, to allow for extensions to this class.

void Q3CheckListItem::setOn ( bool b ) [virtual]

Sets the button on if b is true, otherwise sets it off. Maintains radio button exclusivity.

See also isOn().

void Q3CheckListItem::setState ( ToggleState s )

Sets the toggle state of the checklistitem to s. s can be Off, NoChange or On.

Tristate can only be enabled for CheckBox or CheckBoxController, therefore the NoChange only applies to them.

Setting the state to On or Off on a CheckBoxController will recursivly set the states of its children to the same state.

Setting the state to NoChange on a CheckBoxController will make it recursivly recall the previous stored state of its children. If there was no previous stored state the children are all set to On.

See also state().

void Q3CheckListItem::setTristate ( bool b )

Sets tristate to b if the Type is either a CheckBoxController or a CheckBox.

CheckBoxControllers are tristate by default.

See also state() and isTristate().

void Q3CheckListItem::setup () [virtual]

Reimplemented from Q3ListViewItem::setup().

ToggleState Q3CheckListItem::state () const

Returns the state of the item.

See also setState() and Q3CheckListItem::ToggleState.

void Q3CheckListItem::stateChange ( bool b ) [virtual protected]

This virtual function is called when the item changes its state. b is true if the state is On; otherwise the state is Off. NoChange (if tristate is enabled and the type is either CheckBox or CheckBoxController) reports the same as Off, so use state() to determine if the state is actually Off or NoChange.

QString Q3CheckListItem::text () const

Returns the item's text.

QString Q3CheckListItem::text ( int n ) const [virtual]

Reimplemented from Q3ListViewItem::text().

void Q3CheckListItem::turnOffChild () [protected]

If this is a RadioButtonController that has RadioButton children, turn off the child that is on.

Type Q3CheckListItem::type () const

Returns the type of this item.

int Q3CheckListItem::width ( const QFontMetrics & fm, const Q3ListView * lv, int column ) const [virtual]

Reimplemented from Q3ListViewItem::width().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  4. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 12
  5. 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
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le Qt Developer Network au hasard

Logo

Compiler l'add-in Qt de Visual Studio

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. 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.7
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