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 detect a row index change on a QTableWidget i.e. change of currentRow?
Forum Updated to NodeBB v4.3 + New Features

How to detect a row index change on a QTableWidget i.e. change of currentRow?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 2.0k 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.
  • GuerrianG Offline
    GuerrianG Offline
    Guerrian
    wrote on last edited by Guerrian
    #1

    ...and how do I create an appropriate signal for this?

    Linux Mint 18.3
    Qt 5.14.1
    Qt Creator 4.11.1

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

      Hi
      This is fired when selection changes
      http://doc.qt.io/qt-5/qtablewidget.html#currentCellChanged

      1 Reply Last reply
      2
      • GuerrianG Offline
        GuerrianG Offline
        Guerrian
        wrote on last edited by
        #3

        The trouble is currentCellChanged only fires if the user edits the cell. I want to detect when the user selects an cell or item in a different row. I tried to achieve this using the signal cellActivated, but it does not seem to fire when I was expecting:

        connect(ui->myTableWidget, SIGNAL(cellActivated(int, int)), this, SLOT(checkRowChanged(int, int)));

        Linux Mint 18.3
        Qt 5.14.1
        Qt Creator 4.11.1

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Guerrian said in How to detect a row index change on a QTableWidget i.e. change of currentRow?:

          The trouble is currentCellChanged only fires if the user edits the cell

          The documentation states something different:

          This signal is emitted whenever the current cell changes. The cell specified by previousRow and previousColumn is the cell that previously had the focus, the cell specified by currentRow and currentColumn is the new current cell.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3
          • GuerrianG Offline
            GuerrianG Offline
            Guerrian
            wrote on last edited by
            #5

            Ah, my mistake I was looking at cellChanged instead of currentCellChanged. Thanks

            Linux Mint 18.3
            Qt 5.14.1
            Qt Creator 4.11.1

            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