Results 1 to 6 of 6

Thread: The correct widget for a file/directory listing?

  1. #1
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default The correct widget for a file/directory listing?

    Hi

    I am looking into the examples provided by QT and see that they use a QTreeView and QDirModel to show a list of files. I also noticed that I could use QDirModel and QListView to get a list without details.

    My question is; If I only want the list of files (with details) but not a tree, what widget is the most correct one to use? I know I can use setRootIsDecorated and setItemsExpandable to achieve the desired result with QTreeView, but I just want to know if this is OK or if there is a better widget for this purpose?

    Also; When I use the QTreeView with the mentioned options I get no way of traversing the filetree (since the tree is gone). How can I make directories "clickable" so the QDirModel changes to the supplied directory?

    Trying to learn the basics

  2. #2
    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: The correct widget for a file/directory listing?

    Yes, QTreeView is the best choice for a "detailed view", a multi-column list. See this thread: http://www.qtcentre.org/forum/f-qt-p...wser-1625.html.
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    invictus (4th November 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The correct widget for a file/directory listing?

    It is just a bit weird to use a Tree when I am not interested in a tree at all...

  5. #4
    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: The correct widget for a file/directory listing?

    That's just the way it is in Qt 4. QListView is a "flow" of items from top to bottom or from left to right. There is no such concept as "column" when it comes to QListView in Qt 4.
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    invictus (4th November 2007)

  7. #5
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: The correct widget for a file/directory listing?

    How about QTable?

  8. #6
    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: The correct widget for a file/directory listing?

    Well, you could use QTableView too, but it's not so umm.. sophisticated? Take a look at the widget gallery and you'll see the difference: http://doc.trolltech.com/4.3/gallery-plastique.html
    J-P Nurmi

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.