Results 1 to 6 of 6

Thread: int to hex code

  1. #1
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default int to hex code

    Hi,

    I would like to trasform a int value in a corresponding QString hex value.
    For example I have int value 10, and I want a QString "A".

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: int to hex code

    Have you tried searching QString docs for "hex"?

  3. #3
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: int to hex code

    yes, I have tried, and I have used the "toHex()" member function, but it not work for me, I don't know why...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: int to hex code

    Quote Originally Posted by nowire75 View Post
    yes, I have tried, and I have used the "toHex()" member function, but it not work for me, I don't know why...
    Because that's a QByteArray's method.

    Try again with this page: http://doc.trolltech.com/4.3/qstring.html

  5. The following user says thank you to jacek for this useful post:

    nowire75 (14th January 2008)

  6. #5
    Join Date
    Jun 2007
    Posts
    28
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: int to hex code

    yes yes, sorry...

    sometimes we only need to have the correct clue :-)

    Thanks

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: int to hex code

    Just in case you have ended with QString( "%1" ).arg( ... ), if you dig a bit more in the docs, you'll find QString::number( ... ) which works in a similar way, but doesn't need a QString instance.

Similar Threads

  1. Pasting code from code tag in emacs
    By Gopala Krishna in forum General Discussion
    Replies: 0
    Last Post: 16th February 2007, 05:47
  2. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  3. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  4. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

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.