Results 1 to 9 of 9

Thread: GroupListView in Qt?

  1. #1
    Join Date
    Apr 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default GroupListView in Qt?

    Hi,

    is it possible to do something similar to this in Qt?
    http://objectlistview.sourceforge.ne...-grouplistview

    Cheers,
    Aya

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: GroupListView in Qt?

    Yes. Next time please open the documentation and search a little bit and/or post such questions in the newbie section. (moved!)

    See QTreeView or QTreeWidget.

  3. #3
    Join Date
    Apr 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: GroupListView in Qt?

    I don't see how I can do this with QTreeView/QTreeWidget by default - have you looked at the website link I posted??

    How can I do this grouping with QTreeView/QTreeWidget?

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: GroupListView in Qt?

    Quote Originally Posted by AyaKoshigaya View Post
    have you looked at the website link I posted??
    Yes, but have you read the documentation to QTreeView? Isn't the image https://qt-project.org/doc/qt-4.8/im...h-treeview.png almost what you want? The grouping must be indeed be done by the model or you, when using QTreeWidget.

  5. #5
    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: GroupListView in Qt?

    Quote Originally Posted by AyaKoshigaya View Post
    I don't see how I can do this with QTreeView/QTreeWidget by default - have you looked at the website link I posted??

    How can I do this grouping with QTreeView/QTreeWidget?
    The only difference I can see is the space betweeen top-level items. Subclassing QTreeView and reimplementing visualRect() should be enough to obtain that.
    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.


  6. #6
    Join Date
    Apr 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: GroupListView in Qt?

    Hi,

    the GroupListView on the website is more than just a simple QTreeWidget/View..
    The big difference is the grouping (in the example the rows with blue background) - Sure, I can do this by simply add an QTreeWidgetItem (or via a Model for QTreeView), but the text of the group-row can be longer than the cell it is in.

    So what I need (if I have to do the grouping myself) is the ability to have a row that ignores the column boundaries.
    I am not sure how I should describe it, in html it would be <td colspan="5">...

    Aya

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: GroupListView in Qt?

    As told, reading the documentation could help: QTreeView::setFirstColumnSpanned(). And the styling of the items can be easily done with a proper delegate. You might also want to read about model & view architecture in Qt.

  8. #8
    Join Date
    Apr 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: GroupListView in Qt?

    Thanks a lot, setFirstColumnSpanned() was very helpfull.

    Aya

    PS: Next time I will read trough the whole documentation before asking a question in this forum.. seems as if I got the idea of this forum wrong.

  9. #9
    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: GroupListView in Qt?

    Quote Originally Posted by AyaKoshigaya View Post
    the GroupListView on the website is more than just a simple QTreeWidget/View..
    No, it's not. Even the webpage you gave us a link to says that. It claims that sometimes you need something more than a flat list, that you need to have groups of items. (Un)Suprisingly that's exactly what a tree view does.
    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.


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.