Results 1 to 2 of 2

Thread: QFileSystemModel hangs GUI on Windows

  1. #1
    Join Date
    Jul 2013
    Qt products
    Qt4 Qt5

    Default QFileSystemModel hangs GUI on Windows

    m_pqFileSystemModel = new QFileSystemModel;
    m_pqFileSystemModel->setRootPath( QDir::rootPath() );
    ui->qtvTreeView->setModel( m_pqFileSystemModel );

    GUI hangs on creation, and on subsequent expands of folders with large number of files.
    Anyone know how to speed things up ( on windows ) ?
    The problem is that a lot of work is being done on the GUI thread (don't know if all is just graphics or some work is done as well).

    Moving the QFileSystemModel object in a different thread solves the speed problem, but after a while the application crashes under a memory access violation exception.
    This problem is old as Qt and no answer is in given to date as to how to circumvent the problem.

  2. #2
    Join Date
    Mar 2011
    Hyderabad, India
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    MacOS X Unix/X11 Windows
    Wiki edits

    Default Re: QFileSystemModel hangs GUI on Windows

    Quote Originally Posted by Qt Doc
    QFileSystemModel uses a separate thread to populate itself so it will not cause the main thread to hang as the file system is being queried.
    So it must be somthing with you application.

    Also try setting the root path after QFileSystemModel::directoryLoaded() is emitted.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Replies: 7
    Last Post: 13th February 2014, 07:23
  2. Qt GUI app hangs sometimes
    By rampage644 in forum Qt Programming
    Replies: 7
    Last Post: 10th June 2011, 13:19
  3. Replies: 0
    Last Post: 5th April 2011, 13:40
  4. Replies: 1
    Last Post: 21st February 2011, 18:35
  5. Evaluation Example Dock Widgets Hangs Windows
    By inflector in forum Qt Programming
    Replies: 6
    Last Post: 30th December 2006, 20:03

Tags for this Thread


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.