Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] "External delegate" and model-view code
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    YuriQ
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NicuPopescu
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        YuriQ
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • Y Offline
          Y Offline
          YuriQ
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved