From 198b412ff225dfcf2a48023c2877474d2f866d67 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 28 Apr 2021 11:04:42 +0200 Subject: [PATCH] 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 --- src/plugins/coreplugin/editormanager/documentmodel.cpp | 2 +- src/plugins/coreplugin/opendocumentstreeview.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp index ad3e5aca832..5c7b624d30e 100644 --- a/src/plugins/coreplugin/editormanager/documentmodel.cpp +++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp @@ -336,7 +336,7 @@ QVariant DocumentModelPrivate::data(const QModelIndex &index, int role) const return lockedIcon(); if (entry->pinned) return pinnedIcon(); - return QIcon(); + return QVariant(); case Qt::ToolTipRole: return entry->fileName().isEmpty() ? entry->displayName() : entry->fileName().toUserOutput(); default: diff --git a/src/plugins/coreplugin/opendocumentstreeview.cpp b/src/plugins/coreplugin/opendocumentstreeview.cpp index c6994c221b4..2b91f2033f0 100644 --- a/src/plugins/coreplugin/opendocumentstreeview.cpp +++ b/src/plugins/coreplugin/opendocumentstreeview.cpp @@ -102,7 +102,7 @@ OpenDocumentsTreeView::OpenDocumentsTreeView(QWidget *parent) : { m_delegate = new Internal::OpenDocumentsDelegate(this); setItemDelegate(m_delegate); - setIndentation(0); + setRootIsDecorated(false); setUniformRowHeights(true); setTextElideMode(Qt::ElideMiddle); setFrameStyle(QFrame::NoFrame);