Results 1 to 2 of 2

Thread: Custom Dir View - Folders first, with improved Sort Functions

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Posts
    5
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Question Custom Dir View - Folders first, with improved Sort Functions

    Hi,

    I´m trying to create a Widget that displays the content of a "virtual Folder".
    "Virtual Folder", since the Elements, that need to be displayed later, were delivered by a Server in XML Format.
    The XML File contains all informations, that QDir and QFileInfo would offer.

    If possible, I would like to realise the whole Widget in a single extended subclass of QTreeWidget.


    2 Points need to be considered:

    1.) The Folders should always be displayed on top. While Files can be sorted by Name, Type, Size, ... (Asc & Dsc), the Folders should always be sorted by Name (Asc / Dsc) and stay on top of the list.

    2.) The Columns should contain Human readable data (QStrings), but need to be sorted by sortable values (QStrings, qint64, QDateTime, ...)

    i.e. the Size Columns:

    Text in Item Column : 1,00 Mb (QString) - should be sorted by -
    Data in Item Column : 1048576 (qint64 )


    Basically, you can reduce my post to one single question:

    Is there a way to differ between the displayed Text and the (hidden) sortable value of an Item?

    I would use this as an advantage, to hold the Folders always on Top, by prepending data to the sortable values.


    Thanks in advance for any kind of clue.
    Attached Images Attached Images
    Last edited by Threepwood; 24th June 2010 at 11:07.

Similar Threads

  1. Custom Model? Custom View? Custom Delegate?
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 11th February 2010, 20:23
  2. dataChanged does not re-sort the view
    By alex9099 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2008, 20:14
  3. QTreeWidget (Row Check, Custom Sort)
    By AaronMK in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2008, 15:55
  4. Custom sort with QTableWidget
    By nicolas44 in forum Qt Programming
    Replies: 1
    Last Post: 9th August 2007, 00:47
  5. Drag and drop items in view to sort order
    By Big Duck in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2006, 19:43

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.