Native file dialogs in GNOME

Published Wednesday October 1st, 2008
8 Comments on Native file dialogs in GNOME
Posted in QGtkStyle, Qt, Styles

One of the few remaining complaints against Qt applications using QGtkStyle on GNOME have been about the file dialog. So far it certainly looked like a GTK+ dialog, but it was not exactly the same dialog that other applications had been using. While I’m not really in a position to comment on which dialog is the better one, this is what it currently looks like with QGtkStyle:

Gtk dialog with Qt

However, the policy on other platforms such as Windows and Mac OS X has been to use the native dialogs if possible. I recently applied some patches to support this for GTK+ as well. This is what you will see if you open forms in Designer now:

Gtk dialog with Qt

Note that since the KDE file dialog provides somewhat different functionality from the Qt one, KDE applications will still use the KDE file dialog. Feel free to try it out directly from the svn on my labs page and report whatever issues you might find here.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in QGtkStyle, Qt, Styles

8 comments

jamadagni says:

To clarify some things:

1. When the style is set to QGtkStyle, then the Open File dialog will be the native GTK one used, or you try to detect whether you are running GNOME and then use the GTK dialog?

2. Do you need to build-depend on the GNOME libraries for this or only the GTK libraries?

3.

> since the KDE file dialog provides somewhat different functionality from the Qt one

Can you elaborate a bit on this?

Thanks.

Jens says:

jamadagni:
1: The way it works at the moment is that it will automatically use the GTK+ file dialog when you are using QGtkStyle. I do not want to limit it to GNOME since it can just as well apply to other GTK+ based environments.
However we should probably disable it if you are running KDE. (though on other desktops, people are unlikely to be using QGtkStyle)
2: Only standard GTK+ libraries are detected and used at runtime, meaning it should work just as well with Xfce for instance.
3: At the moment KDE already replaces the Qt file dialog with its own because it wants to support KIO and other KDE specific technologies.
The QGtkStyle plugin uses the same hooks as KDE, meaning KDE will override QGtkStyle (though that could easily be changed in 4.5).
I think I will leave it up to KDE community to decide when and if native dialogs should be used with GTK+.

jb says:

This is yet another good move and will drive the angry users away from us.

Pellaeon says:

“Note that since the KDE file dialog provides somewhat different functionality from the Qt one, KDE applications will continue to use a custom one.”

The above makes it sound as if the GTK+ dialog is the “standard” while KDE uses “custom” ones.

“However, the policy on other platforms such as Windows and Mac OS X has been to use the native dialogs if possible.”

I.e. GTK/Gnome is equated with “the Linux platform” here? Or why doesn’t Qt attempt to use KDE dialogs within KDE?

Jens says:

Pellaeon:
We do 🙂 If you run Oxygen style, you should already have the native KDE file dialog in your Qt apps. As I pointed out in the article, QGtkStyle currently use the exact same hook that KDE does. Native on GNOME and native on KDE mean two different things. None of them equates to “native on linux”. The article happens to be about running Qt/KDE applications on a GNOME desktop and in this case the KDE file dialog is not the native one.

Great work! Btw. at first I also read the statement about KDE apps as meaning that qt apps in KDE won’t use the KDE dialog. Now that I reread that sentence, I see that it is not what you said 😉

Jens says:

Jonathan: Point taken. I changed the phrase to “KDE applications will still use the KDE file dialog” so I do not confuse more people. 🙂

Well now Qt uses GTK dialogs in GNOME. Why can’t Gtk “repay the debt” and use KDE dialogs in KDE?

Commenting closed.

Get started today with Qt Download now