Search code examples
c++qtqtablewidgetqcomboboxqlistwidget

How to get different items on qlistwidgets


is it possible to make it so that when selecting different rows from qtablewidget, different text is displayed in qlistwidget? data is added to qlistwidget from qcombobox, and to qcombobox from qstringlist

void MainWindow::on_addService_clicked()
{
   auto item = ui->serviceBox->currentText();
   ui->serviceListWidget->addItem(item);
}

I called itemSelectionChanged signal processing, but I do not know what to do?

I tried to clear the data from qlistwidget every time I selected a new line, but that's not what I wanted, when I selected a new line, there was a new text in qlistwidget


Solution

  • You can use the itemSelectionChanged signal of the tablewidget and connect it a slot which manipualtes the data in the listwidget.

    For details: