Results 1 to 2 of 2

Thread: Problem with Qtextedit format - hex viewing

  1. #1
    Join Date
    Jun 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Problem with Qtextedit format - hex viewing

    Hello.
    I have a big problem. I try do a hex editor, and i don't know how format a text in Qtextedit. I would like it will look like this:

    1000 0000 AA 65 34 5B 43 66 4B 56 89 D0 E1 .A....B.6.5.3

    Could you tell me how i can format Qtextdocument ??

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Problem with Qtextedit format - hex viewing

    One the possible ways, is to format your data before you add into QTextDocument / QTextEdit
    Qt Code:
    1. QString str;
    2. str = QString("Decimal 63 is %1 in hexadecimal")
    3. .arg(63, 0, 16);
    4. // str == "Decimal 63 is 3f in hexadecimal"
    5.  
    6. QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
    7. str = QString("%1 %L2 %L3")
    8. .arg(12345)
    9. .arg(12345)
    10. .arg(12345, 0, 16);
    11. // str == "12345 12,345 3039"
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 3rd June 2011, 07:39
  2. How to change current line format in QTextEdit?
    By FinderCheng in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2011, 09:41
  3. Support for .rtf format in QTextDocument or QTextEdit?
    By LynneV in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 23:01
  4. QTextEdit current cursor text format
    By afail in forum Qt Programming
    Replies: 0
    Last Post: 13th April 2009, 14:24
  5. Replies: 0
    Last Post: 13th March 2009, 15:38

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.