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] Retrieving an entire row of data from a QTableWidget
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Retrieving an entire row of data from a QTableWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k 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.
  • C Offline
    C Offline
    Chrisw01
    wrote on last edited by
    #1

    Hi, and help, I cannot seem to wrap my head around this, I have a popup window that has a QTableWidget named messageBox with 6 columns in it which I have the flags set to select the whole row upon clicking on it with

    @
    setSelectionBehavior(QAbstractItemView::SelectRows);
    @

    Then I have connected the double click signal to it with

    @
    connect(messageBox, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(commentBoxItemClicked(QTableWidgetItem*)));
    @

    It works fine, the signal fires when expected to but the *item only contains the column that was clicked, what needs to be done to pass the whole row to the slot instead of just the particular cell that was clicked.

    Thanks in advance.

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

      Hi,

      The item provides both information with the row and column information. To get the other items the you just have to iterate over all the columns in the given row. Or use the selectedItems() function

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

        Hi, and thanks for pointing me in the right direction.

        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