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. how to connect two models of different tableview
Forum Update on Monday, May 27th 2025

how to connect two models of different tableview

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 307 Views
  • 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.
  • MihanM Offline
    MihanM Offline
    Mihan
    wrote on last edited by
    #1

    i want to show different data on different tableview, the data is ralated. For example, there is a school,which has many classes(show on view1),one class has many students and they have different achievements(show on view2).When I choose a class on view1,view2 will show the students in this class with their achievements.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      Looks like you want a KSelectionProxyModel

      (The KDA APIs do not work only on KDE, don't worry)

      If you need a single item you can build the model as a tree and use https://doc.qt.io/qt-5/qtableview.html#setRootIndex

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      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