How to set a int variable in a QLabel next to normal text?
-
Hey,
I want to place a variable next to plain text.
ui->MessageLabel->setText("You have lost! :(\n The secret number was: ");
I know about these two statements (setNum and convert):
ui->MessageLabel->setNum(secretNumber); qDebug() << QString::number(secretNumber)
But i don't know gow to combine it with the text "You have lost! :(\n The secret number was: " already extant in the QLabel.
Thanks in advance!
-
Hey,
I want to place a variable next to plain text.
ui->MessageLabel->setText("You have lost! :(\n The secret number was: ");
I know about these two statements (setNum and convert):
ui->MessageLabel->setNum(secretNumber); qDebug() << QString::number(secretNumber)
But i don't know gow to combine it with the text "You have lost! :(\n The secret number was: " already extant in the QLabel.
Thanks in advance!
-
Hi
One could also do
ui->MessageLabel->setText("You have lost! :(\n The secret number was: " + QString::number(secretNumber) );
but aha_1980 solution is much nicer.