Results 1 to 2 of 2

Thread: Failing to use QFileSystemModel in Qt

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

    Question Failing to use QFileSystemModel in Qt

    I am a newbie in QT. I am working on a app where I need to display the FileSystem using a treeview.

    Basically I have a widget in my .ui file on which I have put a Treeview. Then in my .cpp file I have written the following code:

    Qt Code:
    1. model = new QFileSystemModel(this);
    2. model->setRootPath(QDir::homePath());
    3. ui->treeView->setModel(model);
    To copy to clipboard, switch view to plain text mode 

    In my .h file I have put the following:

    Qt Code:
    1. QFileSystemModel *model;
    To copy to clipboard, switch view to plain text mode 

    When I run the app, it displays the file system inside the treeview but it also shows Name, Type, Size, DateModified above it. I want to get rid of these.

    How can I achieve it?
    Last edited by owais_blore; 16th November 2012 at 08:35.

  2. #2
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Failing to use QFileSystemModel in Qt

    If you mean you don't want the header visible then
    Qt Code:
    1. ui->treeView->header()->hide()
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. table view and tree view
    By MKSPulok in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2012, 22:48
  2. Not able to remove the root of the tree widget.
    By aurora in forum Qt Programming
    Replies: 1
    Last Post: 30th December 2011, 14:04
  3. Replies: 8
    Last Post: 6th May 2010, 12:17
  4. Tree View
    By bismitapadhy in forum Qt Programming
    Replies: 1
    Last Post: 8th June 2009, 07:31
  5. tree view!!
    By Seema Rao in forum Qt Programming
    Replies: 4
    Last Post: 9th May 2006, 15:09

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.