From a5059cbe3226f1ebc31b6403eaaa830549d327c9 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 10 Jan 2021 20:11:46 +0100 Subject: Select separator after creation. --- src/modlistviewactions.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/modlistviewactions.cpp') 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 -- cgit v1.3.1