mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 04:20:29 +00:00
Rework Table to use rowAdded() signal of a proxy model
This commit is contained in:
parent
86b7d2a43d
commit
2471e4d67a
@ -371,8 +371,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)
|
||||||
@ -714,12 +716,13 @@ std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDraggedRecords() const
|
|||||||
return idToDrag;
|
return idToDrag;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
@ -140,7 +140,7 @@ namespace CSVWorld
|
|||||||
|
|
||||||
void updateUserSetting (const QString &name, const QStringList &list);
|
void updateUserSetting (const QString &name, const QStringList &list);
|
||||||
|
|
||||||
void rowsInsertedEvent(const QModelIndex& parent, int start, int end);
|
void rowAdded(const std::string &id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user