From 58747b2de107e8f6ac00daeb431ecbf3e603fd34 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 14 Aug 2018 11:44:41 +0200 Subject: [PATCH] Fix hiding file system view's bread crumb When hiding the bread crumbs in the filter option dropdown, there was some spacing and the separator line left. With this patch, the spacing and line are hidden too, making the layout nicer and more similar to before the bread crumbs feature existed. Task-number: QTCREATORBUG-20733 Change-Id: I560b4414804c8cd25e88d645aa3042acb1b8e06c Reviewed-by: Christian Stenger --- .../projectexplorer/foldernavigationwidget.cpp | 12 +++++++++--- src/plugins/projectexplorer/foldernavigationwidget.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 0df7005c56d..d4c91d32b9d 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -295,6 +295,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent m_toggleSync(new QToolButton(this)), m_toggleRootSync(new QToolButton(this)), m_rootSelector(new QComboBox), + m_crumbContainer(new QWidget(this)), m_crumbLabel(new DelayedFileCrumbLabel(this)) { m_context = new Core::IContext(this); @@ -337,16 +338,21 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent selectorLayout->setContentsMargins(0, 0, 0, 0); selectorLayout->addWidget(m_rootSelector, 10); + auto crumbContainerLayout = new QVBoxLayout; + crumbContainerLayout->setSpacing(0); + crumbContainerLayout->setContentsMargins(0, 0, 0, 0); + m_crumbContainer->setLayout(crumbContainerLayout); auto crumbLayout = new QVBoxLayout; crumbLayout->setSpacing(0); crumbLayout->setContentsMargins(4, 4, 4, 4); crumbLayout->addWidget(m_crumbLabel); + crumbContainerLayout->addLayout(crumbLayout); + crumbContainerLayout->addWidget(createHLine()); m_crumbLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); auto layout = new QVBoxLayout(); layout->addWidget(selectorWidget); - layout->addLayout(crumbLayout); - layout->addWidget(createHLine()); + layout->addWidget(m_crumbContainer); layout->addWidget(m_listView); layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); @@ -432,7 +438,7 @@ void FolderNavigationWidget::toggleAutoSynchronization() void FolderNavigationWidget::setShowBreadCrumbs(bool show) { m_showBreadCrumbsAction->setChecked(show); - m_crumbLabel->setVisible(show); + m_crumbContainer->setVisible(show); } void FolderNavigationWidget::setShowFoldersOnTop(bool onTop) diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h index 1e55bbe83a2..8f428863eba 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.h +++ b/src/plugins/projectexplorer/foldernavigationwidget.h @@ -145,6 +145,7 @@ private: QToolButton *m_toggleSync = nullptr; QToolButton *m_toggleRootSync = nullptr; QComboBox *m_rootSelector = nullptr; + QWidget *m_crumbContainer = nullptr; DelayedFileCrumbLabel *m_crumbLabel = nullptr; // FolderNavigationWidgetFactory needs private members to build a menu