diff options
Diffstat (limited to 'sci-mathematics/rkward/files/rkward-0.7.2-fix-dark-themes.patch')
-rw-r--r-- | sci-mathematics/rkward/files/rkward-0.7.2-fix-dark-themes.patch | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/sci-mathematics/rkward/files/rkward-0.7.2-fix-dark-themes.patch b/sci-mathematics/rkward/files/rkward-0.7.2-fix-dark-themes.patch new file mode 100644 index 000000000000..005285e281bf --- /dev/null +++ b/sci-mathematics/rkward/files/rkward-0.7.2-fix-dark-themes.patch @@ -0,0 +1,172 @@ +From 5d64b6d23f19f4307fca2d79838bb6e1e38c7f36 Mon Sep 17 00:00:00 2001 +From: Nick Panayioto <npanayioto3@gmail.com> +Date: Thu, 28 Oct 2021 05:31:00 -0400 +Subject: [PATCH] Change plugin widgets that set their colors to use + setStyleSheet, then clear the style sheet to restore the default color. + +This looks the same on light themes and makes dark themes not use white text on white background. + +BUG: 389914 +--- + rkward/misc/getfilenamewidget.cpp | 8 ++------ + rkward/misc/getfilenamewidget.h | 2 +- + rkward/misc/rksaveobjectchooser.cpp | 6 ++---- + rkward/misc/rksaveobjectchooser.h | 2 +- + rkward/plugin/rkinput.cpp | 8 +++----- + rkward/plugin/rkpluginbrowser.cpp | 8 ++++---- + rkward/plugin/rkpluginsaveobject.cpp | 4 ++-- + rkward/plugin/rkvarslot.cpp | 7 +++---- + 8 files changed, 18 insertions(+), 27 deletions(-) + +diff --git a/rkward/misc/getfilenamewidget.cpp b/rkward/misc/getfilenamewidget.cpp +index 6b7f1d26..a439b8a4 100644 +--- a/rkward/misc/getfilenamewidget.cpp ++++ b/rkward/misc/getfilenamewidget.cpp +@@ -137,11 +137,7 @@ QString GetFileNameWidget::getLocation () { + return (edit->url ().url ()); + } + +-void GetFileNameWidget::setBackgroundColor (const QColor & color) { ++void GetFileNameWidget::setStyleSheet (const QString & style) { + RK_TRACE (MISC); +- +- QPalette palette = edit->lineEdit ()->palette (); +- palette.setColor (edit->lineEdit ()->backgroundRole (), color); +- edit->lineEdit ()->setPalette (palette); ++ edit->setStyleSheet(style); + } +- +diff --git a/rkward/misc/getfilenamewidget.h b/rkward/misc/getfilenamewidget.h +index ecbf1364..71390667 100644 +--- a/rkward/misc/getfilenamewidget.h ++++ b/rkward/misc/getfilenamewidget.h +@@ -41,7 +41,7 @@ public: + /** set the filename/location from outside */ + void setLocation (const QString &new_location); + +- void setBackgroundColor (const QColor & color); ++ void setStyleSheet (const QString &style); + + /** retrieves the current location */ + QString getLocation (); +diff --git a/rkward/misc/rksaveobjectchooser.cpp b/rkward/misc/rksaveobjectchooser.cpp +index 5d53111d..157f6940 100644 +--- a/rkward/misc/rksaveobjectchooser.cpp ++++ b/rkward/misc/rksaveobjectchooser.cpp +@@ -194,12 +194,10 @@ void RKSaveObjectChooser::updateState () { + } + } + +-void RKSaveObjectChooser::setBackgroundColor (const QColor &color) { ++void RKSaveObjectChooser::setStyleSheet (const QString &style) { + RK_TRACE (MISC); + +- QPalette palette = name_edit->palette (); +- palette.setColor (name_edit->backgroundRole (), color); +- name_edit->setPalette (palette); ++ name_edit->setStyleSheet(style); + } + + QString RKSaveObjectChooser::currentBaseName () const { +diff --git a/rkward/misc/rksaveobjectchooser.h b/rkward/misc/rksaveobjectchooser.h +index c5da85c8..3cc56a85 100644 +--- a/rkward/misc/rksaveobjectchooser.h ++++ b/rkward/misc/rksaveobjectchooser.h +@@ -37,7 +37,7 @@ public: + QString currentBaseName () const; + bool isOk () const; + void setBaseName (const QString &name); +- void setBackgroundColor (const QColor &color); ++ void setStyleSheet (const QString &style); + RObject* rootObject () const { return root_object; }; + void setRootObject (RObject* new_root); + private slots: +diff --git a/rkward/plugin/rkinput.cpp b/rkward/plugin/rkinput.cpp +index fdbab36a..a1a03ebd 100644 +--- a/rkward/plugin/rkinput.cpp ++++ b/rkward/plugin/rkinput.cpp +@@ -96,17 +96,15 @@ void RKInput::updateColor () { + if (!widget) widget = textedit; + RK_ASSERT (widget); + +- QPalette palette = widget->palette (); + if (isEnabled ()) { + if (isSatisfied ()) { +- palette.setColor (widget->backgroundRole (), QColor (255, 255, 255)); ++ widget->setStyleSheet(""); + } else { +- palette.setColor (widget->backgroundRole (), QColor (255, 0, 0)); ++ widget->setStyleSheet("background: red; color: black"); + } + } else { +- palette.setColor (widget->backgroundRole (), QColor (200, 200, 200)); ++ widget->setStyleSheet("background: rgb(200, 200, 200); color: black"); + } +- widget->setPalette (palette); + } + + void RKInput::requirednessChanged (RKComponentPropertyBase *) { +diff --git a/rkward/plugin/rkpluginbrowser.cpp b/rkward/plugin/rkpluginbrowser.cpp +index 9612acb5..ff862d16 100644 +--- a/rkward/plugin/rkpluginbrowser.cpp ++++ b/rkward/plugin/rkpluginbrowser.cpp +@@ -184,14 +184,14 @@ void RKPluginBrowser::updateColor () { + + if (isEnabled ()) { + if (status == RKComponentBase::Satisfied) { +- selector->setBackgroundColor (QColor (255, 255, 255)); ++ selector->setStyleSheet (QString ("")); + } else if (status == RKComponentBase::Processing) { +- selector->setBackgroundColor (QColor (255, 255, 0)); ++ selector->setStyleSheet (QString ("background: yellow; color: black")); + } else { +- selector->setBackgroundColor (QColor (255, 0, 0)); ++ selector->setStyleSheet (QString ("background: red; color: black")); + } + } else { +- selector->setBackgroundColor (QColor (200, 200, 200)); ++ selector->setStyleSheet (QString ("background: rgb(200, 200, 200); color: black")); + } + } + +diff --git a/rkward/plugin/rkpluginsaveobject.cpp b/rkward/plugin/rkpluginsaveobject.cpp +index 7c084a99..52b9d867 100644 +--- a/rkward/plugin/rkpluginsaveobject.cpp ++++ b/rkward/plugin/rkpluginsaveobject.cpp +@@ -82,8 +82,8 @@ RKPluginSaveObject::~RKPluginSaveObject () { + void RKPluginSaveObject::update () { + RK_TRACE (PLUGIN); + +- if (isSatisfied ()) selector->setBackgroundColor (QColor (255, 255, 255)); +- else selector->setBackgroundColor (QColor (255, 0, 0)); ++ if (isSatisfied ()) selector->setStyleSheet(QString("")); ++ else selector->setStyleSheet(QString("background: red; color: black")); + changed (); + } + +diff --git a/rkward/plugin/rkvarslot.cpp b/rkward/plugin/rkvarslot.cpp +index bc250b25..6a2ae601 100644 +--- a/rkward/plugin/rkvarslot.cpp ++++ b/rkward/plugin/rkvarslot.cpp +@@ -183,15 +183,14 @@ void RKVarSlot::updateLook () { + + QPalette palette = list->palette (); + if (!isSatisfied ()) { // implies that it is enabled +- palette.setColor (QPalette::Base, QColor (255, 0, 0)); ++ list->setStyleSheet(QString("background: red; color: black")); + } else { + if (isEnabled ()) { +- palette.setColor (QPalette::Base, QColor (255, 255, 255)); ++ list->setStyleSheet(QString("")); + } else { +- palette.setColor (QPalette::Base, QColor (200, 200, 200)); ++ list->setStyleSheet(QString("background: rgb(200, 200, 200); color: black")); + } + } +- list->setPalette(palette); + } + + void RKVarSlot::changeEvent (QEvent* event) { +-- +GitLab + |