Results 1 to 20 of 29

Thread: How to write a Russian text in console?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default Re: How to write a Russian text in console?

    untested you can try...

    or set
    setCodecForTr(russian); to out && in

    Qt Code:
    1. int main(int argc, char *argv[]) {
    2. QApplication app(argc, argv);
    3. QTextCodec::setCodecForTr(QTextCodec::codecForName("CP1251"));
    4.  
    5. QTextStream out(stdout);
    6. /// QTextCodec *russian = QTextCodec::codecForName("CP1251");
    7. /// or out.setCodecForTr(russian);
    8. QString str("*");
    9. out << str.fill('*', 80) << "\n";
    10. out.flush();
    11.  
    12. out << "Please enter word to search russian keyboard:\n";
    13. out.flush();
    14. QTextStream in(stdin);
    15. out.flush();
    16. search_word = in.readLine(); /// here new word to insert on class..
    17. out << "Your word:" << search_word << "\n";
    18. out << str.fill('*', 80) << "\n";
    19.  
    20. /// return 1; or
    21. QTimer::singleShot(10000, &app, SLOT(quit()));
    22. return app.exec();
    23. }
    To copy to clipboard, switch view to plain text mode 

    Last edited by patrik08; 29th September 2013 at 17:06.

  2. The following 2 users say thank you to patrik08 for this useful post:


Similar Threads

  1. Qt Linguist Can't write in russian in the translation field
    By mirluk in forum Qt Tools
    Replies: 1
    Last Post: 27th June 2012, 09:44
  2. Read/Write console app
    By InterFiction in forum Newbie
    Replies: 1
    Last Post: 15th November 2011, 14:00
  3. Replies: 7
    Last Post: 13th September 2011, 13:15
  4. How to write qt4 gui up to the existing console
    By binaural in forum Qt Programming
    Replies: 4
    Last Post: 16th June 2009, 13:44
  5. Console text color
    By skyphyr in forum Qt Programming
    Replies: 4
    Last Post: 11th December 2006, 17:19

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.