gui: previews: Ensure order matches relevance ranking

Previously, the order of previews would depend simply
on which generator would finish first.

Fix this by caching out of order previews. This may
cause a small delay but should overall be hardly noticable.
This commit is contained in:
2022-10-19 11:11:24 +02:00
parent 7d3c24e6e1
commit 42e9ac5f41
2 changed files with 27 additions and 2 deletions

View File

@@ -71,6 +71,10 @@ class MainWindow : public QMainWindow
QVector<QString> searchHistory;
int currentSearchHistoryIndex = 0;
QString currentSavedSearchText;
QHash<QString, int> previewOrder; /* Quick lookup for the order a preview should have */
QMap<int, QWidget *>
previewWidgetOrderCache /* Saves those that arrived out of order to be inserted later at the correct pos */;
private slots:
void lineEditReturnPressed();
void treeSearchItemActivated(QTreeWidgetItem *item, int i);