Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. Managing multiple data sources
Forum Updated to NodeBB v4.3 + New Features

Managing multiple data sources

Scheduled Pinned Locked Moved Unsolved The Lounge
2 Posts 2 Posters 490 Views 2 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.
  • J Offline
    J Offline
    Jsevenh
    wrote on last edited by
    #1

    Hello, I'm currently tackling a task involving hierarchical data items, and I've opted to utilize QtTreeView, QStandardItem, and QStandardItemModel. Each label in the tree view corresponds to its own dataset. My goal is to efficiently store and display all this data using a single widget. The functionality I'm aiming for is that when I click on a tree view entry, the associated data should be presented on the widget. Additionally, any edits made to the data should be updated in the corresponding data source. I also want to store the widget's state when switching to a different tree item.

    In my attempts to achieve this, I experimented with QStandardItem to associate widgets with their respective data. I stored their UI in a stacked widget, resulting in a stacked widget with entries equal to the number of elements in the tree view. This way, when an item is selected, the index of the stored widget becomes the current one. However, I'm unsatisfied with this implementation and believe there might be a more effective approach. I would appreciate any suggestions for a better implementation. Thanks!
    Note that I'm a Qt noob, I've been using Qt for less than 2 months.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Looks like you might want to check QDataWidgetMapper.

      You are correct that creating one widget per entry in your view is not a good design choice.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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