Fix margin of Open Documents view built with Qt 6

If an item has an empty QIcon as decoration, Qt 6 does not add a margin
to the left. Use an empty QVariant for declaring "no decoration"
instead, which is semantically better anyhow.

Also set rootIsDecorated to false instead of setting the indentation to
0, since that is what we actually mean.

Fixes: QTCREATORBUG-25253
Change-Id: I33f4c25394bb61f9f56d375c59453b3434620d0d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2021-04-28 11:04:42 +02:00
parent 564d2666c3
commit 198b412ff2
2 changed files with 2 additions and 2 deletions

View File

@@ -336,7 +336,7 @@ QVariant DocumentModelPrivate::data(const QModelIndex &index, int role) const
return lockedIcon(); return lockedIcon();
if (entry->pinned) if (entry->pinned)
return pinnedIcon(); return pinnedIcon();
return QIcon(); return QVariant();
case Qt::ToolTipRole: case Qt::ToolTipRole:
return entry->fileName().isEmpty() ? entry->displayName() : entry->fileName().toUserOutput(); return entry->fileName().isEmpty() ? entry->displayName() : entry->fileName().toUserOutput();
default: default:

View File

@@ -102,7 +102,7 @@ OpenDocumentsTreeView::OpenDocumentsTreeView(QWidget *parent) :
{ {
m_delegate = new Internal::OpenDocumentsDelegate(this); m_delegate = new Internal::OpenDocumentsDelegate(this);
setItemDelegate(m_delegate); setItemDelegate(m_delegate);
setIndentation(0); setRootIsDecorated(false);
setUniformRowHeights(true); setUniformRowHeights(true);
setTextElideMode(Qt::ElideMiddle); setTextElideMode(Qt::ElideMiddle);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);