Results 1 to 2 of 2

Thread: converting uint to QString

  1. #1
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default converting uint to QString

    Hi guys,

    I wanted to convert uint to QString. i.e.
    for example-

    uint i=123;
    QString converted;

    I want to convert the unsigned integer number 123 to string literal "123". I did it using QVariant class but my application aborts runtime. Plz guide.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: converting uint to QString

    Qt Code:
    1. uint i=123;
    2. QString converted = QString::number(i);
    To copy to clipboard, switch view to plain text mode 

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

    Yayati.Ekbote (14th April 2010)

Similar Threads

  1. Converting QString to char* in onl line
    By hubbobubbo in forum Qt Programming
    Replies: 10
    Last Post: 11th December 2009, 11:45
  2. Converting a QString to a LPCTSTR?
    By dobedidoo in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2009, 14:27
  3. Converting u_char to QString
    By merlvingian in forum Newbie
    Replies: 7
    Last Post: 29th September 2006, 00:11
  4. QString to char* not converting
    By DPinLV in forum Qt Programming
    Replies: 17
    Last Post: 6th August 2006, 12:15
  5. Replies: 2
    Last Post: 12th June 2006, 17:47

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.