Results 1 to 2 of 2

Thread: Indicating a folder when folder is empty in QTreeWidget using (+) sign

  1. #1
    Join Date
    Jan 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Indicating a folder when folder is empty in QTreeWidget using (+) sign

    Hi,
    I'm using QTreeWidget and want that the '+' sign will always appear,
    to indicate a folder, even when the folder is empty.
    How can I do this?

    (I tried to insert an empty file but I don't want it to be shown,
    so I used setHidden(true) and the '+' sign disappeared again)

    and ideas?
    thanks.
    tami.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Indicating a folder when folder is empty in QTreeWidget using (+) sign

    You will have to subclass the model to reimplement bool QAbstractItemModel::hasChildren ( const QModelIndex & parent = QModelIndex() ) const [virtual]


    But please do not do such things. There is a good reason why standard widgets behave the way they do. I respect that you want to increase the usability of your application by indicating a folder. But all other application indicate a folder by a folder icon and an empty folder by a folder icon without an expanding icon. Your application will be the only one that differs. This will confuse more than it helps: Oh, there is a plus, lets expand that folder. Oh, it does not work, looks like a bug. Maybe there is more bugs in that software, I shall better use a software with less bugs.
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. Deleting a Folder
    By GTBuilder in forum Newbie
    Replies: 9
    Last Post: 29th September 2009, 06:22
  2. Folder structure of Qt SDK
    By piotr.dobrogost in forum Installation and Deployment
    Replies: 19
    Last Post: 14th July 2009, 09:17
  3. Move a folder
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 2nd July 2007, 22:05
  4. Create folder
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 13th March 2007, 21:02
  5. Replies: 1
    Last Post: 23rd January 2007, 07: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.