PDA

View Full Version : Put a point label on the dialog window



guaranito93
2nd April 2014, 17:10
Hi all,
I'm programming a virtual pong game, the must of it is done but I want to put the score situation of the two players in the middle of the playing field. I have no idea how to do it.


QString score;
unsigned int points1, points2;
score = points1 + " - " + points2;


I want to put in layout the Qstring score. I give you a picture of the game to give an idea of the project, it's all drawed.

10234

What can I do?

rawfool
3rd April 2014, 11:21
score = QString::number(points1) + QString(" - ") + QString::number(points2);

ChrisW67
4th April 2014, 00:21
Or


QString score = QString("%L1 - %L2").arg(points1).arg(points2);

which will give you the scores including localised thousands separators (the "L" in the placeholders).