Results 1 to 4 of 4

Thread: Signal if application is translating?

  1. #1
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Signal if application is translating?

    Hi,

    i use this Example for dynamic translation.

    How can i verify if my applicatin begin and end translating? I have try to send a signal:

    application.h
    Qt Code:
    1. class Application : public QApplication
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. explicit Application(int& argc, char* argv[]);
    7. ~Application();
    8.  
    9. //...
    10.  
    11. public slots:
    12. static void setLanguage(const QString& locale);
    13. // ...
    14.  
    15. signals:
    16. static void languageChanging(int);
    17. };
    To copy to clipboard, switch view to plain text mode 

    application.cpp
    Qt Code:
    1. void Application::setLanguage(const QString& locale)
    2. {
    3. emit languageChanging(true);
    4.  
    5. // remove previous
    6. if (current)
    7. {
    8. removeTranslator(current);
    9. }
    10.  
    11. // install new
    12. current = translators.value(locale, 0);
    13. if (current)
    14. {
    15. installTranslator(current);
    16. }
    17.  
    18. emit languageChanging(false);
    19. }
    To copy to clipboard, switch view to plain text mode 

    but my compiler say error ... : static member functions do not have 'this' pointers
    and i think thats OK but what can i do?

  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: Signal if application is translating?

    Chaning the translation language is done using events so a synchronous code such as your wouldn't make any sense. If you want, you can monitor the application (using event filters) for LanguageChange events. When they will stop comming, it means the changes have propagated themselves.
    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. The following user says thank you to wysota for this useful post:

    whitefurrows (12th October 2009)

  4. #3
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Signal if application is translating?

    In the case you are about to remove your own translation monitoring, my intervention is useless.

    But I can't stop me to tell you that the message your compiler displays is right : installTranslator and removeTranslator are not static, are they?

  5. The following user says thank you to scascio for this useful post:

    whitefurrows (12th October 2009)

  6. #4
    Join Date
    May 2006
    Posts
    108
    Thanks
    35
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Signal if application is translating?

    Chaning the translation language is done using events so a synchronous code such as your wouldn't make any sense
    That’s right.

    The problem was my QTreeWidget has send the signal currentItemChanged () if the language changing. But the bug was i have call a function in LanguageChange event. Now it’s all OK.

    Thanks for your Help

Similar Threads

  1. Deploying Qt 4.5.1 Application on RHEL 5.. Pls Help
    By swamyonline in forum Installation and Deployment
    Replies: 0
    Last Post: 28th June 2009, 11:43
  2. how to emit signal in the model in this application?
    By calmspeaker in forum Qt Programming
    Replies: 2
    Last Post: 17th February 2009, 01:09
  3. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  4. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  5. dll + application
    By fpujol in forum Qt Programming
    Replies: 11
    Last Post: 15th April 2007, 18:37

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.