Print numbers 1 to 10 in GUI [SOLVED] - [Solucionado]
-
Hello, I want display in GUI a numbers 1 to 10 and I have this code:
@
QString rta;
for(int i = 0; i < 10; i++){
rta += i;
rta += "\n";
}
ui->tablero->setText(rta);@
I display in a QTextEdit but this code show symbols as ASCII ...not numbers :S what happened?
I need use a QString for concatenate.
Any comments suggestion recommendation? ... thanks for the time, I'm new to QT as 3 days ago I met him and I'm testing it
-
Try replacing
@
rta += i;
@with
@
rta += QString::number(i);
@i is not automatically converted to a string containing the number. Instead the compiler will convert the int to a QChar (I think), which is not what you want.
-
Thank you very much indeed :D
-
I'm glad I was able to help :)
Please mark the thread as solved (simply edit it and add something like [SOLVED] to the title).