mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 09:15:33 +00:00
Rework Table to use rowAdded() signal of a proxy model
Conflicts: apps/opencs/view/world/table.cpp apps/opencs/view/world/table.hpp
This commit is contained in:
parent
9461baa2ea
commit
6a82ce0d50
2 changed files with 8 additions and 5 deletions
|
@ -374,8 +374,10 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||||
connect (mProxyModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
|
connect (mProxyModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
|
||||||
this, SLOT (tableSizeUpdate()));
|
this, SLOT (tableSizeUpdate()));
|
||||||
|
|
||||||
connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
//connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
||||||
this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
// this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
||||||
|
connect (mProxyModel, SIGNAL (rowAdded (const std::string &)),
|
||||||
|
this, SLOT (rowAdded (const std::string &)));
|
||||||
|
|
||||||
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
||||||
/// the records status column (for permanence reasons)
|
/// the records status column (for permanence reasons)
|
||||||
|
@ -793,12 +795,13 @@ void CSVWorld::Table::globalFilterModifiedChanged(int state)
|
||||||
recordFilterChanged(mFilter);
|
recordFilterChanged(mFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::rowsInsertedEvent(const QModelIndex& parent, int start, int end)
|
void CSVWorld::Table::rowAdded(const std::string &id)
|
||||||
{
|
{
|
||||||
tableSizeUpdate();
|
tableSizeUpdate();
|
||||||
if(mJumpToAddedRecord)
|
if(mJumpToAddedRecord)
|
||||||
{
|
{
|
||||||
selectRow(end);
|
int idColumn = mModel->findColumnIndex(CSMWorld::Columns::ColumnId_Id);
|
||||||
|
selectRow(mProxyModel->getModelIndex(id, idColumn).row());
|
||||||
|
|
||||||
if(mUnselectAfterJump)
|
if(mUnselectAfterJump)
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
void globalFilterModifiedChanged (int state);
|
void globalFilterModifiedChanged (int state);
|
||||||
|
|
||||||
void rowsInsertedEvent(const QModelIndex& parent, int start, int end);
|
void rowAdded(const std::string &id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue