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. Get data from QTreeWidgetItem -> itemClicked
Forum Updated to NodeBB v4.3 + New Features

Get data from QTreeWidgetItem -> itemClicked

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

    Hi...
    i have this signal/slot in QTreeWidgetItem :

    connect(ui->treeWidgetWiFis,SIGNAL(itemClicked(QTreeWidgetItem *,int)),this,SLOT(apri_connessione(QTreeWidgetItem*)));
    

    The function apri_connessione have:

    void MainWindow::on_treeWidgetWiFis_itemClicked(QTreeWidgetItem *item, int column)
    {
    
    }
    

    How to get the data clicked in the item inside apri_connessione() ?

    Thank you
    Francesco

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      item->data(column,Qt::EditRole) http://doc.qt.io/qt-5/qtreewidgetitem.html#data

      "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
      • darkstaringD Offline
        darkstaringD Offline
        darkstaring
        wrote on last edited by
        #3

        1000 Thanks...
        Can i get entire row data ?

        Now i get the item clicked, but is a table with:
        | aaa | bbb | ccc |
        | xxx | yyyy | zzz |
        if click on zzz i get only the zzz while i need all row...

        Thanks

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4
          for(int i=0;i<item->columnCount();++i)
          qDebug() << item->data(i,Qt::EditRole);
          

          "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
          3
          • darkstaringD Offline
            darkstaringD Offline
            darkstaring
            wrote on last edited by
            #5

            Many thanks..

            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