forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user