Results 1 to 9 of 9

Thread: Simple QFileSystemModel and TreeView Example

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2013
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Simple QFileSystemModel and TreeView Example

    Santosh,

    I sure something is missing.
    What exactly would be missing?

    It is very obvious not to wonder why the native applications can perform better. Don't expect a better performance (at-least in this case)
    C++ QT Applications are native applications. If they are not then I've been misinformed.

    There is clearly a difference between "" (nothing) and "/" (root directory)
    Clearly, do you know what the difference is? If I missed it in the documentation then my mistake.

    Enable sorting on the QTreeView
    I'm on that path, as long as performance doesn't suffer for large data sets.

    If this is not solved, I will look at this some time next week
    I would prefer a pointer to documentation or a hint rather than solving this problem for me. I simply thought I would ask here in this "friendly" forum for newbies to see if this has already been solved by other friendly QT users. No point in re-inventing the wheel.

    Thanks,

    Zep

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Simple QFileSystemModel and TreeView Example

    C++ QT Applications are native applications. If they are not then I've been misinformed.
    Qt provides a consistent interface across the platforms, it uses the native APIs, using a wrapping/mapping mechanism (allowed as per C++, or interpreted by moc). Yes, you are right in making a statement that Qt Apps are native applications (in the way they execute), but they still differ from the application built on native technologies (frameworks), as for a simple reason that wrapping functionality brings in things that a cross-platform behavior needs.

    Clearly, do you know what the difference is? If I missed it in the documentation then my mistake.
    I can clearly see the difference between ""(nothing) and "/"(root). Please don't expect the documentation to mention all the invalid parameters that can be supplied.

    I'm on that path, as long as performance doesn't suffer for large data sets.
    For sure there will be a performance degrade for large data sets. To avoid this one will need to implement a special mechanism to sort, like proxy models, sorting in a worker thread etc.

    I would prefer a pointer to documentation or a hint rather than solving this problem for me. I simply thought I would ask here in this "friendly" forum for newbies to see if this has already been solved by other friendly QT users. No point in re-inventing the wheel.
    First things first, sure this is a friendly forum (if I may speak on behalf). I said so as a friendly gesture to see at the post (if not solved). Sure I don't have time to re-invent the wheel
    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.

  3. #3
    Join Date
    Jan 2013
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Simple QFileSystemModel and TreeView Example

    Santosh,

    Thank you for your reply and your time spent helping me to understand this.

    Qt provides a consistent interface across the platforms, it uses the native APIs, using a wrapping/mapping mechanism (allowed as per C++, or interpreted by moc). Yes, you are right in making a statement that Qt Apps are native applications (in the way they execute), but they still differ from the application built on native technologies (frameworks), as for a simple reason that wrapping functionality brings in things that a cross-platform behavior needs.
    Yes, I understand the need for a layer to enable a cross platform framework such as QT however an 8-10 second delay while my entire UI becomes unresponsive is not acceptable to me nor my end users. QT is such a well written API that I must assume I am doing something wrong, hence my original post. The documentation for QFileSystemModel clearly states:

    Unlike QDirModel(obsolete), 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. Calls to rowCount() will return 0 until the model populates a directory.
    If this is the case, why is my UI unresponsive? Keep in mind my UI consists of a single QTreeView Widget.

    I can clearly see the difference between ""(nothing) and "/"(root). Please don't expect the documentation to mention all the invalid parameters that can be supplied.
    I agree with that. However, a well designed API will guard against invalid parameters. I see QT as a well designed API, hence my thought that I was doing something wrong.

    Also, I don't want to derail this thread but in the few weeks I've been lurking here and reading posts I've noticed some minor hostility toward those asking questions or trying to learn QT. As I'm evaluating QT for a commercial application, the community is very important to us, especially for an open source project like QT. Are there other sites you would recommend we visit to get a less narrow minded view of the QT community?

    Thanks,

    Zep

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Simple QFileSystemModel and TreeView Example

    I know we have deviated a bit from the thread topic, but it could be informative to others forum users

    Again first thing is that we are dealing with Qt (cute) not QT.

    If this is the case, why is my UI unresponsive? Keep in mind my UI consists of a single QTreeView Widget.
    QTreeView depends on QAbstractItemModel. If the model does not provide data in time, or just goes for a hike for 8 to 10 seconds (just kidding), QTreeView has nothing else to do but to wait for whatever time it takes the model to return the data.

    I agree with that. However, a well designed API will guard against invalid parameters. I see QT as a well designed API, hence my thought that I was doing something wrong.
    I will say the well designed API did not crash on invalid parameter, it did sustain itself and the software reading the output has to appreciate that

    Also, I don't want to derail this thread but in the few weeks I've been lurking here and reading posts I've noticed some minor hostility toward those asking questions or trying to learn QT.
    Well it all depends on how people take it. As far as I understand all such post(s) are to motivate the users to think/research/learn from the information, questions, discussions and off-course talks (like this post).

    As I'm evaluating QT for a commercial application, the community is very important to us, especially for an open source project like QT.
    Qt Commercial and Qt Project(open source) are very different when it comes to licensing. Please don't get confused between them.
    Are there other sites you would recommend we visit to get a less narrow minded view of the QT community?
    Obviously the project site http://qt-project.org/
    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.

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

    Default Re: Simple QFileSystemModel and TreeView Example

    I don't really want to reply to all that was written here so I'll be brief. To solve the issue I suggest the OP takes a look at the source code of QFileSystemModel to see why "" and "/" differ and why his GUI gets stalled for 8-10 seconds. We have no access to his code so the only thing we can do is to look into QFileSystemModel ourselves which I'm assuming the OP is capable of doing on his own.

    Edit: Here is the source code: http://qt.gitorious.org/qt/qtbase/bl...ystemmodel.cpp
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 10
    Last Post: 25th November 2010, 11:33
  2. Help with QFileSystemModel
    By TheShow in forum Qt Programming
    Replies: 4
    Last Post: 5th January 2010, 20:11
  3. Notifying QFileSystemModel about changes
    By squidge in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2009, 23:24
  4. QDirModel or QFileSystemModel?
    By ricardo in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2009, 17:10
  5. QFileSystemModel has no sorting
    By mpi in forum Qt Programming
    Replies: 3
    Last Post: 28th May 2009, 08:14

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