diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-10 20:11:46 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-10 20:11:46 +0100 |
| commit | a5059cbe3226f1ebc31b6403eaaa830549d327c9 (patch) | |
| tree | 4587f6fadf83889dcc456ade4bed39a9fdedd93f /src | |
| parent | a952f51ef75420426e8ed65e8f78d990c10770b0 (diff) | |
Select separator after creation.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlistviewactions.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index 14c4ab46..cc50f009 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -123,8 +123,7 @@ void ModListViewActions::createEmptyMod(const QModelIndex& index) const } } - IModInterface* newMod = m_core.createMod(name); - if (newMod == nullptr) { + if (m_core.createMod(name) == nullptr) { return; } @@ -164,16 +163,22 @@ void ModListViewActions::createSeparator(const QModelIndex& index) const newPriority = m_core.currentProfile()->getModPriority(index.data(ModList::IndexRole).toInt()); } - if (m_core.createMod(name) == nullptr) { return; } + if (m_core.createMod(name) == nullptr) { + return; + } + m_core.refresh(); + const auto mIndex = ModInfo::getIndex(name); if (newPriority >= 0) { - m_core.modList()->changeModPriority(ModInfo::getIndex(name), newPriority); + m_core.modList()->changeModPriority(mIndex, newPriority); } if (auto c = m_core.settings().colors().previousSeparatorColor()) { - ModInfo::getByIndex(ModInfo::getIndex(name))->setColor(*c); + ModInfo::getByIndex(mIndex)->setColor(*c); } + + m_view->scrollToAndSelect(m_view->indexModelToView(m_core.modList()->index(mIndex, 0))); } void ModListViewActions::checkModsForUpdates() const |
