Results 1 to 3 of 3

Thread: How to convert unsigned short value[1] to QString?

  1. #1
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default How to convert unsigned short value[1] to QString?

    How to convert unsigned short value[1] to QString?

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to convert unsigned short value[1] to QString?

    Hey bro,

    use this--->

    int main(.....){
    unsigned short int ab=5;
    QString str=QString::number(ab);
    }

    and your short will convert to string.

  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: How to convert unsigned short value[1] to QString?

    Or, if the value in the unsigned short is supposed to be a wide character then:
    Qt Code:
    1. QString str(QChar(value));
    To copy to clipboard, switch view to plain text mode 
    might do what you want. However, since the question is vague at best it is hard to know what you want.

    I can't believe for a moment you actually have an array of one element.

Similar Threads

  1. How store a unsigned short into a database
    By franco.amato in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2011, 22:17
  2. converting QByteArray to unsigned short
    By sattu in forum Qt Programming
    Replies: 16
    Last Post: 28th September 2010, 13:51
  3. convert from unsigned char* to QString
    By bhaskar in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2010, 06:36
  4. convert unsigned char * to QString
    By sepehr in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2008, 20:31
  5. Tiff in unsigned short
    By spawnwj in forum Qt Programming
    Replies: 14
    Last Post: 26th July 2006, 07:41

Tags for this Thread

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.