From 9d60570ca784000cb5ef78b13861eee58117595d Mon Sep 17 00:00:00 2001 From: Akseli Lahtinen Date: Sat, 12 Apr 2025 16:28:38 +0000 Subject: DolphinNavigator: Hide the KUrlNavigator background if DolphinNavigator is outside of toolbar When the DolphinNavigator is outside of the toolbar, it's better to hide the background for better looks. This change works only when Dolphin is built against KIO 6.14. --- src/dolphinnavigatorswidgetaction.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/dolphinnavigatorswidgetaction.cpp') diff --git a/src/dolphinnavigatorswidgetaction.cpp b/src/dolphinnavigatorswidgetaction.cpp index 0095869b1..1e4e5df9c 100644 --- a/src/dolphinnavigatorswidgetaction.cpp +++ b/src/dolphinnavigatorswidgetaction.cpp @@ -9,6 +9,7 @@ #include "trash/dolphintrash.h" +#include #include #include #include @@ -102,6 +103,7 @@ void DolphinNavigatorsWidgetAction::createSecondaryUrlNavigator() Q_ASSERT(m_splitter->count() == 1); m_splitter->addWidget(createNavigatorWidget(Secondary)); Q_ASSERT(m_splitter->count() == 2); + secondaryUrlNavigator()->setBackgroundEnabled(primaryUrlNavigator()->isBackgroundEnabled()); updateText(); } @@ -148,6 +150,18 @@ void DolphinNavigatorsWidgetAction::setSecondaryNavigatorVisible(bool visible) updateText(); } +void DolphinNavigatorsWidgetAction::setBackgroundEnabled(bool enabled) +{ +#if KIO_VERSION >= QT_VERSION_CHECK(6, 14, 0) + m_splitter->setAutoFillBackground(!enabled); + m_splitter->setBackgroundRole(enabled ? QPalette::Window : QPalette::Base); + primaryUrlNavigator()->setBackgroundEnabled(enabled); + if (secondaryUrlNavigator()) { + secondaryUrlNavigator()->setBackgroundEnabled(enabled); + } +#endif +} + QWidget *DolphinNavigatorsWidgetAction::createWidget(QWidget *parent) { QWidget *oldParent = m_splitter->parentWidget(); -- cgit v1.3