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.
此提交包含在:
2022-10-19 11:11:24 +02:00
父節點 7d3c24e6e1
當前提交 42e9ac5f41
共有 2 個檔案被更改,包括 27 行新增2 行删除

查看文件

@ -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);