Don't use deprecated QAbstractItemModel::reset()
Change-Id: Idf9971668a372a12ba319d954c35e157d8a08bd1 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
51f2a0c331
commit
b58631ce47
@ -75,6 +75,7 @@ QListModel::~QListModel()
|
||||
|
||||
void QListModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
for (int i = 0; i < items.count(); ++i) {
|
||||
if (items.at(i)) {
|
||||
items.at(i)->d->theid = -1;
|
||||
@ -83,7 +84,7 @@ void QListModel::clear()
|
||||
}
|
||||
}
|
||||
items.clear();
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QListWidgetItem *QListModel::at(int row) const
|
||||
|
@ -2097,13 +2097,14 @@ void QStandardItemModel::setItemRoleNames(const QHash<int,QByteArray> &roleNames
|
||||
void QStandardItemModel::clear()
|
||||
{
|
||||
Q_D(QStandardItemModel);
|
||||
beginResetModel();
|
||||
d->root.reset(new QStandardItem);
|
||||
d->root->d_func()->setModel(this);
|
||||
qDeleteAll(d->columnHeaderItems);
|
||||
d->columnHeaderItems.clear();
|
||||
qDeleteAll(d->rowHeaderItems);
|
||||
d->rowHeaderItems.clear();
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -755,6 +755,7 @@ void QTableModel::clear()
|
||||
|
||||
void QTableModel::clearContents()
|
||||
{
|
||||
beginResetModel();
|
||||
for (int i = 0; i < tableItems.count(); ++i) {
|
||||
if (tableItems.at(i)) {
|
||||
tableItems.at(i)->view = 0;
|
||||
@ -762,7 +763,7 @@ void QTableModel::clearContents()
|
||||
tableItems[i] = 0;
|
||||
}
|
||||
}
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void QTableModel::itemChanged(QTableWidgetItem *item)
|
||||
|
@ -160,6 +160,7 @@ QTreeModel::~QTreeModel()
|
||||
void QTreeModel::clear()
|
||||
{
|
||||
SkipSorting skipSorting(this);
|
||||
beginResetModel();
|
||||
for (int i = 0; i < rootItem->childCount(); ++i) {
|
||||
QTreeWidgetItem *item = rootItem->children.at(i);
|
||||
item->par = 0;
|
||||
@ -168,7 +169,7 @@ void QTreeModel::clear()
|
||||
}
|
||||
rootItem->children.clear();
|
||||
sortPendingTimer.stop();
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -421,7 +421,8 @@ void QCompletionModel::filter(const QStringList& parts)
|
||||
void QCompletionModel::resetModel()
|
||||
{
|
||||
if (rowCount() == 0) {
|
||||
reset();
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,8 @@ void QUndoModel::stackDestroyed(QObject *obj)
|
||||
|
||||
void QUndoModel::stackChanged()
|
||||
{
|
||||
reset();
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
m_sel_model->setCurrentIndex(selectedIndex(), QItemSelectionModel::ClearAndSelect);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user