Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15, 6.1.0
-
-
d4039298e710b6b79c018589bcc2145e22e1d5aa (qt/qtdeclarative/dev) f51231164e7074bfcd4deea31e82428b31483e53 (qt/qtdeclarative/6.2)
Description
When we call qmlengine->retranslate() for a dynamic language translation, void QQmlContextData::refreshExpressions() in qqmlcontext.cpp will be called and re-evaluate (refresh) including "all" expressions regardless of language change.
781 void QQmlContextData::refreshExpressions() 782 { 783 bool isGlobal = (parent == nullptr); 784 785 // For efficiency, we try and minimize the number of guards we have to create 786 if (expressions_to_run(this, isGlobal) && childContexts) { 787 QQmlGuardedContextData guard(this); 788 789 childContexts->refreshExpressionsRecursive(isGlobal); 790 791 if (!guard.isNull() && expressions_to_run(this, isGlobal)) 792 refreshExpressionsRecursive(expressions); 793 794 } else if (expressions_to_run(this, isGlobal)) { 795 796 refreshExpressionsRecursive(expressions); 797 798 } else if (childContexts) { 799 800 childContexts->refreshExpressionsRecursive(isGlobal); 801 802 } 803 }
Although we can use trick such as https://wiki.qt.io/How_to_do_dynamic_translation_in_QML without qmlengine->retranslate() but it's not a general way.
In particular, in a customer's specific environment, dozens of applications are simultaneously executed, so performance concerns are high.
So I want to know if there are any plans for performance improvement.
Attachments
Issue Links
- relates to
-
QTBUG-84196 Crash when calling QQmlEngine::retranslate
- Closed