Skip to content

Commit 8842b0d

Browse files
committed
src/dict/dictionarysearch: fix reorder priorities doing nothing
updateDictionaryOrder didn't actually update the order. This fixes the issue and listens to the signal emitted by Settings to update the order.
1 parent 3a2871d commit 8842b0d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/dict/dictionarysearch.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,11 @@ void DictionarySearch::handleSettingsChanged()
491491
this, &DictionarySearch::updateGenerators,
492492
Qt::QueuedConnection
493493
);
494+
connect(
495+
settings(), &Settings::dictionaryOrderChanged,
496+
this, &DictionarySearch::updateDictionaryOrder,
497+
Qt::QueuedConnection
498+
);
494499
#ifdef MEMENTO_MECAB_SUPPORT
495500
connect(
496501
settings(), &Settings::searchMatcherMecabIpadicChanged,
@@ -537,6 +542,16 @@ void DictionarySearch::updateDictionaryOrder()
537542
QWriteLocker lock{&m_dictionaryOrderMutex};
538543

539544
m_dictionaryOrder.clear();
545+
if (settings() == nullptr)
546+
{
547+
return;
548+
}
549+
550+
const QList<int64_t> &order = settings()->dictionaryOrder();
551+
for (qsizetype i{0}; i < order.size(); ++i)
552+
{
553+
m_dictionaryOrder.emplace(order[i], i);
554+
}
540555
}
541556

542557
/* End Handlers */

0 commit comments

Comments
 (0)