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. Table view, proxy and model
Forum Updated to NodeBB v4.3 + New Features

Table view, proxy and model

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 903 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.
  • ZoptuneZ Offline
    ZoptuneZ Offline
    Zoptune
    wrote on last edited by
    #1

    Hi

    I have 2 QTableView, displaying data from 2 QSortFilterProxyModel which have the same sourceModel.
    The first tableview display the data without filtering it but the second filter the data.
    What i want is to remove the selected row (in 1st tableview) from the second tableview.

    How can i identify, in the second view, the selected row in the first view ?

    Thx

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

      Hi,

      You need to implement a custom QSortFilterProxyModel and reimplement the filterAcceptsRow.

      On possibility would be to pass the selected row number to your custom proxy and not accept that row.

      Hope it helps

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

      ZoptuneZ 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        You need to implement a custom QSortFilterProxyModel and reimplement the filterAcceptsRow.

        On possibility would be to pass the selected row number to your custom proxy and not accept that row.

        Hope it helps

        ZoptuneZ Offline
        ZoptuneZ Offline
        Zoptune
        wrote on last edited by
        #3

        @SGaist
        Hi and thx for the reply,
        I tried to use filterAcceptsRow but i don't know how to give to the function the selected row in the first tableview.

        Thx

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

          Well, add a setter method to your custom proxy model and trigger the filtering if the row number changes.

          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
          0

          • Login

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