Utils: Make TreeViews use setUniformRowHeights by default

When applicable, the flag makes a significant difference in
performacnce. However is easily forgotten in cases where it
is applicable, and cases where it is accidentally used are
easily spotted visually. So arguably, opt-out is a better
default than opt-in.

Change-Id: I88aeb05b42533ba4e23c39573a3ddd016343cd55
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-08-22 09:22:46 +02:00
parent b9188fb747
commit a475632c66
27 changed files with 41 additions and 36 deletions

View File

@@ -44,7 +44,6 @@ SearchResultTreeView::SearchResultTreeView(QWidget *parent)
setItemDelegate(new SearchResultTreeItemDelegate(8, this));
setIndentation(14);
setUniformRowHeights(true);
setExpandsOnDoubleClick(true);
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
header()->setStretchLastSection(false);

View File

@@ -277,6 +277,7 @@ public:
filterEdit->setFiltering(true);
m_filterList = new TreeView;
m_filterList->setUniformRowHeights(false);
m_filterList->setSelectionMode(QAbstractItemView::SingleSelection);
m_filterList->setSelectionBehavior(QAbstractItemView::SelectRows);
m_filterList->setSortingEnabled(true);

View File

@@ -250,7 +250,6 @@ CompletionList::CompletionList(QWidget *parent)
setItemDelegate(new CompletionDelegate(this));
setRootIsDecorated(false);
setUniformRowHeights(true);
header()->hide();
header()->setStretchLastSection(true);
// This is too slow when done on all results

View File

@@ -81,7 +81,6 @@ OpenDocumentsTreeView::OpenDocumentsTreeView(QWidget *parent) :
m_delegate = new Internal::OpenDocumentsDelegate(this);
setItemDelegate(m_delegate);
setRootIsDecorated(false);
setUniformRowHeights(true);
setTextElideMode(Qt::ElideMiddle);
setFrameStyle(QFrame::NoFrame);
setAttribute(Qt::WA_MacShowFocusRect, false);

View File

@@ -36,6 +36,7 @@ void RemoveItemFocusDelegate::paint(QPainter* painter, const QStyleOptionViewIte
SessionView::SessionView(QWidget *parent)
: Utils::TreeView(parent)
{
setUniformRowHeights(false);
setItemDelegate(new RemoveItemFocusDelegate(this));
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::ExtendedSelection);