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. QTableView QListview setselectionModel()
Forum Updated to NodeBB v4.3 + New Features

QTableView QListview setselectionModel()

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.9k 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.
  • S Offline
    S Offline
    samdol
    wrote on last edited by
    #1

    For innterview in qt-demo, QTableView, QTreeView and QListView share the same model. So that if I set setSelectionModel() correctly, then when I select (0,0) cell in tablevew, then 0th item in list is selected. But when I select (0,1) cell in table, no item in list is selected because all items in listview have the column number 0. I did manually by connecting selectionchanged signal in tableview to the slot on listview to select (row_corresponding, 0). It works but it is quite slow for more than 10000 rows.
    Is there any option to make it possible so that when I select (0,1) cell in tableview, (0,0) cell in listview is selected automatically?

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

      Hi,

      Are you using single element selection or would row selection be valid ?

      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
      • S Offline
        S Offline
        samdol
        wrote on last edited by
        #3

        I am using single cell selection as selectionbehavior. If I change the selection behavior to select whole row, then it will solve the problem. But in my code I created parts assuming single cell selection.

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

          Are you doing any editing with that QListView ?

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

          S 1 Reply Last reply
          0
          • SGaistS SGaist

            Are you doing any editing with that QListView ?

            S Offline
            S Offline
            samdol
            wrote on last edited by
            #5

            @SGaist
            I do not edit on items on Listview. It simply displays Icons.

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

              Out of curiosity, why do you need all these view separately ?

              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