Results 1 to 4 of 4

Thread: QDirModel - show directory ".."?

  1. #1
    Join Date
    May 2006
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QDirModel - show directory ".."?

    Using QTreeView and QDirModel can access local
    file system but the directory ".." does not appear.

    How to show directory ".."?

    Appears on the following way:

    (none)
    |-AA
    |-BB

    I want:

    directory
    |-AA
    |-BB


    Thanks.

  2. #2
    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: QDirModel - show directory ".."?

    Quote Originally Posted by jamd
    Using QTreeView and QDirModel can access local
    file system but the directory ".." does not appear.
    It is because ".." is really not part of the directory tree, it is only needed if you have a flat, table-like, view.

    How to show directory ".."?
    Two ways:
    1. Subclass QDirModel and reimplement for example data(), rowCount() and maybe some others
    2. Subclass QAbstractProxyModel and implement a proxy between the dir model and the view which will add the item on the view's side.

  3. #3
    Join Date
    Apr 2009
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QDirModel - show directory ".."?

    I have the same problem, could you post some more information or code, please?
    I don't know how to subclass the QDirModel so that ".." is displayed first. All my attempts didn't work.

  4. #4
    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: QDirModel - show directory ".."?

    What exactly did you try? Maybe you should go for QFileSystemModel instead?
    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. WYSIWYG html, Window show png icon mac no!
    By patrik08 in forum Qt Programming
    Replies: 10
    Last Post: 25th May 2006, 13:01
  2. QtSingleApplication
    By mule in forum Qt Programming
    Replies: 8
    Last Post: 28th February 2006, 20:21
  3. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 11:04
  4. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 13:54
  5. QT Service and working directory
    By Lele in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 12:46

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.