[Qgis-developer] Mac Use of QFileDialog

Tom Elwertowski telwertowski at comcast.net
Fri May 16 23:43:08 EDT 2008


I am starting a new thread for the Mac QFileDialog discussion. The original message is below.

There are two issues raised by this discussion:
1. Bugs and deficiencies in QFileDialog.
2. Should qgis be using QFileDialog or native Mac dialogs.

QFileDialog is not including /Volumes in its left sidebar. This appears to be a Qt bug which I will report. I will suggest that they approximate the sidebar of a native file dialog as much as possible but definitely show all volumes. Under /Computer I see /dev/fd. It doesn't show anything useful but perhaps is supposed to show volumes.

QFileDialog has a setSidebarUrls() method. A workaround for now is to use this to append the /Volumes list ourselves.

Regarding other invisible directories, there is no way to ask for them using QFileDialog. The Mac OS has a flag to include invisible files but Qt exposes very few platform options. Adding known items using setSidebarUrls() may be the only way to get to hidden places (assuming this doesn't do any filtering).

By design, Qt will show a native dialog only if no dialog customization is done. qgis implements the subclass QgsEncodingFileDialog which adds an encoding popup. This prevents a native dialog because Trolltech does not implement native dialog extensions.

To use a native dialog, we would need to provide a Mac-specific implementation of qgsencodingfiledialog.cpp with the same api but implemented with native Mac OS file routines rather than Qt routines.

This technique is quite common, especially among applications that try to preserve the look-and-feel of each platform. Personally, I believe that about 15 to 30 percent of gui code should be platform-specific in order to avoid the disorientation that occurs when using 'alien' gui components.

Implementing a Mac file dialog with the relatively minor additions that we add is not a big deal. I'm even willing to do this at some point. Right now, however, there are a few other Mac gui quirks that bother me more such the lack of a menu bar in Print Composer and the Attribute Table editor. An Edit menu should also be present and the overall menu organization could be improved but this is a topic for another message.

How do other Mac users feel about native vs Qt file dialogs? I prefer native but rate it a medium rather than high priority.

Tom


William Kyngesburye wrote:
> Tim, for your GUI revision, something I keep forgetting about (I 
> encounter it occassionally, and it hasn't stuck in my brain long enough 
> to file a bug or mention it, until now): the select dialog box for 
> rasters, vectors and other file-based sources does not use the platform 
> open dialog - this may be intentional, either by Qgis or Qt.
> 
> But on OSX the Qt open dialog does not show disk or network volumes, nor 
> does it show invisible files or folders, *including* Mac invisible (like 
> /Volumes), so it's impossible to navigate to external drives to load 
> data, unless I make a symlink to them.
> 
> I don't know if this ever worked, or if something changed in Qgis or Qt 
> at some point. It goes back to at least 0.9.0.
> 
> Do you need a bug report?
> 
> -----
> William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
> http://www.kyngchaos.com/
> 
> The equator is so long, it could encircle the earth completely once.



More information about the Qgis-developer mailing list