Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Showing unicode characters in a QString on mac
Forum Updated to NodeBB v4.3 + New Features

Showing unicode characters in a QString on mac

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jasgui
    wrote on last edited by
    #1

    Hi,
    I have the following code:

    @
    #include <QApplication>
    #include <QString>
    #include <QLabel>

    int main(int argc, char *argv[])
    {

    QApplication app(argc, argv);
    
    QWidget fenetre;
    
    QLabel texte("éèê", &fenetre);
    
    fenetre.show();
    
    return app.exec&#40;&#41;;
    

    }
    @

    and it shows éèê

    How can I use unicode in a window on MAC?

    Thanks!

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Since QLabel takes a QString, you can write
      @
      QLabel texte(QString::fromUtf8("éèê"), &fenetre);
      @

      For non-Qt programs, you need to use C++11's Unicode support: http://en.wikipedia.org/wiki/C++11#New_string_literals

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved