diff options
| author | Felix Ernst <[email protected]> | 2020-11-19 21:22:27 +0000 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2020-11-19 21:22:27 +0000 |
| commit | 50ca5af7e0ec460f9f004a3660efa10bb1dd8cb1 (patch) | |
| tree | f87dde47243cd134a1d106f06e7a2b650cb2edc9 /src/dolphintabpage.cpp | |
| parent | f2d2f325b628f8b831cce076c1a5f5dc43ac21ee (diff) | |
Allow having the UrlNavigators below the tab bar
This commit restores the possibility to have the UrlNavigators below
the tab bar. This will happen automatically whenever the UrlNavigator
is removed from the toolbar.
It is also now again possible to have the toolbar on the side. This
option is disabled while the toolbar contains the UrlNavigators.
This commit makes no changes to the new default which is having the
UrlNavigators in the toolbar but makes sure that upgrading users won't
be affected.
Diffstat (limited to 'src/dolphintabpage.cpp')
| -rw-r--r-- | src/dolphintabpage.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp index 7f945dce2..138822cfd 100644 --- a/src/dolphintabpage.cpp +++ b/src/dolphintabpage.cpp @@ -10,7 +10,8 @@ #include "dolphinviewcontainer.h" #include <QSplitter> -#include <QVBoxLayout> +#include <QGridLayout> +#include <QWidgetAction> DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, QWidget* parent) : QWidget(parent), @@ -18,7 +19,7 @@ DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, m_splitViewEnabled(false), m_active(true) { - QVBoxLayout* layout = new QVBoxLayout(this); + QGridLayout *layout = new QGridLayout(this); layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); @@ -26,7 +27,8 @@ DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, m_splitter->setChildrenCollapsible(false); connect(m_splitter, &QSplitter::splitterMoved, this, &DolphinTabPage::splitterMoved); - layout->addWidget(m_splitter); + layout->addWidget(m_splitter, 1, 0); + layout->setRowStretch(1, 1); // Create a new primary view m_primaryViewContainer = createViewContainer(primaryUrl); @@ -157,6 +159,7 @@ int DolphinTabPage::selectedItemsCount() const void DolphinTabPage::connectNavigators(DolphinNavigatorsWidgetAction *navigatorsWidget) { + insertNavigatorsWidget(navigatorsWidget); m_navigatorsWidget = navigatorsWidget; auto primaryNavigator = navigatorsWidget->primaryUrlNavigator(); m_primaryViewContainer->connectUrlNavigator(primaryNavigator); @@ -185,6 +188,20 @@ bool DolphinTabPage::eventFilter(QObject *watched, QEvent *event) return QWidget::eventFilter(watched, event); } +void DolphinTabPage::insertNavigatorsWidget(DolphinNavigatorsWidgetAction* navigatorsWidget) +{ + QGridLayout *gridLayout = static_cast<QGridLayout *>(layout()); + if (navigatorsWidget->isInToolbar()) { + gridLayout->setRowMinimumHeight(0, 0); + } else { + // We set a row minimum height, so the height does not visibly change whenever + // navigatorsWidget is inserted which happens every time the current tab is changed. + gridLayout->setRowMinimumHeight(0, navigatorsWidget->primaryUrlNavigator()->height()); + gridLayout->addWidget(navigatorsWidget->requestWidget(this), 0, 0); + } +} + + void DolphinTabPage::resizeNavigators() const { if (!m_splitViewEnabled) { |
