mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Optimise tree view expand/collapse all to avoid slow Qt path
This commit is contained in:
@@ -376,20 +376,44 @@ void RDTreeView::copyIndex(QPoint pos, QModelIndex index)
|
||||
selectionModel()->clear();
|
||||
}
|
||||
|
||||
void RDTreeView::expandAll(QModelIndex index)
|
||||
void RDTreeView::expandAllInternal(QModelIndex index)
|
||||
{
|
||||
int rows = model()->rowCount(index);
|
||||
|
||||
if(rows == 0)
|
||||
return;
|
||||
|
||||
expand(index);
|
||||
|
||||
for(int r = 0, rows = model()->rowCount(index); r < rows; r++)
|
||||
for(int r = 0; r < rows; r++)
|
||||
expandAll(model()->index(r, 0, index));
|
||||
}
|
||||
|
||||
void RDTreeView::collapseAllInternal(QModelIndex index)
|
||||
{
|
||||
int rows = model()->rowCount(index);
|
||||
|
||||
if(rows == 0)
|
||||
return;
|
||||
|
||||
collapse(index);
|
||||
|
||||
for(int r = 0; r < rows; r++)
|
||||
collapseAll(model()->index(r, 0, index));
|
||||
}
|
||||
|
||||
void RDTreeView::expandAll(QModelIndex index)
|
||||
{
|
||||
setUpdatesEnabled(false);
|
||||
expandAllInternal(index);
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
void RDTreeView::collapseAll(QModelIndex index)
|
||||
{
|
||||
collapse(index);
|
||||
|
||||
for(int r = 0, rows = model()->rowCount(index); r < rows; r++)
|
||||
collapseAll(model()->index(r, 0, index));
|
||||
setUpdatesEnabled(false);
|
||||
collapseAllInternal(index);
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
bool RDTreeView::viewportEvent(QEvent *event)
|
||||
|
||||
@@ -214,6 +214,9 @@ private:
|
||||
bool m_customCopyPaste = false;
|
||||
bool m_instantTooltips = false;
|
||||
|
||||
void expandAllInternal(QModelIndex index);
|
||||
void collapseAllInternal(QModelIndex index);
|
||||
|
||||
QMap<uint, RDTreeViewExpansionState> m_Expansions;
|
||||
|
||||
void updateExpansionFromRow(RDTreeViewExpansionState &state, QModelIndex idx, uint seed,
|
||||
|
||||
Reference in New Issue
Block a user