Preserve event browser expansion across filtering

This commit is contained in:
baldurk
2021-05-19 14:43:17 +01:00
parent 94b1dd3923
commit b591b12eac
2 changed files with 14 additions and 0 deletions
+9
View File
@@ -2166,8 +2166,17 @@ void EventBrowser::filter_apply()
ui->events->clearSelection();
ui->events->setCurrentIndex(QModelIndex());
ExpansionKeyGen keygen = [](QModelIndex idx, uint) { return idx.data(ROLE_SELECTED_EID).toUInt(); };
// update the expansion with the current state. Any rows that were hidden won't have their
// collapsed/expanded state lost by this. We use the EID as a key because it will be the same even
// if the model index changes (e.g. if some events are shown or hidden)
ui->events->updateExpansion(m_EventsExpansion, keygen);
QString parseError = m_FilterModel->ParseExpression(ui->filterExpression->text());
ui->events->applyExpansion(m_EventsExpansion, keygen);
ui->events->setCurrentIndex(m_FilterModel->mapFromSource(m_Model->GetIndexForEID(curSelEvent)));
if(!parseError.isEmpty())
+5
View File
@@ -26,6 +26,7 @@
#include <QFrame>
#include <QIcon>
#include <QSet>
#include "Code/Interface/QRDInterface.h"
namespace Ui
@@ -40,6 +41,8 @@ class QTextStream;
class FlowLayout;
struct EventItemTag;
typedef QSet<uint> RDTreeViewExpansionState;
class RichTextViewDelegate;
struct EventItemModel;
struct EventFilterModel;
@@ -137,6 +140,8 @@ private:
TimeUnit m_TimeUnit = TimeUnit::Count;
RDTreeViewExpansionState m_EventsExpansion;
QTimer *m_FindHighlight, *m_FilterTimeout;
FlowLayout *m_BookmarkStripLayout;