Results 1 to 2 of 2

Thread: explanation for Qstring to int

  1. #1
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question explanation for Qstring to int

    hi,

    i have searched for QString to int . i got the
    str.append(QString("%1").arg(int));
    .
    Can any one Explain me about the above line.

    Thnx in advance.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: explanation for Qstring to int

    Obviously there is a lot about this in the QString documentation, including the workings of QString::arg().

    Qt Code:
    1. QString("%1")
    To copy to clipboard, switch view to plain text mode 
    Creates a string with %1 as content.
    .arg(int) replaces the lowest %N in the string it is called on with a string representation of the int.

    The whole new string is then appended to str.

    To convert string to int, use str.toInt().
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

Similar Threads

  1. Replies: 4
    Last Post: 1st February 2010, 14:21
  2. Replies: 7
    Last Post: 2nd July 2009, 17:35
  3. Replies: 4
    Last Post: 31st January 2008, 20:44
  4. Explanation to Image Formats
    By sincnarf in forum Qt Programming
    Replies: 13
    Last Post: 6th July 2007, 17:02
  5. how to copy part of QString to anothe QString
    By nass in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2007, 19:05

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.