Commit 76150507 authored by Eike Ziller's avatar Eike Ziller

Improve styling of crumble path in file system view

- Fix left alignment when wrapping over multiple lines.
- Don't break lines before path separators
- Add a separating line below

Change-Id: I709fa3c6d12fa45a909ed6ca5c63cc5b877b2dc3
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent 8f749e47
......@@ -67,8 +67,8 @@ void FileCrumbLabel::setPath(const FileName &path)
}
current = current.parentDir();
}
const auto pathSeparator = QLatin1String(HostOsInfo::isWindowsHost() ? " \\ " : " / ");
const QString prefix = HostOsInfo::isWindowsHost() ? QString("&nbsp;\\ ") : QString("&nbsp;/ ");
const auto pathSeparator = QLatin1String(HostOsInfo::isWindowsHost() ? "&nbsp;\\ " : "&nbsp;/ ");
const QString prefix = HostOsInfo::isWindowsHost() ? QString("\\ ") : QString("/ ");
setText(prefix + links.join(pathSeparator));
}
......
......@@ -76,6 +76,14 @@ static FolderNavigationWidgetFactory *m_instance = nullptr;
QVector<FolderNavigationWidgetFactory::RootDirectory>
FolderNavigationWidgetFactory::m_rootDirectories;
static QWidget *createHLine()
{
auto widget = new QFrame;
widget->setFrameStyle(QFrame::Plain | QFrame::HLine);
return widget;
}
// FolderNavigationModel: Shows path as tooltip.
class FolderNavigationModel : public QFileSystemModel
{
......@@ -160,11 +168,16 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
selectorLayout->setContentsMargins(0, 0, 0, 0);
selectorLayout->addWidget(m_rootSelector);
auto crumbLayout = new QVBoxLayout;
crumbLayout->setSpacing(0);
crumbLayout->setContentsMargins(4, 4, 4, 4);
crumbLayout->addWidget(m_crumbLabel);
m_crumbLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
auto layout = new QVBoxLayout();
layout->addWidget(selectorWidget);
layout->addSpacing(4);
layout->addWidget(m_crumbLabel);
layout->addSpacing(4);
layout->addLayout(crumbLayout);
layout->addWidget(createHLine());
layout->addWidget(m_listView);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment