mirror of
https://github.com/tnodir/fort
synced 2024-11-15 01:15:29 +00:00
UI: *Model: Don't emit dataChanged() with invalid indexes
This commit is contained in:
parent
1ab3cb60b8
commit
60ba3b2bca
@ -103,8 +103,12 @@ void StringListModel::reset()
|
||||
|
||||
void StringListModel::refresh()
|
||||
{
|
||||
const int rowCount = this->rowCount();
|
||||
if (rowCount <= 0)
|
||||
return;
|
||||
|
||||
const auto firstCell = index(0, 0);
|
||||
const auto lastCell = index(rowCount() - 1, 0);
|
||||
const auto lastCell = index(rowCount - 1, 0);
|
||||
|
||||
emit dataChanged(firstCell, lastCell);
|
||||
}
|
||||
|
@ -65,8 +65,12 @@ void TableItemModel::refresh()
|
||||
{
|
||||
invalidateRowCache();
|
||||
|
||||
const int rowCount = this->rowCount();
|
||||
if (rowCount <= 0)
|
||||
return;
|
||||
|
||||
const auto firstCell = index(0, 0);
|
||||
const auto lastCell = index(rowCount() - 1, columnCount(firstCell) - 1);
|
||||
const auto lastCell = index(rowCount - 1, columnCount(firstCell) - 1);
|
||||
|
||||
emit dataChanged(firstCell, lastCell);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user