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 <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2018-08-14 11:44:41 +02:00
parent 8fee3dd4b1
commit 58747b2de1
2 changed files with 10 additions and 3 deletions

View File

@@ -295,6 +295,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
m_toggleSync(new QToolButton(this)), m_toggleSync(new QToolButton(this)),
m_toggleRootSync(new QToolButton(this)), m_toggleRootSync(new QToolButton(this)),
m_rootSelector(new QComboBox), m_rootSelector(new QComboBox),
m_crumbContainer(new QWidget(this)),
m_crumbLabel(new DelayedFileCrumbLabel(this)) m_crumbLabel(new DelayedFileCrumbLabel(this))
{ {
m_context = new Core::IContext(this); m_context = new Core::IContext(this);
@@ -337,16 +338,21 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
selectorLayout->setContentsMargins(0, 0, 0, 0); selectorLayout->setContentsMargins(0, 0, 0, 0);
selectorLayout->addWidget(m_rootSelector, 10); 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; auto crumbLayout = new QVBoxLayout;
crumbLayout->setSpacing(0); crumbLayout->setSpacing(0);
crumbLayout->setContentsMargins(4, 4, 4, 4); crumbLayout->setContentsMargins(4, 4, 4, 4);
crumbLayout->addWidget(m_crumbLabel); crumbLayout->addWidget(m_crumbLabel);
crumbContainerLayout->addLayout(crumbLayout);
crumbContainerLayout->addWidget(createHLine());
m_crumbLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); m_crumbLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
auto layout = new QVBoxLayout(); auto layout = new QVBoxLayout();
layout->addWidget(selectorWidget); layout->addWidget(selectorWidget);
layout->addLayout(crumbLayout); layout->addWidget(m_crumbContainer);
layout->addWidget(createHLine());
layout->addWidget(m_listView); layout->addWidget(m_listView);
layout->setSpacing(0); layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
@@ -432,7 +438,7 @@ void FolderNavigationWidget::toggleAutoSynchronization()
void FolderNavigationWidget::setShowBreadCrumbs(bool show) void FolderNavigationWidget::setShowBreadCrumbs(bool show)
{ {
m_showBreadCrumbsAction->setChecked(show); m_showBreadCrumbsAction->setChecked(show);
m_crumbLabel->setVisible(show); m_crumbContainer->setVisible(show);
} }
void FolderNavigationWidget::setShowFoldersOnTop(bool onTop) void FolderNavigationWidget::setShowFoldersOnTop(bool onTop)

View File

@@ -145,6 +145,7 @@ private:
QToolButton *m_toggleSync = nullptr; QToolButton *m_toggleSync = nullptr;
QToolButton *m_toggleRootSync = nullptr; QToolButton *m_toggleRootSync = nullptr;
QComboBox *m_rootSelector = nullptr; QComboBox *m_rootSelector = nullptr;
QWidget *m_crumbContainer = nullptr;
DelayedFileCrumbLabel *m_crumbLabel = nullptr; DelayedFileCrumbLabel *m_crumbLabel = nullptr;
// FolderNavigationWidgetFactory needs private members to build a menu // FolderNavigationWidgetFactory needs private members to build a menu