Results 1 to 4 of 4

Thread: Qt Multi language QCombobox problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    20
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4

    Default Qt Multi language QCombobox problem

    I have got a problem with multi language qt (change language on the fly). My form have a combobox which should be translated when language changed. When languageChanged, the app call method retranslateUi() to translate item in the combobox. The combobox have slot corresponding for signal currentIndexChanged().

    Qt Code:
    1. void on_comboBox_currentIndexChanged(int index)
    2. {
    3. //do something
    4. }
    To copy to clipboard, switch view to plain text mode 

    But when method retranslateUi() called, I do this:
    Qt Code:
    1. void retranslateUi()
    2. {
    3. ui->comboBox->clear();
    4. ui->comboBox->insertItems(0, QStringList()
    5. << QApplication::translate("SettingDialog", "English", 0, QApplication::UnicodeUTF8)
    6. << QApplication::translate("SettingDialog", "French", 0, QApplication::UnicodeUTF8)
    7. );
    8. }
    To copy to clipboard, switch view to plain text mode 

    Problem is: each statement in retranslateUi() will emit the signal currentIndexChanged(), then the slot will call again.

    How can I avoid that ?
    Last edited by vhptt; 31st July 2012 at 11:20.

  2. The following user says thank you to vhptt for this useful post:


Similar Threads

  1. Qt Multi language app at runtime
    By vhptt in forum Newbie
    Replies: 2
    Last Post: 23rd July 2012, 15:23
  2. Load multi language fonts at the same time
    By lllturtle in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 12th April 2012, 08:20
  3. Qt Assistant for custom help and multi-language
    By bec in forum Qt Programming
    Replies: 0
    Last Post: 14th April 2011, 08:54
  4. multi language support example
    By Ratheendrans in forum Qt Programming
    Replies: 6
    Last Post: 3rd April 2011, 02:50
  5. Multi language translation
    By bhaskar in forum Installation and Deployment
    Replies: 1
    Last Post: 14th June 2010, 16:30

Tags for this Thread

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.