Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, January 2008
QDir model question


Message 1 in thread

Hello I have following code working as expected showing my home directory:

        QDirModel *model = new QDirModel;
        treeView->setModel ( model );
        treeView->setRootIndex( model->index ( QDir::currentPath() ) );

Now I do not find how I can change the initial view to a different
directory.

Can anyone help me out?

BR
Eckhard

--
 [ signature omitted ] 

Message 2 in thread

I found it finally.
Eckhard

--
 [ signature omitted ] 

Message 3 in thread

On Wednesday 16 January 2008 17:28:34 Eckhard Jokisch wrote:
> Hello I have following code working as expected showing my home directory:
>
>         QDirModel *model = new QDirModel;
>         treeView->setModel ( model );
>         treeView->setRootIndex( model->index ( QDir::currentPath() ) );
>
> Now I do not find how I can change the initial view to a different
> directory.
>
> Can anyone help me out?

This should work:
    treeView->setRootIndex( model->index ( "/my/path" ) );

David.

--
 [ signature omitted ]