mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 04:53:51 +00:00
Modifying an object instance (e.g. 3D edit) triggers the instances table to scroll to the corresponding record. Should resolve Feature #2554.
This commit is contained in:
parent
27000fb36b
commit
4b57f6c821
3 changed files with 28 additions and 6 deletions
|
@ -214,6 +214,11 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
|||
"Jump to the added or cloned record.");
|
||||
jumpToAdded->setDefaultValue (defaultValue);
|
||||
jumpToAdded->setDeclaredValues (jumpValues);
|
||||
|
||||
Setting *jumpToModified = createSetting (Type_CheckBox, "jump-to-modified", "Jump to modified Record");
|
||||
jumpToModified->setDefaultValue ("true");
|
||||
jumpToModified->setToolTip ("Whether to jump to the modified record. This setting effects the instances table only."
|
||||
"\nCan be useful in finding the moved or modified object instance while 3D editing.");
|
||||
}
|
||||
|
||||
declareSection ("search", "Search & Replace");
|
||||
|
|
|
@ -370,10 +370,14 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
|||
connect (mProxyModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
||||
this, SLOT (rowsInsertedEvent(const QModelIndex&, int, int)));
|
||||
|
||||
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
||||
/// the records status column (for permanence reasons)
|
||||
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||
this, SLOT (tableSizeUpdate()));
|
||||
if (id == CSMWorld::UniversalId::Type_References)
|
||||
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||
this, SLOT (dataChangedEvent(const QModelIndex&, const QModelIndex&)));
|
||||
else
|
||||
/// \note This signal could instead be connected to a slot that filters out changes not affecting
|
||||
/// the records status column (for permanence reasons)
|
||||
connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||
this, SLOT (tableSizeUpdate()));
|
||||
|
||||
connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
|
||||
this, SLOT (selectionSizeUpdate ()));
|
||||
|
@ -640,7 +644,7 @@ void CSVWorld::Table::tableSizeUpdate()
|
|||
case CSMWorld::RecordBase::State_BaseOnly: ++size; break;
|
||||
case CSMWorld::RecordBase::State_Modified: ++size; ++modified; break;
|
||||
case CSMWorld::RecordBase::State_ModifiedOnly: ++size; ++modified; break;
|
||||
case CSMWorld::RecordBase:: State_Deleted: ++deleted; ++modified; break;
|
||||
case CSMWorld::RecordBase::State_Deleted: ++deleted; ++modified; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -743,6 +747,7 @@ std::vector< CSMWorld::UniversalId > CSVWorld::Table::getDraggedRecords() const
|
|||
void CSVWorld::Table::rowsInsertedEvent(const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
tableSizeUpdate();
|
||||
|
||||
if(mJumpToAddedRecord)
|
||||
{
|
||||
selectRow(end);
|
||||
|
@ -751,3 +756,13 @@ void CSVWorld::Table::rowsInsertedEvent(const QModelIndex& parent, int start, in
|
|||
clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void CSVWorld::Table::dataChangedEvent(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
{
|
||||
tableSizeUpdate();
|
||||
|
||||
// this event is assumed to be infreqent, don't bother keeping a member variable
|
||||
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
|
||||
if (settings.setting("table-input/jump-to-modified", "true") == "true")
|
||||
selectRow(bottomRight.row());
|
||||
}
|
||||
|
|
|
@ -142,7 +142,9 @@ namespace CSVWorld
|
|||
|
||||
void updateUserSetting (const QString &name, const QStringList &list);
|
||||
|
||||
void rowsInsertedEvent(const QModelIndex& parent, int start, int end);
|
||||
void rowsInsertedEvent(const QModelIndex &parent, int start, int end);
|
||||
|
||||
void dataChangedEvent(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue