mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 17:36:36 +00:00
Fix stale index hanging around in RDTreeView after change
This commit is contained in:
@@ -226,7 +226,24 @@ QAbstractItemDelegate *RDTreeView::itemDelegate() const
|
||||
return m_userDelegate;
|
||||
}
|
||||
|
||||
void RDTreeView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
||||
void RDTreeView::setModel(QAbstractItemModel *model)
|
||||
{
|
||||
QAbstractItemModel *old = this->model();
|
||||
|
||||
if(old)
|
||||
QObject::disconnect(old, &QAbstractItemModel::modelAboutToBeReset, this,
|
||||
&RDTreeView::modelAboutToBeReset);
|
||||
|
||||
QTreeView::setModel(model);
|
||||
|
||||
if(model)
|
||||
{
|
||||
QObject::connect(model, &QAbstractItemModel::modelAboutToBeReset, this,
|
||||
&RDTreeView::modelAboutToBeReset);
|
||||
}
|
||||
}
|
||||
|
||||
void RDTreeView::modelAboutToBeReset()
|
||||
{
|
||||
m_currentHoverIndex = QModelIndex();
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
void setItemDelegate(QAbstractItemDelegate *delegate);
|
||||
QAbstractItemDelegate *itemDelegate() const;
|
||||
|
||||
void setModel(QAbstractItemModel *model) override;
|
||||
|
||||
// state is the storage to save the expansion state into
|
||||
// keygen is a function that will take the index of a row and a previous hash, and return the hash
|
||||
// for that row.
|
||||
@@ -124,7 +126,6 @@ signals:
|
||||
void keyPress(QKeyEvent *e);
|
||||
|
||||
protected:
|
||||
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
|
||||
void mouseMoveEvent(QMouseEvent *e) override;
|
||||
void wheelEvent(QWheelEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
@@ -139,6 +140,9 @@ protected:
|
||||
void enableBranchRectFill(bool fill) { m_fillBranchRect = fill; }
|
||||
QModelIndex m_currentHoverIndex;
|
||||
|
||||
private slots:
|
||||
void modelAboutToBeReset();
|
||||
|
||||
private:
|
||||
bool m_VisibleBranches = true;
|
||||
bool m_VisibleGridLines = true;
|
||||
|
||||
Reference in New Issue
Block a user