• 9569阅读
  • 8回复

QListView  怎么清空 里面的ITEM啊 用什么函数 [复制链接]

上一主题 下一主题
离线wsszlj
 

只看楼主 倒序阅读 楼主  发表于: 2009-09-22
— 本帖被 XChinux 从 General Qt Programming 移动到本区(2011-01-02) —
QListView  怎么清空 里面的ITEM啊 用什么函数
离线jorneyr

只看该作者 1楼 发表于: 2009-09-22
clear()
离线wsszlj

只看该作者 2楼 发表于: 2009-09-22
clear() 不是他的成员函数啊
离线wsszlj

只看该作者 3楼 发表于: 2009-09-22
不行,不是它的成员函数
离线jorneyr

只看该作者 4楼 发表于: 2009-09-22
model()->clear()
离线wsszlj

只看该作者 5楼 发表于: 2009-09-22
QListView::model()  返回QAbstractItemModel  ,而clear() 也不是其成员函数
离线jorneyr

只看该作者 6楼 发表于: 2009-09-22
void QStandardItemModel::clear ()

Removes all items (including header items) from the model and sets the number of rows and columns to zero.

See also removeColumns() and removeRows().
离线jorneyr

只看该作者 7楼 发表于: 2009-09-22
bool QAbstractItemModel::removeRows ( int row, int count, const QModelIndex & parent = QModelIndex() )   [virtual]

On models that support this, removes count rows starting with the given row under parent parent from the model. Returns true if the rows were successfully removed; otherwise returns false.

The base class implementation does nothing and returns false.

If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide you own API for altering the data.

See also removeRow(), removeColumns(), insertColumns(), beginRemoveRows(), and endRemoveRows().
离线wsszlj

只看该作者 8楼 发表于: 2009-09-22
OK,谢谢哦
快速回复
限100 字节
 
上一个 下一个