How can I get the texts of all the widgets in a QListWidget
as a QList<QString>
?
I can get the list of widget items like this:
QList<QListWidgetItem *> items =
ui->listWidget->findItems(QString("*"), Qt::MatchWrap | Qt::MatchWildcard);
But that's not exactly what I want, I'd like the list of the widget text()
properties.
There is no built-in function for that, you'll need to do it manually.
QList<QString> texts;
foreach(QListWidgetItem *item, items)
texts.append(item->text());
Or something like that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With