[Solved] "External delegate" and model-view code



  • Qt version = 5.1.1

    Hello.
    In my program I have a class based on QAbstractItemModel that works with QTreeView to show me table with some data, and this works good. Now I need to show big and detailed view of currently selected item of the tree beside the tree, also this detailed view must be updated on every change of currently selected item data (data changes happens from time to time without user participation).
    I see following variants:

    Retranslate events like "data changed" of model and events like "selection changed" of view to detailed-view widget

    Use delegate, retranslate it's events to detailed-view widget

    Make another view that will show only currently selected item

    Use QDataWidgetMApper (somehow)

    Can you advise me how to achieve my goal?

    P.S. Sorry for my english



  • I don't know what does the detailed data represent for you, if you need just showing the data in a larger widget the options 3 or 4 could be approached ... moreover if the detailed data means something which is not in model but identified by an id data kept in the tree model then option 3 would be much recommended



  • So... I decided not to waste my time with subclassing and other scary stuff and finished with option 1. Hah :)



  • It was not so smart. Now my "delegate" listens to currentChanged of selection model and rowsInserted of data model (it looks like option 3, right?). That's it, pretty simple.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.