Results 1 to 3 of 3

Thread: QFileSystemModel crash when rename

  1. #1
    Join Date
    Jan 2011
    Posts
    127
    Thanks
    42
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QFileSystemModel crash when rename

    Qt Code:
    1. #include <QtCore>
    2. #include <QtGui>
    3.  
    4. int main(int argc, char **argv)
    5. {
    6. QApplication app( argc, argv );
    7.  
    8. QFileSystemModel model;
    9. QString const rootPath = "E:/file_test/very big";
    10.  
    11. QTableView view;
    12. view.setModel(&model);
    13. view.setRootIndex(model.setRootPath(rootPath));
    14.  
    15. QSplitter splitter;
    16. splitter.addWidget(&view);
    17. splitter.show();
    18.  
    19. return app.exec();
    20. }
    To copy to clipboard, switch view to plain text mode 

    Under the folder "very big" consist 8448 jpg, when I using a tool(Bulk rename utility) to rename the
    jpg under "very big", the program will crash. How could I stop the self updating function of QFileSystemModel?
    Thanks


    Added after 5 minutes:


    I want to told QFileSystemModel don't update the data even there are files being renamed
    Do I have to reimplement some functions of QFileSystemModel?Thanks
    Last edited by stereoMatching; 29th July 2012 at 06:59. Reason: give it a better title

  2. #2
    Join Date
    Jan 2011
    Posts
    127
    Thanks
    42
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFileSystemModel crash when rename

    Is this question too advance or my courtesy is no good?
    I ask other questions about QFileSystemModel on this forum but rarely get responses

    If I violate the rules or lack of courtesy, please tell me and I promise I will
    change.Thank you very much

  3. #3
    Join Date
    Jan 2011
    Posts
    127
    Thanks
    42
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFileSystemModel crash when rename

    1 : I find out the QDirModel will not update until you call "refresh"

    2 : even I do not setup the model for the view, rename the files will affect
    the main thread(GUI) seriously.No wonder why even I rename the files
    on another thread, the GUI still stall.

    Qt Code:
    1. int main( int argc, char **argv )
    2. {
    3. QApplication app( argc, argv );
    4.  
    5. QFileSystemModel model;
    6.  
    7. QString const rootPath = "E:/file_test/very big";
    8. model.setRootPath(rootPath);
    9.  
    10. QTableView view;
    11. //I haven't set any model for The view, but the program still
    12. //crash if I rename 8448 of my jpg files by other program
    13.  
    14. QSplitter splitter;
    15. splitter.addWidget(&view);
    16. splitter.show();
    17.  
    18. return app.exec();
    19. }
    To copy to clipboard, switch view to plain text mode 

    There are still more than 1XX pages of the model/view architecture I have to studied(advanced Qt programming)
    I hope I could know how to prevent the automatic "refresh" function of the QFileSystemModel after
    I finish the chapter 4, 5, 6 in the book

    QDirModel is not a good solution, but looks like it could solve my problem for now.

    Never expect that customize the model/view of Qt4 could be so complicated(2XX pages to study)
    And I am still a newbie of Qt...
    Last edited by stereoMatching; 30th July 2012 at 17:29.

Similar Threads

  1. Proxy for the QFileSystemModel
    By stereoMatching in forum Newbie
    Replies: 0
    Last Post: 26th July 2012, 12:26
  2. Using QCompleter with QFileSystemModel
    By Marga in forum Newbie
    Replies: 0
    Last Post: 21st October 2011, 10:52
  3. Replies: 2
    Last Post: 28th April 2011, 19:21
  4. Help with QFileSystemModel
    By TheShow in forum Qt Programming
    Replies: 4
    Last Post: 5th January 2010, 20:11
  5. QDirModel or QFileSystemModel?
    By ricardo in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2009, 17:10

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
  •  
Qt is a trademark of The Qt Company.