Results 1 to 2 of 2

Thread: How to integrate detailed information (with interaction/buttons) inside a QTreeView?

  1. #1
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to integrate detailed information (with interaction/buttons) inside a QTreeView?

    I need to display a "list" of entries.
    [Something like: a list of persons, and collapseable displayable:
    * a HTML rendered business card
    * perhaps a collapseable list of hobbies
    * to the left: perhaps an image of that person
    * etc.
    It boils down to: I have a list of stuff and would like to display various "details" usually upon user request. I do not want these to pop up in separate windows but integrated in that list.]


    Each entry has some attributes. Obvious choice: a QTreeView.

    However, I need to support displaying additional content.
    This content should be
    • calculated on demand
    • collapseable
    • large: span all the columns; take the space of several rows
    • probably HTML (text in different colors at the very least)
    • contain small buttons (possible hyperlinks are ok), but real buttons might be required
    (collapseable) beneath a row.

    Spanning column one, collapsing etc is supported by QTreeView.
    But... is it also possible to add further widgets inside the (probably delegate rendered HTML?) I also would like to interact with this "details subview" without going into edit mode or so.

    Is it possible to do that with a QTreeView (or another existing Qt widget, for that matter)?
    Or do I have to create a new widget (rather: put lots of widgets in layouts) to achieve that?
    Are there empirical results on how many widgets at the same time are manageable with Qt (4.4)?
    (I would need to be able to show at least 100 rows. If all content is done with QLabels, QFrames, and Buttons that would mean several thousand widgets, I guess. Might be a performance issue.)

    I hope my problem is somewhat clear.

    Looking forward to your suggestions
    Christoph

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to integrate detailed information (with interaction/buttons) inside a QTreeVi

    I'd suggest creating a model that holds your data so that is shows the list properly in a tree view.

    Each of these item would pretend to have one child but you can return an invalid variant upon any data() call for these.

    Then you have to create a custom delegate or to set a custom widget for each of these child items so that it displays your additional data. (the widget is probably the simplest way and the delegate the most performant and lightweight...). Use QAbstractItemView::setItemDelegateForRow() or QAbstractItemView::setIndexWidget() to achieve this
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

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.