Results 1 to 6 of 6

Thread: how to print a value in qt

  1. #1
    Join Date
    Jul 2010
    Posts
    50
    Thanks
    7
    Platforms
    Windows

    Default how to print a value in qt

    I want to print the value of a variable(integer) on (say) a label in Qt.......
    How can i do it??

  2. #2
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: how to print a value in qt

    You can convert integer type to QString type using QString::number().

  3. The following user says thank you to saa7_go for this useful post:

    qt_user (6th August 2010)

  4. #3
    Join Date
    Jul 2010
    Posts
    50
    Thanks
    7
    Platforms
    Windows

    Default Re: how to print a value in qt

    thanx a lot.....can I also do something like "stament to be printed " variable1 "more statments" variable2.............. as in C language??

  5. #4
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: how to print a value in qt


  6. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how to print a value in qt

    or simple use + to concat strings

  7. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to print a value in qt

    Quote Originally Posted by qt_user View Post
    thanx a lot.....can I also do something like "stament to be printed " variable1 "more statments" variable2.............. as in C language??
    No, and thats not C language (unless variable1 and variable2 are #define's containing text)

    But you can do:

    Qt Code:
    1. QString temp = "stament to be printed " + variable1 + "more statments" + variable2;
    To copy to clipboard, switch view to plain text mode 

    Assuming variable1 and variable2 and also QString's.

Similar Threads

  1. print
    By d4rc in forum Newbie
    Replies: 5
    Last Post: 29th June 2010, 10:28
  2. qwt print
    By manmohan in forum Qwt
    Replies: 0
    Last Post: 5th May 2010, 07:16
  3. print value
    By valy12 in forum Qt Programming
    Replies: 3
    Last Post: 21st April 2010, 16:32
  4. Cancelling Long-running Print/Print Preview
    By ChrisW67 in forum Newbie
    Replies: 4
    Last Post: 16th June 2009, 23:05
  5. I can't print...
    By brevleq in forum Qt Programming
    Replies: 5
    Last Post: 22nd January 2008, 11:13

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.