Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QListWidgetItem Class Reference

Inherited by HelpNavigationListItem.

List of all members.


Detailed Description

The QListWidgetItem class provides an item for use with the QListWidget item view class.

The item view convenience classes use a classic item-based interface rather than a pure model/view approach. For a more flexible list view widget, consider using the QListView class with a standard model.

List items can be automatically inserted into a list when they are constructed by specifying the list widget:

doc/src/snippets/qlistwidget-using/mainwindow.cpp 2

They can also be created without a parent widget, and later inserted into a list (see {QListWidget::insertItem()}).

List items are typically used to display text() and an icon(). These are set with the setText() and setIcon() functions. The appearance of the text can be customized with setFont(), setForeground(), and setBackground(). Text in list items can be aligned using the setTextAlignment() function. Tooltips, status tips and "What's This?" help can be added to list items with setToolTip(), setStatusTip(), and setWhatsThis().

By default, items are enabled, selectable, checkable, and can be the source of a drag and drop operation. Each item's flags can be changed by calling setFlags() with the appropriate value (see {Qt::ItemFlags}). Checkable items can be checked, unchecked and partially checked with the setCheckState() function. The corresponding checkState() function indicates what check state the item currently has.

The isHidden() function can be used to determine whether the item is hidden. Items can be hidden with setHidden().

Definition at line 65 of file qlistwidget.h.


Public Types

enum  ItemType { Type = 0, UserType = 1000 }

Public Member Functions

QBrush background () const
QColor backgroundColor () const
Qt::CheckState checkState () const
virtual QListWidgetItemclone () const
virtual QVariant data (int role) const
Qt::ItemFlags flags () const
QFont font () const
QBrush foreground () const
QIcon icon () const
bool isHidden () const
bool isSelected () const
QListWidgetlistWidget () const
virtual bool operator< (const QListWidgetItem &other) const
QListWidgetItemoperator= (const QListWidgetItem &other)
 QListWidgetItem (const QListWidgetItem &other)
 QListWidgetItem (const QIcon &icon, const QString &text, QListWidget *view=0, int type=Type)
 QListWidgetItem (const QString &text, QListWidget *view=0, int type=Type)
 QListWidgetItem (QListWidget *view=0, int type=Type)
virtual void read (QDataStream &in)
void setBackground (const QBrush &brush)
virtual void setBackgroundColor (const QColor &color)
void setCheckState (Qt::CheckState state)
virtual void setData (int role, const QVariant &value)
void setFlags (Qt::ItemFlags flags)
void setFont (const QFont &font)
void setForeground (const QBrush &brush)
void setHidden (bool hide)
void setIcon (const QIcon &icon)
void setSelected (bool select)
void setSizeHint (const QSize &size)
void setStatusTip (const QString &statusTip)
void setText (const QString &text)
void setTextAlignment (int alignment)
void setTextColor (const QColor &color)
void setToolTip (const QString &toolTip)
void setWhatsThis (const QString &whatsThis)
QSize sizeHint () const
QString statusTip () const
QString text () const
int textAlignment () const
QColor textColor () const
QString toolTip () const
int type () const
QString whatsThis () const
virtual void write (QDataStream &out) const
virtual ~QListWidgetItem ()

Private Attributes

QListWidgetItemPrivate * d
QVector< void * > dummy
Qt::ItemFlags itemFlags
int rtti
QListWidgetview

Friends

class QListModel
class QListWidget

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &out, const QListWidgetItem &item)
QDataStreamoperator>> (QDataStream &in, QListWidgetItem &item)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index