Change a label's text when a variable changes
Solved
General and Desktop
-
wrote on 17 Sept 2020, 16:37 last edited by
I currently have this label:
ui->label->setText("<font color='red'>Changing...");
But i want it to output "Changing...X/10" With X being a certain variable that is being incremented in a loop, How would I pass in the int variable to the text
-
I currently have this label:
ui->label->setText("<font color='red'>Changing...");
But i want it to output "Changing...X/10" With X being a certain variable that is being incremented in a loop, How would I pass in the int variable to the text
wrote on 17 Sept 2020, 16:43 last edited by JonB@rtvideo
Look at theQString::arg()
family of methods, like the example at https://doc.qt.io/qt-5/qstring.html#arg. There is alsoQString::number()
for just a number alone. -
@rtvideo
Look at theQString::arg()
family of methods, like the example at https://doc.qt.io/qt-5/qstring.html#arg. There is alsoQString::number()
for just a number alone.
1/3