Results 1 to 3 of 3

Thread: QtCore.translate

  1. #1
    Join Date
    Mar 2013
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QtCore.translate

    Hi all!

    My original problem is in PyQt (http://stackoverflow.com/questions/1...ion-call-error), but it probably exists also in C++/Qt.
    In short, I have (sometimes) this error:
    msg = QtGui.qApp.translate("@default", error_msg)
    TypeError: function takes exactly 5 arguments (1 given)

    error_msg is always non-empty string, so this error is kind of tricky, it's just a result of another problem (like not initialized QApplication, but in my case I'm sure it's initialized).
    This happend only sometimes, for most of the time my application works. I can't reproduce it on smaller piece of code.

    My question is: are you experienced with such error? In which cases it happend?

    Thank you,
    Michal

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtCore.translate

    What is the content of error_msg?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2013
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QtCore.translate

    Colleague of mine already solved it. It happens when error_msg contains non ascii characters.
    Solution (codec is Latin1 by default):
    QtCore.QTextCodec.setCodecForTr(QtCore.QTextCodec. codecForName("UTF-8"))

Similar Threads

  1. QtCore on an iPhone
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2010, 16:37
  2. Inside QtCore
    By falcon100 in forum Qt Programming
    Replies: 0
    Last Post: 18th November 2009, 12:42
  3. Implementation for QtCore classes
    By suikodian in forum Newbie
    Replies: 5
    Last Post: 31st August 2009, 07:48
  4. Difference between QtCore4.lib and QtCore.lib
    By Barry79 in forum Installation and Deployment
    Replies: 0
    Last Post: 11th August 2009, 10:33
  5. translate on fly
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2009, 14:21

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.