Results 1 to 7 of 7

Thread: Cannot get QT Gui Application to display chinese

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    6
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Cannot get QT Gui Application to display chinese

    Hello, I am new to the QT SDK 4.6.1 and currently learning qt through C++-GUI-Programming-with-Qt-4-1st-ed

    I am trying to display some chinese words in a simple qt windows and it shows up all rubbish.

    here is the code

    Qt Code:
    1. #include <QApplication>
    2. #include <QLabel>
    3.  
    4. int main( int argc, char* argv[])
    5. {
    6. QApplication App(argc,argv);
    7. QLabel *label = new QLabel("XXXX"); //where XXXX is chinese character
    8. label -> show();
    9. return app.exec()
    10. }
    To copy to clipboard, switch view to plain text mode 

    The code ran well and showed a little windows, the only problem is that the chinese character are messed up.

    It would be nice if someone can show me how to solve these problems or I might as well just go back to MFC.

    ps.
    I've been search through internet for solutions; however, nothing mentionable has been found. I've read the internationlization with QT and tried
    Qt Code:
    1. QString text = "XXXX";
    2. QLabel *label = new QLabel(text);
    To copy to clipboard, switch view to plain text mode 

    and it did not work. I donno the tr() function as there is no real example that solved the multi-langue display problem
    Last edited by Weichen; 18th September 2010 at 17:39.

Similar Threads

  1. Problem with chinese and japanese characters display
    By manojmka in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 26th February 2010, 05:09
  2. Application doesn't display images
    By satoshi in forum Qt Programming
    Replies: 3
    Last Post: 2nd January 2010, 11:33
  3. How to display chinese chars with QtEmbedded-4.5.3
    By amaolei in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 15th December 2009, 06:47
  4. how can I input and display Chinese using QT4?
    By Justin_W in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 12th August 2008, 17:46
  5. Loading chinese font for the application
    By kommu in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2008, 14:12

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
  •  
Qt is a trademark of The Qt Company.