PDA

View Full Version : How to show the file system as a Windows user expects to see it



Coises
15th November 2009, 23:31
I’m new to Qt. I’ve run into something that makes so little sense, I suspect I’m just missing something obvious. I’m using Windows XP.

In my application I want to present an “Explorer” control for file selection. (A QFileDialog would be too clumsy, because the user will be selecting and dragging various files while running the program.) Connecting a QFileSystemModel to a QTreeView almost works, but there’s a problem.

The control shows the disk drives at the top level (with My Computer as the implied, unseen root). No Windows program would ever present an Explorer view this way — half the Windows users out there probably couldn’t even find their desktops and documents starting from the root of the C:\ drive.

Windows always displays the Desktop as the top-level entry, with My Documents and My Computer as the first two entries beneath it.

How do I get this ubiquitous Windows Explorer tree presentation under Qt4 (at least when running under Windows — I have no idea how it should appear on other systems, but hopefully it would appear in each consistently with the way that system normally presents its file system), instead of the drives-at-top presentation, which makes perfect sense to geeks but would be incomprehensible to the average Windows user?

franz
16th November 2009, 08:10
Look into QDesktopServices.