Results 1 to 5 of 5

Thread: is there a way to show Hexadecimal number???

  1. #1
    Join Date
    Aug 2008
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Exclamation is there a way to show Hexadecimal number???

    hi

    this is wht i m doing...the data inside is actually a hexadecimal and it give me the int number when i compile...i jux want it to display as hex eg: 0x32



    Qt Code:
    1. info3->setText(QString("%1").arg(rec_table.data[2].status));
    To copy to clipboard, switch view to plain text mode 




    is there a way to do that???

    thx so much in advance

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    512
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: is there a way to show Hexadecimal number???

    Hi,
    use
    http://doc.trolltech.com/4.3/qstring.html#arg-10 and set base to 16.

    Ginsengelf

  3. #3
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Thanks
    23
    Thanked 32 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: is there a way to show Hexadecimal number???

    try %x or %X

  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: is there a way to show Hexadecimal number???

    Please don't post the same question more than once.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: is there a way to show Hexadecimal number???

    Quote Originally Posted by cL4r4 View Post
    the data inside is actually a hexadecimal and it give me the int number when i compile...
    I would only like to notice that a number is a number - not hexadecimal, not decimal but a number and its internal representation is binary not hexadecimal by the way, so you can't have a "hexadecimal number" - you just have an int and if you want to show it to someone you'll be converting it to a textual representation and the latter can show your number in hexadecimal, decimal, octal, binary or whatever else form you might think of.

Similar Threads

  1. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06: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.