QT ListWidget itemclicked into a String
-
09-10-2019 - |
Question
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?
Solution
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()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow