Results 1 to 7 of 7

Thread: Display System Drives in Specific Order in QTreeView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Posts
    24
    Thanks
    4
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Display System Drives in Specific Order in QTreeView

    I have a treeview where I am displaying all system drives using QFileSystemModel. I am looking for much better approach where a tree view can display Local Drives in one section, Removable Drive in another and so on.

    Here is the code:
    Qt Code:
    1. pSystemPrimaryModel = new QFileSystemModel(this);
    2. /* Sets the directory that is being watched by the model to currentPath by installing
    3.   a file system watcher on it. */
    4. pSystemPrimaryModel->setRootPath(QDir::currentPath());
    5. pSystemPrimaryModel->setFilter( QDir::AllDirs | QDir::NoDotAndDotDot );
    6. // Sets the model for the view to present.
    7. ui->PrimTreeView->setModel(pSystemPrimaryModel);
    8. // Regard less how many columns you can do this using for:
    9. for(int nCount = nColCount; nCount < pSystemPrimaryModel->columnCount(); nCount++)
    10. ui->PrimTreeView->hideColumn(nCount);
    To copy to clipboard, switch view to plain text mode 
    It gives me the following:
    Image.JPG
    I want to display it like the second picture shown above. How can that be achieved?

  2. The following user says thank you to owais_blore for this useful post:


Similar Threads

  1. Replies: 8
    Last Post: 7th May 2012, 23:51
  2. Changing QTableView column display order
    By scarleton in forum Qt Programming
    Replies: 3
    Last Post: 18th October 2010, 00:04
  3. display order of subwindows in mdi area
    By eric_vi in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2010, 16:05
  4. QTreeView: get current sort column and order
    By supergillis in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2008, 17:25
  5. Changing the order of columns in QTreeView
    By johnny_sparx in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2006, 00:00

Tags for this Thread

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.