mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 13:33:55 -07:00
Always debounce modelDirty() with dirty() timer.
Took 29 minutes Took 3 minutes
This commit is contained in:
parent
78a8f9104d
commit
97d3843501
3 changed files with 11 additions and 16 deletions
|
|
@ -10,7 +10,10 @@ CardDatabaseDisplayModel::CardDatabaseDisplayModel(QObject *parent)
|
|||
setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
dirtyTimer.setSingleShot(true);
|
||||
connect(&dirtyTimer, &QTimer::timeout, this, &CardDatabaseDisplayModel::invalidate);
|
||||
connect(&dirtyTimer, &QTimer::timeout, this, [this]() {
|
||||
invalidate();
|
||||
emit modelDirty();
|
||||
});
|
||||
|
||||
loadedRowCount = 0;
|
||||
}
|
||||
|
|
@ -19,13 +22,9 @@ void CardDatabaseDisplayModel::setSourceModel(QAbstractItemModel *model)
|
|||
{
|
||||
QSortFilterProxyModel::setSourceModel(model);
|
||||
|
||||
connect(model, &QAbstractItemModel::rowsInserted, this, [this]() {
|
||||
dirty();
|
||||
});
|
||||
connect(model, &QAbstractItemModel::rowsInserted, this, [this]() { dirty(); });
|
||||
|
||||
connect(model, &QAbstractItemModel::rowsRemoved, this, [this]() {
|
||||
dirty();
|
||||
});
|
||||
connect(model, &QAbstractItemModel::rowsRemoved, this, [this]() { dirty(); });
|
||||
|
||||
connect(model, &QAbstractItemModel::modelReset, this, [this]() {
|
||||
loadedRowCount = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue