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. getting data from tablewidget
Servers for Qt installer are currently down

getting data from tablewidget

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 943 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.
  • D Offline
    D Offline
    dziko147
    wrote on last edited by
    #1

    Hi All,

    Still new and learning so hope someone can help.

    I have a QTablewidget which I have filled with data. When I double click on a row in the tablewidget I would like to get particular data for example the data in cell (1) and cell(5).
    how can i Do this .
    thank you

    JonBJ 1 Reply Last reply
    0
    • D dziko147

      Hi All,

      Still new and learning so hope someone can help.

      I have a QTablewidget which I have filled with data. When I double click on a row in the tablewidget I would like to get particular data for example the data in cell (1) and cell(5).
      how can i Do this .
      thank you

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @dziko147
      This was just answered in https://forum.qt.io/topic/127899/how-to-get-value-of-cell-in-qtablewidget-on-double-clicking/2.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dziko147
        wrote on last edited by
        #3

        @JonB
        I posted a new Topic :) .
        So it's not the same operation .

        What i need is when i clicked on row , i get some particular data . Not those which i clicked on .
        I hope that my question was clear .

        JonBJ 1 Reply Last reply
        0
        • D dziko147

          @JonB
          I posted a new Topic :) .
          So it's not the same operation .

          What i need is when i clicked on row , i get some particular data . Not those which i clicked on .
          I hope that my question was clear .

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @dziko147
          So just change the code @VRonin gave you to pick up the desired cells instead of the one clicked on. It's just the same principle, nothing more to say.

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by VRonin
            #5
            QObject::connect(tableWidget,&QTableWidget::cellDoubleClicked,[=](int row, int column){
            QTableWidgetItem *cell1 = tableWidget->item(row,1);
            QTableWidgetItem *cell5 = tableWidget->item(row,5);
            QVariant myData1 = cell1->data(Qt::DisplayRole);
            QVariant myData5 = cell5->data(Qt::DisplayRole);
            qDebug() << myData1  << myData5;
            });
            

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            2
            • D Offline
              D Offline
              dziko147
              wrote on last edited by
              #6

              @VRonin thank you
              you made my day :)

              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