1
votes

I am trying to just click on an item in a list of items in a listwidget.

I right clicked in my UI and went to the slot:

void main::listWidget_itemClicked(QListWidgetItem* item)

In there I can run commands ect... But I want the selected item that I click on to be set to a String... I tried using the CONNECT/SIGNAL route, but I came up empty there.

It would theoretically look like this: QString text = ui->listWidget->itemClicked(); obv this is wrong, but I think it expresses what i am trying to do....

How can I do this?

1

1 Answers

4
votes

If I get you right, you just want to set the clicked item to a new String, right?

item->setText(someQString)

Edit:

I'm not sure what you mean with "set it to a string", but you can retrieve the text (a QString) of the item with

item->text()