[Qt-interest] Add a QDir to a form

Scott Aron Bloom Scott.Bloom at onshorecs.com
Tue Oct 4 21:22:10 CEST 2011


Take a look at the code for QFileDialog:;getDirectory() for linux, for windows and OSX it uses the native dialog.. For linux it uses QFileSystemModel

 

Scott

 

From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com [mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On Behalf Of Cole, Derek
Sent: Tuesday, October 04, 2011 12:19 PM
To: Andre Somers; qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Add a QDir to a form

 

I can't seem to get this working just like I want. When I have the QTreeView populated with the directory structure, and I want to dive deeper into the structure, I would like for the columns to expand as I do this to fit the width of the path string. Do you have to tie a signal/slot together to make this resize the columns when someone starts expanding a directory tree?

 

Thanks

 

From: qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com [mailto:qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com] On Behalf Of Andre Somers
Sent: Monday, October 03, 2011 4:21 PM
To: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Add a QDir to a form

 

Op 3-10-2011 22:08, Cole, Derek schreef: 

So that seems to have me going down the right path. Do you know if there is any kind of convenience method for finding the absolute path of the currently selected directory that I am showing in a treeView?

Sure. QFileSystemModel has some additional data roles you can use for that (the getting the path part). For getting the current item, you can use QTreeView::currentIndex();

André





________________________________

From: qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com [qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com] on behalf of Andre Somers [andre at familiesomers.nl]
Sent: Monday, October 03, 2011 2:24 PM
To: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Add a QDir to a form

Op 3-10-2011 20:19, Cole, Derek schreef: 

Hello,

I am trying to build a pop-up dialog that would allow my users to select a directory, select some options, and click "Go" to run a process on files in the directory. I would like to make a dialog that contains the same type of "Select a directory" logic as a QDir can give me, but allows me to add some other labels, radio buttons, drop downs, etc, so that all of the options for a particular directoy can be set in one window. is this possible?

 

Sure. Take a look at QFileSystemModel, set the apropriate filters to only show directories, and display the model using a QTreeView.

André

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111004/4a676183/attachment.html 


More information about the Qt-interest-old mailing list