Results 1 to 1 of 1

Thread: QFileSystemModel and QTableView

  1. #1
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFileSystemModel and QTableView

    i have a QTableView and i want to use QFileSystemModel as its model.
    so i tried this code ;

    Qt Code:
    1. QFileSystemModel *model = new QFileSystemModel;
    2. model->setRootPath(QDir::currentPath());
    3. model->setFilter(QDir::Files);
    4. tableView->setModel(model);
    To copy to clipboard, switch view to plain text mode 

    but the table does not show the files that are in the path. It just show one raw.

    so, what is wrong am i doing ??? how can i make it get all the files ALSO how can I filter the files with a specific string , so it wont get ALL the files just the ones that meet my filter.

    Thanks.


    Added after 37 minutes:


    ooh i was not using

    Qt Code:
    1. tableView->setRootIndex(model->index(QDir::currentPath());
    To copy to clipboard, switch view to plain text mode 

    for filtering the files with name, i can use model->setNameFilters(QStringList filters).
    Last edited by jesse_mark; 22nd March 2013 at 18:01.

Similar Threads

  1. Select all files [QTableView et QFileSystemModel]
    By snooker9 in forum Qt Programming
    Replies: 0
    Last Post: 23rd December 2011, 08:17
  2. Using QCompleter with QFileSystemModel
    By Marga in forum Newbie
    Replies: 0
    Last Post: 21st October 2011, 10:52
  3. Help with QFileSystemModel
    By TheShow in forum Qt Programming
    Replies: 4
    Last Post: 5th January 2010, 20:11
  4. Notifying QFileSystemModel about changes
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2009, 23:24
  5. QFileSystemModel has no sorting
    By mpi in forum Qt Programming
    Replies: 3
    Last Post: 28th May 2009, 08:14

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.