changeset 229:adc20fa321c1

theme: force Fusion style on platforms other than Win32 or OS X I was reluctant to do this, but most of the other styles just look like pure shite regardless of whether I force a stylesheet on them or not. KDE's style is actually hilariously bad paired with my stylesheet, so I've decided to also make the stylesheet Windows-specific as well, because that's really the only platform where it makes sense in the first place.
author Paper <paper@paper.us.eu.org>
date Wed, 10 Jan 2024 21:23:57 -0500
parents b9f111d84d95
children 2f5a9247e501
files src/gui/theme.cc src/main.cc
diffstat 2 files changed, 21 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui/theme.cc	Mon Jan 08 13:22:09 2024 -0500
+++ b/src/gui/theme.cc	Wed Jan 10 21:23:57 2024 -0500
@@ -11,15 +11,15 @@
 #	include "sys/win32/dark_theme.h"
 #endif
 
-/* This is, believe it or not, one of the hardest things I've implemented :/
-     1. Dark mode stuff in Qt changes a lot and Qt 5 and Qt 6 are massively different
-     2. Some widgets, i.e. QTabWidget, QTabBar, etc., just completely IGNORE the QPalette setting
-     3. I don't want to use the Fusion style on every single platform
-     4. Windows dark mode support in Qt 6.5 (with Fusion) is completely unavoidable
-        (not a joke btw, it's retarded)
-   These four already make it really difficult, but along with that, I don't even remember if
-   OS X dark mode support even works still; I remember the background of some of the widgets
-   would refuse to update for whatever reason. */
+/* Weird quirks of this implementation:
+ *   1. Dark mode stuff in Qt changes a lot and Qt 5 and Qt 6 are massively different
+ *   2. Some widgets, i.e. QTabWidget, QTabBar, etc., just completely IGNORE the QPalette setting
+ *      on different platforms and the only way to fix it is by using Fusion
+ *   3. Windows dark mode support in Qt 6.5 (with Fusion) is completely unavoidable
+ * I think what I might end up doing is forcing the Fusion style on any platforms that isn't
+ * Windows or Mac. I'm not really fond of doing that, but it's the best way to achieve a "good"
+ * visual style without a substaintial amount of fucking around and subsequent finding out.
+*/
 
 namespace Theme {
 
@@ -114,12 +114,20 @@
 			pal.setColor(QPalette::Disabled, QPalette::Light, darkGray);
 			qApp->setPalette(pal);
 
+#ifdef WIN32
+			/* This is a dark style sheet that makes things look
+			 * marginally better on Windows.
+			 *
+			 * I'm very close to just giving up and using Fusion
+			 * everywhere.
+			*/
 			QFile f(":dark.qss");
 			if (!f.exists())
 				break; // how?
 			f.open(QFile::ReadOnly | QFile::Text);
 			QTextStream ts(&f);
 			qApp->setStyleSheet(ts.readAll());
+#endif
 			break;
 		}
 		default:
--- a/src/main.cc	Mon Jan 08 13:22:09 2024 -0500
+++ b/src/main.cc	Wed Jan 10 21:23:57 2024 -0500
@@ -10,6 +10,10 @@
 
 int main(int argc, char** argv) {
 	QApplication app(argc, argv);
+#if !(defined(WIN32) || defined(MACOSX))
+	/* force Fusion */
+	app.setStyle("Fusion");
+#endif
 
 	session.config.Load();
 	session.config.locale.RefreshAvailableLocales();