Results 1 to 3 of 3

Thread: Put a point label on the dialog window

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Put a point label on the dialog window

    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.
    Qt Code:
    1. QString score;
    2. unsigned int points1, points2;
    3. score = points1 + " - " + points2;
    To copy to clipboard, switch view to plain text mode 

    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.

    VP.jpg

    What can I do?

  2. #2
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Put a point label on the dialog window

    Qt Code:
    1. score = QString::number(points1) + QString(" - ") + QString::number(points2);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Put a point label on the dialog window

    Or
    Qt Code:
    1. QString score = QString("%L1 - %L2").arg(points1).arg(points2);
    To copy to clipboard, switch view to plain text mode 
    which will give you the scores including localised thousands separators (the "L" in the placeholders).

Similar Threads

  1. Replies: 2
    Last Post: 4th August 2010, 19:10
  2. closing dialog window
    By sksingh73 in forum Newbie
    Replies: 1
    Last Post: 21st June 2010, 22:27
  3. dialog blocks other window
    By franknapoli in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2009, 19:15
  4. label on root window
    By Corinzio in forum Qt Programming
    Replies: 0
    Last Post: 21st January 2009, 21:08
  5. close window when click on a label
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 07:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.