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

Table view, proxy and model

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 899 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.
  • Z Offline
    Z Offline
    Zoptune
    wrote on 13 May 2016, 13:49 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 13 May 2016, 21:15 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

      Z 1 Reply Last reply 17 May 2016, 07:41
      1
      • S SGaist
        13 May 2016, 21:15

        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

        Z Offline
        Z Offline
        Zoptune
        wrote on 17 May 2016, 07:41 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 17 May 2016, 20:05 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

          1/4

          13 May 2016, 13:49

          • Login

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