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



  • 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



  • @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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.