Give locator popup list a bit more spacing again

The change to using the search result item delegate made the items
squeeze pretty much together. Explicitly add some spacing again.

Task-number: QTCREATORBUG-18457
Change-Id: If056b94e5a1629be574a0d864361dc72e356544a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2017-07-05 15:43:07 +02:00
parent e1615024cf
commit 7c67282cf0

View File

@@ -99,6 +99,14 @@ private:
QColor mBackgroundColor; QColor mBackgroundColor;
}; };
class CompletionDelegate : public SearchResultTreeItemDelegate
{
public:
CompletionDelegate(QObject *parent);
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};
class CompletionList : public Utils::TreeView class CompletionList : public Utils::TreeView
{ {
public: public:
@@ -234,7 +242,7 @@ void LocatorModel::addEntries(const QList<LocatorFilterEntry> &entries)
CompletionList::CompletionList(QWidget *parent) CompletionList::CompletionList(QWidget *parent)
: Utils::TreeView(parent) : Utils::TreeView(parent)
{ {
setItemDelegate(new SearchResultTreeItemDelegate(0, this)); setItemDelegate(new CompletionDelegate(this));
setRootIsDecorated(false); setRootIsDecorated(false);
setUniformRowHeights(true); setUniformRowHeights(true);
header()->hide(); header()->hide();
@@ -893,5 +901,15 @@ LocatorPopup *createLocatorPopup(Locator *locator, QWidget *parent)
return popup; return popup;
} }
CompletionDelegate::CompletionDelegate(QObject *parent)
: SearchResultTreeItemDelegate(0, parent)
{
}
QSize CompletionDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
return SearchResultTreeItemDelegate::sizeHint(option, index) + QSize(0, 2);
}
} // namespace Internal } // namespace Internal
} // namespace Core } // namespace Core