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> Using a QTableWidget double click to populate a QListWidget
Forum Updated to NodeBB v4.3 + New Features

<SOLVED> Using a QTableWidget double click to populate a QListWidget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 4.2k 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.
  • J Offline
    J Offline
    jarope
    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 put the row details in to a ListWidget.

    Currently I have items being added to the list but they are blank. However you can highlight the row in the ListWidget so something is being added.

    @void MainWindow::on_tableWidget_doubleClicked(const QModelIndex &index)
    {
    QListWidgetItem *item = new QListWidgetItem();
    item->setData(0,index);
    ui->listWidget->addItem(item);
    }@

    So how do I make that something the cell content of nColumn of the table? I saynColumn as I wish to populate to lists with different columns.

    Thanks

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jarope
      wrote on last edited by
      #2

      @void MainWindow::on_tableWidget_doubleClicked(const QModelIndex &index)
      {
      QListWidgetItem *item = new QListWidgetItem(ui->listWidget);
      item->setData(0, index.data());
      ui->listWidget->addItem(item);
      }@

      Answer from nurupo on IRC many thanks to him

      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