Results 1 to 9 of 9

Thread: QDirModel and QTreeView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2006
    Location
    Rheinland-Pfalz (Germany)
    Posts
    18
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Question QDirModel and QTreeView

    hi guys,

    i have a littel problem with QDirModel.

    Qt Code:
    1. QString workspace = QFileDialog::getExistingDirectory( this, tr("Open worspace"), QDir::homePath() );
    2. if ( workspace.isEmpty() )
    3. return;
    4.  
    5. QDirModel *model = new QDirModel();
    6. model->setFilter( QDir::AllDirs );
    7. model->setLazyChildCount( true );
    8. model->setData( model->index( workspace ), QVariant(workspace), Qt::DisplayRole );
    9. model->setHeaderData(0, Qt::Horizontal, workspace);
    10.  
    11. tvWorkspace->setModel( model );
    12. tvWorkspace->setRootIndex( model->index( workspace ) );
    13. tvWorkspace->header()->setSortIndicatorShown( true );
    14. tvWorkspace->header()->setClickable( true );
    15. tvWorkspace->setColumnHidden( 1, true );
    16. tvWorkspace->setColumnHidden( 2, true );
    17. tvWorkspace->setColumnHidden( 3, true );
    18.  
    19. connect( tvWorkspace, SIGNAL( clicked( const QModelIndex & ) ), this, SLOT( workspaceItemChanged( const QModelIndex & ) ) );
    To copy to clipboard, switch view to plain text mode 

    it is work but i see only the folders in this QTreeView:

    |-include
    |-src
    |-ui

    but i would like this:

    /home/alex/project/test
    |-include
    |-src
    |-ui

    i searched on forum index, but can not found items of this ....
    but how? can anyone help me? .....
    Last edited by ChMaster; 12th April 2006 at 23:31.
    Best regeards/kinds

    ChMaster

    Projects:
    DBoxFE
    DMS
    First4 (Plugin developer)

Similar Threads

  1. QDirModel and QTreeView cut and paste
    By Micawber in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2008, 20:16
  2. Edit items on QTreeView + QDirModel
    By junior0007 in forum Qt Programming
    Replies: 4
    Last Post: 23rd November 2007, 07:16
  3. QTreeView and QDirModel Header Sort Question
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 08:04
  4. Replies: 1
    Last Post: 15th March 2007, 20:45
  5. QDirModel and a QTreeView.
    By jamd in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 09:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.