Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User Sasler's Avatar
    Join Date
    Jan 2010
    Posts
    272
    I'm trying to change the the locale for my app, in order to show correctly the date and to have consistent decimal symbol. I've tried to use QLocale::setDefault(QLocale::English, QLocale::UnitedStates) but I get "no matching function" error. What am I missing? Or is there a better way to do it?

    Thanks

  2. #2
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    http://doc.qt.nokia.com/4.6/qlocale.html#setDefault
    void QLocale::setDefault ( const QLocale & locale )

  3. #3
    Registered User Sasler's Avatar
    Join Date
    Jan 2010
    Posts
    272
    Quote Originally Posted by divanov View Post
    http://doc.qt.nokia.com/4.6/qlocale.html#setDefault
    void QLocale::setDefault ( const QLocale & locale )
    Yes, that is exactly what I'm trying to use, but I get an error. I must be missing something.

  4. #4
    Registered User sdragly's Avatar
    Join Date
    Jun 2010
    Posts
    10
    This is probably because you are passing enums, while the function expects a locale object.

    This should work (although I haven't tested it):
    Code:
    QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
    Good luck with you app!

  5. #5
    Registered User Sasler's Avatar
    Join Date
    Jan 2010
    Posts
    272
    Quote Originally Posted by sdragly View Post
    This is probably because you are passing enums, while the function expects a locale object.

    This should work (although I haven't tested it):
    Code:
    QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
    Good luck with you app!
    Thanks, it works without errors now.

    The only problem is that it doesn't seem to affect the language format of the date. It does how ever change the decimal symbol.

  6. #6
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    It works fine for me
    Code:
    #include <QtCore>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
    
        for (int i = 1 ; i < QLocale::LastLanguage; i++) {
            QLocale::setDefault(QLocale((QLocale::Language)i));
            QLocale newLocale;
            qDebug() << newLocale.name()
                     << newLocale.dateFormat();
        }
    }

Similar Threads

  1. Replies: 10
    Last Post: 2010-10-29, 08:02
  2. rename application
    By sunny_singh in forum Symbian C++
    Replies: 6
    Last Post: 2009-05-18, 09:57
  3. Is it possible to change theme programmatically on S60 3rd addition?
    By jain_0882 in forum Symbian Media (Closed)
    Replies: 6
    Last Post: 2009-03-10, 16:16
  4. change fontcolor in theme.nth
    By gruad23 in forum Themes/Carbide.ui
    Replies: 1
    Last Post: 2008-03-13, 10:56
  5. Replies: 0
    Last Post: 2008-01-10, 13:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved