FedoraQt / QGnomePlatform

QPlatformTheme for a better Qt application inclusion in GNOME
GNU Lesser General Public License v2.1
262 stars 38 forks source link

Question: Does the file dialog property open in dark mode? #146

Closed hmaarrfk closed 1 year ago

hmaarrfk commented 1 year ago

Thank you for making this available. It is the only way to get things to look decently well for Qt Application on wayland that I've found.

I'm working to package this on conda(-forge).

conda allows users to install software in a directory of their choice.

I've hit the usual conda bug where things that don't live in the system directories break: https://github.com/conda-forge/qt-main-feedstock/issues/177 https://github.com/conda-forge/qgnomeplatform-feedstock/pull/5

I'm able to get the "qt application" to take on the "dark / light" themes from the gnome plugin you created, however once I open a file dialog, they always seem to be opened with the Adwaita light theme.

Is this a known bug here? or is the bug likely in the conda integration.

Thank you for your input.

I'm using version 0.9.1, ubuntu 23.04

grulja commented 1 year ago

The file dialog is either opened using Gtk or using xdg-desktop-portal. In both cases it should be Gtk (xdg-desktop-portal-gtk) who is responsible for theming, we just modify Qt stuff. Do other Gtk apps open in dark style?

hmaarrfk commented 1 year ago

Thank you for your reply. It seems that the likely cause is a misconfiguration of conda.

Gtk or using xdg-desktop-portal

Can you point me to where I can add a print statement to confirm the code path?

Do other Gtk apps open in dark style?

If I uninstall your plugin, and install the gtk-platformtheme from Qt, that file dialog opens with the correct theme.

Thanks again for the input and the help.

hmaarrfk commented 1 year ago

A little more information on "do other gtk application get themed correctly":

I created a demo application following: https://python-gtk-3-tutorial.readthedocs.io/en/latest/dialogs.html

gi

gi_demo.py.txt

image

qt

qt_demo.py.txt

image

hmaarrfk commented 1 year ago

I think I finally found that the code here that gets run is from:

https://github.com/FedoraQt/QGnomePlatform/blob/master/src/theme/qxdgdesktopportalfiledialog.cpp#L163

(openPortal function call)

I used the example that somebody else on github created to open the file dialog through dbus + xdg desktop portal https://github.com/flatpak/xdg-desktop-portal/issues/820#issue-1282727445

It seems to create the same "unthemed" window.

It seems that it has to do with the conda + xdg desktop portal + ubuntu integration.

I tested running things from the the ubuntu shipped python, and it seems that it is also unthemed. Maybe it is an issue with ubuntu's XDG desktop portal.

hmaarrfk commented 1 year ago

It may just be that I'm hitting: https://bugs.launchpad.net/ubuntu/+source/xdg-desktop-portal-gnome/+bug/1967777

hmaarrfk commented 1 year ago

Ok i don't think there is anything to do with your code.

I've patched out XDG usage for now (thanks for making that easy) and I think this makes things "better" for my usecase.

I'll keep an eye periodicially and likely open an issue with ubuntu once I get back on an LTS.

FYI, my patch is https://github.com/conda-forge/qgnomeplatform-feedstock/pull/7/files#diff-a014225d62fbfa18a53c3f8e70e9a9eae5aee55b4bd9411402668c2797380b55

grulja commented 1 year ago

I'm glad you managed to find a workaround. I'm closing this bug now as it's not related to QGnomePlatform.