QListWidget类也是GUI中常用的类,它从QListView下派生:
class Q_GUI_EXPORT QListWidget : public QListView
{
Q_OBJECT
常用方法和属性:
(1)addItem
void addItem ( const QString & label )
void addItem ( QListWidgetItem * item )
void addItems ( const QStringList & labels )
添加一项或多项。
(2)
int count () const
包含隐藏的列表项在内的列表项总数。
(3)currentItem
QListWidgetItem * currentItem () const
返回当前选择的项。
(4)currentRow
int currentRow () const
返回当前选择的项的序号。
(5)insertItem
void insertItem ( int row, QListWidgetItem * item )
void insertItem ( int row, const QString & label )
void insertItems ( int row, const QStringList & labels )
插入新项到列表框。
(6)
QListWidgetItem * item ( int row ) const
返回序号为row处的列表项。
(7)removeItemWidget<