Solved How to retranslate the text in QListView with a model
-
Hi all
I added the translation for some fixed text (like type (info, debug... ) or level (high,middle,low) ).
But I find that the old items will not retranslate and the new items will have the translated text.
How to solve this problem?
Best regards
Mihan -
@Mihan by calling again setText(tr("myText)) on those items
-
Thanks @J-Hilk
So should I use
changeEvent()
to catch theQEvent::LanguageChange
then all the itemssetText()
again? -
@Mihan yes exactly, every text that you set in your cpp or h files you will have to reapply, when the changeEvent LanguageChanged occurs.
Only exception are texts that are set by ui files(and not later changed via cpp files)