Results 1 to 9 of 9

Thread: QTreeView and QDirmodel 's problem?

  1. #1
    Join Date
    Jun 2007
    Posts
    10

    Default QTreeView and QDirmodel 's problem?

    hello ,everyone!
    I am new member in Qt programing,now, I have a problem with the QTreeView.
    the question is:when I set the QTreeView's model with QDirmodel,then ,the program's speed is very slow and the harddisk has the "gege" noise,why?

    thanks !

  2. #2
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeView and QDirmodel 's problem?

    Sample of code I could compile and test, maybe ?

    I use this combination here with Qt 4.3, and it works fine

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeView and QDirmodel 's problem?

    In Qt4.3 the dir model behaviour was changed - the directory scan has been delayed until the respective branch of the tree is accessed.

    In older releases the initial slowdown is caused by the model subtree being built (all the directories are scanned).

  4. #4
    Join Date
    Jun 2007
    Posts
    10

    Question Re: QTreeView and QDirmodel 's problem?

    thandks for your answer!
    the Qt I am used is Qt4.2.3,and the OS is WindowsXP; According to your reply,how can I deal with the question?Can I set the directory path in QModel before the program run?So,it can reduce the scan time。
    thanks a lot!

  5. #5
    Join Date
    Jun 2007
    Posts
    10

    Default Re: QTreeView and QDirmodel 's problem?

    when I do this :

    QDirmodel* dmodel=new QDirmodel;
    dmodel->setreadonly(true);//If the paramenter is false ,then the speed is very slow.

    then the program's speed is as fast as before;why? help me!

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeView and QDirmodel 's problem?

    It could be that the model is asking the filesystem for read/write permissions and that it's kind of slow on your system. Do you need your model to be rewritable?

  7. #7
    Join Date
    Jun 2007
    Posts
    10

    Default Re: QTreeView and QDirmodel 's problem?

    yes,I want to change the model? for example,change a file's name.

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeView and QDirmodel 's problem?

    Have you given Qt 4.3 a try?
    J-P Nurmi

  9. #9
    Join Date
    Jul 2012
    Posts
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeView and QDirmodel 's problem?

    i have this problem
    any one cant't help me?

Similar Threads

  1. QTreeView and QDirModel Header Sort Question
    By jimroos in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 09:04
  2. Replies: 1
    Last Post: 15th March 2007, 21:45
  3. QDirModel and a QTreeView.
    By jamd in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 10:41

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.