Results 1 to 6 of 6

Thread: Convert to unicode text

  1. #1
    Join Date
    Oct 2016
    Posts
    61
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Convert to unicode text

    Hi normally when i convert the data string i do this

    QString::fromUtf16((ushort*)data);
    But how i can convert to unicode??

  2. #2
    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: Convert to unicode text

    From what?

  3. #3
    Join Date
    Oct 2016
    Posts
    61
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Convert to unicode text

    of the data of my program. I convert to string but in unicode i dont remember how¿?

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Convert to unicode text


  5. #5
    Join Date
    Oct 2016
    Posts
    61
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Convert to unicode text

    i'm trying to show some unicode key's for this i ask.
    I tried using this.
    int result = ToUnicodeEx(cKey->vkCode, cKey->scanCode, keyboard_state, buffer,4,0, keyboard_layout);
    all time show me or 0 or 1 so i was thinking to use this.
    std::vector keys(256, 0);
    int sc = MapVirtualKey(vk, MAPVK_VK_TO_VSC);
    return1 = ToUnicode(vk, sc, keys.data(), buffer, 1, 0);
    But show me some errors. my question is impossible to use winapi with qt?

  6. #6
    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: Convert to unicode text

    Qt does not stop you using the Windows API.

    Qt Code:
    1. int result = ToUnicodeEx(cKey->vkCode, cKey->scanCode, keyboard_state, buffer,4,0, keyboard_layout);
    2. all time show me or 0 or 1 so i was thinking to use this.
    To copy to clipboard, switch view to plain text mode 
    Result equal 0 or 1 is normal. What is in buffer when result is 1?
    https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

    What does this have to do with your initial question?

Similar Threads

  1. Read unicode text from file
    By Boron in forum Qt Programming
    Replies: 2
    Last Post: 24th October 2012, 15:27
  2. Help needed to convert unicode characters
    By hybrid_snyper in forum Newbie
    Replies: 4
    Last Post: 24th August 2012, 15:20
  3. Replies: 5
    Last Post: 20th August 2012, 20:58
  4. Unicode text to database
    By praveen_g in forum Newbie
    Replies: 1
    Last Post: 18th December 2009, 07:50
  5. how to convert the whole project into Unicode
    By thomasjoy in forum Qt Programming
    Replies: 6
    Last Post: 10th May 2007, 10:05

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.