You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.9 KiB
58 lines
1.9 KiB
From ecb0face63bfa593ce12caef4285d20cbf7f3f41 Mon Sep 17 00:00:00 2001
|
|
From: Tsu Jan <tsujan2000@gmail.com>
|
|
Date: Mon, 1 Jun 2020 23:33:37 +0430
|
|
Subject: [PATCH] Update text color of places view if style changes in runtime
|
|
|
|
Otherwise, if the style is switched between dark and light in runtime (which will soon be possible in LXQt), the text color will not change and might not have enough contrast with its background.
|
|
---
|
|
src/sidepane.cpp | 14 ++++++++++++++
|
|
src/sidepane.h | 3 +++
|
|
2 files changed, 17 insertions(+)
|
|
|
|
diff --git a/src/sidepane.cpp b/src/sidepane.cpp
|
|
index 73e74e7..d45adf9 100644
|
|
--- a/src/sidepane.cpp
|
|
+++ b/src/sidepane.cpp
|
|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
#include "sidepane.h"
|
|
+#include <QEvent>
|
|
#include <QComboBox>
|
|
#include <QVBoxLayout>
|
|
#include <QHeaderView>
|
|
@@ -51,6 +52,19 @@ SidePane::~SidePane() {
|
|
// qDebug("delete SidePane");
|
|
}
|
|
|
|
+bool SidePane::event(QEvent* event) {
|
|
+ // when the SidePane's style changes, we should set the text color of
|
|
+ // PlacesView to its window text color again because the latter may have changed
|
|
+ if(event->type() == QEvent::StyleChange && mode_ == ModePlaces) {
|
|
+ if(PlacesView* placesView = static_cast<PlacesView*>(view_)) {
|
|
+ QPalette p = placesView->palette();
|
|
+ p.setColor(QPalette::Text, p.color(QPalette::WindowText));
|
|
+ placesView->setPalette(p);
|
|
+ }
|
|
+ }
|
|
+ return QWidget::event(event);
|
|
+}
|
|
+
|
|
void SidePane::onComboCurrentIndexChanged(int current) {
|
|
if(current != mode_) {
|
|
setMode(Mode(current));
|
|
diff --git a/src/sidepane.h b/src/sidepane.h
|
|
index 7218f6a..79b27a9 100644
|
|
--- a/src/sidepane.h
|
|
+++ b/src/sidepane.h
|
|
@@ -111,6 +111,9 @@ class LIBFM_QT_API SidePane : public QWidget {
|
|
|
|
void hiddenPlaceSet(const QString& str, bool hide);
|
|
|
|
+protected:
|
|
+ bool event(QEvent* event) override;
|
|
+
|
|
protected Q_SLOTS:
|
|
void onComboCurrentIndexChanged(int current);
|
|
|