blobdrop icon indicating copy to clipboard operation
blobdrop copied to clipboard

Does not respect user theme

Open littleblack111 opened this issue 1 year ago • 1 comments

Describe the bug

i have gtk theme and qt and kv theme set. it uses white

To reproduce

No response

Expected behavior

No response

littleblack111 avatar Oct 02 '24 11:10 littleblack111

Yeah the dark mode support in Qt is a mess. It used to work with runtime theme changes, but now I can reproduce it only using the system theme on start (as long as you use the correct platformtheme plugin), but not changing it during runtime anymore.

This diff seems to fix the problem, but I prefer to fix it upstream in Qt instead:

diff --git a/src/qml/Main.qml b/src/qml/Main.qml
index fbc3560..995f4cc 100644
--- a/src/qml/Main.qml
+++ b/src/qml/Main.qml
@@ -11,7 +11,7 @@ ApplicationWindow {
 	title: Stdin.closed ? "Blobdrop" : "Reading from stdin..."
 	width: Settings.iconOnly ? Settings.thumbnailSize + 16 : 400
 	height: Math.max(48, Math.min(800, pathView.count ? pathView.contentHeight + 2 * pathView.anchors.topMargin : 350))
-	Material.theme: Material.System
+	Material.theme: Application.styleHints.colorScheme === Qt.ColorScheme.Dark ? Material.Dark : Material.Light
 	Material.primary: Material.Green
 	Material.accent: Material.Pink
 	Component.onCompleted: {

It doesn't help, that Qt has implemented system theme detection in 4 different places, with all basically the same duplicated code:

This kind of shit almost makes GTK look sane in comparison. All of the above four should be unified in one single interface, that's reused everywhere. So this probably needs some refactoring first.

Edit: Upstream issue is here: https://bugreports.qt.io/browse/QTBUG-116197 and also similarly here https://bugreports.qt.io/browse/QTBUG-133044

vimpostor avatar Apr 17 '25 20:04 vimpostor