how to add a tagline to QListWidet addItem() along with the data?
Hello everyone,
I am working with QListWidget and I am supposed to pass a string to my ListWidget using addItem.
I have a line ui->listwidget->addItem(QString::fromstdString(s2));
where as S2 consists of some values like 1 , 2 , 3 ........
Now I want my output on the screen as
The Output data:: 1
The Output data:: 2
........
How can I pass the string "The output data" to ListWidget.
It would be great help if someone can help me out.
Thank you
Re: how to add a tagline to QListWidet addItem() along with the data?
QString has a "+" operator that allows you to concatenate string into a new string.
Alternatively you can use QString::arg() to replace a placeholder in the fixed string with the runtime value from s2.
Cheers,
_
Re: how to add a tagline to QListWidet addItem() along with the data?
It worked :) Thank you very much