for (int i = 0; i < listWidget->count(); ++i) {
listWidget->item(i)->setForeground(Qt::yellow);
qDebug() << listWidget->item(i)->text();
}
To copy to clipboard, switch view to plain text mode
I am not sure the second part of your question means. The QListWidget contains a list of pointers to QListWidgetItem objects. You can subclass QListWidgetItem to do something special and insert pointers to subclass objects. You can also store any data that can fit into a QVariant against a Qt::UserRole using QListWidgetItem::setData() and QListWidgetItem::::data().
Thank you very much.
By my second question i meant, Is there a way that i can store refrences to any other objects rather than just simple string texts?
and you forgot to answer my third question on C#s Tostring() method counter part in QT.
Bookmarks