From 7fae03959d0a4a958f620039da52332b725c80bb Mon Sep 17 00:00:00 2001 From: nowrep Date: Fri, 22 Feb 2013 18:31:44 +0100 Subject: [PATCH] TabsOnTop: Fixed picking correct color for drawing line at the bottom of navigation container. --- src/lib/app/qupzilla.cpp | 3 +++ src/lib/navigation/navigationcontainer.cpp | 11 +++++------ src/lib/navigation/navigationcontainer.h | 6 +++++- src/lib/other/qzsettings.cpp | 4 ---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 8de39fb72..942b039df 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -1580,6 +1580,9 @@ void QupZilla::triggerTabsOnTop(bool enable) m_mainLayout->insertWidget(0, m_navigationContainer); } + Settings settings; + settings.setValue("Browser-Tabs-Settings/TabsOnTop", enable); + qzSettings->tabsOnTop = enable; } diff --git a/src/lib/navigation/navigationcontainer.cpp b/src/lib/navigation/navigationcontainer.cpp index 48a844903..adf1a4519 100644 --- a/src/lib/navigation/navigationcontainer.cpp +++ b/src/lib/navigation/navigationcontainer.cpp @@ -17,12 +17,13 @@ * ============================================================ */ #include "navigationcontainer.h" #include "qzsettings.h" +#include "qupzilla.h" #include -#include -NavigationContainer::NavigationContainer(QWidget* parent) +NavigationContainer::NavigationContainer(QupZilla* parent) : QWidget(parent) + , p_QupZilla(parent) { } @@ -33,11 +34,9 @@ void NavigationContainer::paintEvent(QPaintEvent* event) if (qzSettings->tabsOnTop) { // Draw line at the bottom of navigation bar if tabs are on top // To visually distinguish navigation bar from the page - QStyleOptionFrameV3 option; - option.initFrom(this); - QPainter p(this); QRect lineRect(0, height() - 1, width(), 1); - p.fillRect(lineRect, option.palette.window().color().darker(150)); + QColor c = p_QupZilla->palette().window().color().darker(125); + p.fillRect(lineRect, c); } } diff --git a/src/lib/navigation/navigationcontainer.h b/src/lib/navigation/navigationcontainer.h index d151a2e0c..8dfc65821 100644 --- a/src/lib/navigation/navigationcontainer.h +++ b/src/lib/navigation/navigationcontainer.h @@ -22,14 +22,18 @@ #include "qzsettings.h" +class QupZilla; + class QT_QUPZILLA_EXPORT NavigationContainer : public QWidget { public: - explicit NavigationContainer(QWidget* parent = 0); + explicit NavigationContainer(QupZilla* parent = 0); private: void paintEvent(QPaintEvent* event); + QupZilla* p_QupZilla; + }; #endif // NAVIGATIONCONTAINER_H diff --git a/src/lib/other/qzsettings.cpp b/src/lib/other/qzsettings.cpp index 97367eae1..82b0ad52f 100644 --- a/src/lib/other/qzsettings.cpp +++ b/src/lib/other/qzsettings.cpp @@ -65,10 +65,6 @@ void QzSettings::saveSettings() settings.setValue("AutomaticallyOpenProtocols", autoOpenProtocols); settings.setValue("BlockOpeningProtocols", blockedProtocols); settings.endGroup(); - - settings.beginGroup("Browser-Tabs-Settings"); - settings.setValue("TabsOnTop", tabsOnTop); - settings.endGroup(); }