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. [solved]sort 2 tablewidgets simultaneously
QtWS25 Last Chance

[solved]sort 2 tablewidgets simultaneously

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 719 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.
  • I Offline
    I Offline
    iskenderoguz
    wrote on last edited by iskenderoguz
    #1

    I have 2 tablewidgets in form. I clicked column of first tablewidget and it was sorted. I want that second tablewidget was sorted wit same order. For example:

    first tablewidget

    ee
    cc
    bb
    aa
    dd
    ff

    and second tablewidget

    1
    2
    3
    4
    5
    6

    When I click column of first tablewidget, it becomes

    aa
    bb
    cc
    dd
    ee
    ff

    is it possible to second tablewidget is sorted automcatically like

    4
    3
    2
    5
    1
    6

    Thanks

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

      Hi,

      To be sure: QTableView or QTableWidget ?

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

        QTableWidget

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

          Then AFAIK, you will have to do it manually.

          It might be simpler to use 2 QTableViews with a common QAstractTableModel containing all the data

          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
          • I Offline
            I Offline
            iskenderoguz
            wrote on last edited by iskenderoguz
            #5

            Thanks to you and this topic I solved my problem

            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