Skip to content
Permalink
Browse files
Use begin/endResetModel instead of reset
Qt 4.6 introduced a better way of resetting models with beginResetModel()/
endResetModel(). Call beginResetModel() before resetting internal data
structures, and then endResetModel() when finished. beginResetModel()
followed by endResetModel() is the same as calling reset().

Note: reset() is deprecated and is removed in Qt 5.
  • Loading branch information
simonsonc committed Apr 2, 2014
1 parent d398560 commit 29c8bc5375018e0928e48816fb29e63347550c84
@@ -308,9 +308,10 @@ QModelIndex QgsBrowserModel::findPath( QString path )

void QgsBrowserModel::reload()
{
beginResetModel();
removeRootItems();
addRootItems();
reset(); // Qt4.6 brings better methods beginResetModel + endResetModel
endResetModel();
}

/* Refresh dir path */
@@ -1583,9 +1583,10 @@ QModelIndex QgsCptCityBrowserModel::findPath( QString path )

void QgsCptCityBrowserModel::reload()
{
beginResetModel();
removeRootItems();
addRootItems();
reset(); // Qt4.6 brings better methods beginResetModel + endResetModel
endResetModel();
}

/* Refresh dir path */
@@ -660,7 +660,8 @@ void QgsAttributeTableModel::reload( const QModelIndex &index1, const QModelInde

void QgsAttributeTableModel::resetModel()
{
reset();
beginResetModel();
endResetModel();
}

void QgsAttributeTableModel::executeAction( int action, const QModelIndex &idx ) const
@@ -121,7 +121,8 @@ Qt::ItemFlags DockModel::flags( const QModelIndex &index ) const

void DockModel::resetModel()
{
reset();
beginResetModel();
endResetModel();
}

void DockModel::reload( const QModelIndex &index1, const QModelIndex &index2 )

0 comments on commit 29c8bc5

Please sign in to comment.