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  · 

QTreeWidgetItemIterator Class

The QTreeWidgetItemIterator class provides a way to iterate over the items in a QTreeWidget instance. More...

 #include <QTreeWidgetItemIterator>

Public Types

enum IteratorFlag { All, Hidden, NotHidden, Selected, ..., UserFlag }
flags IteratorFlags

Public Functions

QTreeWidgetItemIterator(const QTreeWidgetItemIterator & it)
QTreeWidgetItemIterator(QTreeWidget * widget, IteratorFlags flags = All)
QTreeWidgetItemIterator(QTreeWidgetItem * item, IteratorFlags flags = All)
~QTreeWidgetItemIterator()
QTreeWidgetItem * operator*() const
QTreeWidgetItemIterator & operator++()
const QTreeWidgetItemIterator operator++(int)
QTreeWidgetItemIterator & operator+=(int n)
QTreeWidgetItemIterator & operator--()
const QTreeWidgetItemIterator operator--(int)
QTreeWidgetItemIterator & operator-=(int n)
QTreeWidgetItemIterator & operator=(const QTreeWidgetItemIterator & it)

Detailed Description

The QTreeWidgetItemIterator class provides a way to iterate over the items in a QTreeWidget instance.

The iterator will walk the items in a pre-order traversal order, thus visiting the parent node before it continues to the child nodes.

For example, the following code examples each item in a tree, checking the text in the first column against a user-specified search string:

     QTreeWidgetItemIterator it(treeWidget);
     while (*it) {
         if ((*it)->text(0) == itemText)
             (*it)->setSelected(true);
         ++it;
     }

It is also possible to filter out certain types of node by passing certain flags to the constructor of QTreeWidgetItemIterator.

See also QTreeWidget, Model/View Programming, and QTreeWidgetItem.

Member Type Documentation

enum QTreeWidgetItemIterator::IteratorFlag
flags QTreeWidgetItemIterator::IteratorFlags

These flags can be passed to a QTreeWidgetItemIterator constructor (OR-ed together if more than one is used), so that the iterator will only iterate over items that match the given flags.

ConstantValue
QTreeWidgetItemIterator::All0x00000000
QTreeWidgetItemIterator::Hidden0x00000001
QTreeWidgetItemIterator::NotHidden0x00000002
QTreeWidgetItemIterator::Selected0x00000004
QTreeWidgetItemIterator::Unselected0x00000008
QTreeWidgetItemIterator::Selectable0x00000010
QTreeWidgetItemIterator::NotSelectable0x00000020
QTreeWidgetItemIterator::DragEnabled0x00000040
QTreeWidgetItemIterator::DragDisabled0x00000080
QTreeWidgetItemIterator::DropEnabled0x00000100
QTreeWidgetItemIterator::DropDisabled0x00000200
QTreeWidgetItemIterator::HasChildren0x00000400
QTreeWidgetItemIterator::NoChildren0x00000800
QTreeWidgetItemIterator::Checked0x00001000
QTreeWidgetItemIterator::NotChecked0x00002000
QTreeWidgetItemIterator::Enabled0x00004000
QTreeWidgetItemIterator::Disabled0x00008000
QTreeWidgetItemIterator::Editable0x00010000
QTreeWidgetItemIterator::NotEditable0x00020000
QTreeWidgetItemIterator::UserFlag0x01000000

The IteratorFlags type is a typedef for QFlags<IteratorFlag>. It stores an OR combination of IteratorFlag values.

Member Function Documentation

QTreeWidgetItemIterator::QTreeWidgetItemIterator(const QTreeWidgetItemIterator & it)

Constructs an iterator for the same QTreeWidget as it. The current iterator item is set to point on the current item of it.

QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget * widget, IteratorFlags flags = All)

Constructs an iterator for the given widget that uses the specified flags to determine which items are found during iteration. The iterator is set to point to the first top-level item contained in the widget, or the next matching item if the top-level item doesn't match the flags.

See also QTreeWidgetItemIterator::IteratorFlag.

QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidgetItem * item, IteratorFlags flags = All)

Constructs an iterator for the given item that uses the specified flags to determine which items are found during iteration. The iterator is set to point to item, or the next matching item if item doesn't match the flags.

See also QTreeWidgetItemIterator::IteratorFlag.

QTreeWidgetItemIterator::~QTreeWidgetItemIterator()

Destroys the iterator.

QTreeWidgetItem * QTreeWidgetItemIterator::operator*() const

Dereference operator. Returns a pointer to the current item.

QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator++()

The prefix ++ operator (++it) advances the iterator to the next matching item and returns a reference to the resulting iterator. Sets the current pointer to 0 if the current item is the last matching item.

const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator++(int)

The postfix ++ operator (it++) advances the iterator to the next matching item and returns an iterator to the previously current item.

QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator+=(int n)

Makes the iterator go forward by n matching items. (If n is negative, the iterator goes backward.)

If the current item is beyond the last item, the current item pointer is set to 0. Returns the resulting iterator.

QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator--()

The prefix -- operator (--it) advances the iterator to the previous matching item and returns a reference to the resulting iterator. Sets the current pointer to 0 if the current item is the first matching item.

const QTreeWidgetItemIterator QTreeWidgetItemIterator::operator--(int)

The postfix -- operator (it--) makes the preceding matching item current and returns an iterator to the previously current item.

QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator-=(int n)

Makes the iterator go backward by n matching items. (If n is negative, the iterator goes forward.)

If the current item is ahead of the last item, the current item pointer is set to 0. Returns the resulting iterator.

QTreeWidgetItemIterator & QTreeWidgetItemIterator::operator=(const QTreeWidgetItemIterator & it)

Assignment. Makes a copy of it and returns a reference to its iterator.

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 5.0-snapshot
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