[Interest] Loader refresh

Bo Thorsen bo at vikingsoft.eu
Tue Sep 15 08:45:24 CEST 2015


If it's just about language changes, it's pretty easy to fix. Just add a 
function that updates the string on each text item. Exactly like a 
ui_xx.h file does it.

One hack I've seen but never tried is to have a c++ object that has a 
string property. The property is actually always empty, but on language 
switches the c++ object emits the property changed signal. In the qml 
code you do this:

Text { text: qsTr("foo") + cppObject.emptyString }

As I said, I never tried this, because it smells a bit.

My preferred method of doing live language switches in qml is to have a 
translate function on every page that sets all strings.

You most definitely do not reload the loader ever just to work around 
something. The loader is for switching the page it holds, not anything else.

Bo.

Den 14-09-2015 kl. 17:02 skrev md at rpzdesign.com:
> Bo:
>
> Thanks for the response.
>
> The only other areas that I can see needing a screen refresh are
> ListView and Image (Imageprovider)
>
> The Text QML object was shared as one example of "changing" after the
> loader is when you swap out the language from English to Chinese to Arabic.
>
> I think this is where we mis-understand each other.  What are my
> Post-Loader options, not pre-loader.
>
> The only way I can see now to "reload" using loader, but it is not very
> smooth.
>
> And the component cache will suppress the repeated loading of the same
> QmlComponent object after 1 refresh.
>
> So then you are really forced to make the QML stack see a new
> Component so the loading is forced to take.  And that heavy handed
> requirement causes quite a lot of screen flicker.
>
> So I would chalk this up to the inability right now to force the QML
> engine to Repaint itself.
>
> Yes, I know, the rebuilding the Scene graph would be expensive, but that
> is what I would like to do in a generic way instead of having to set the
> text individually for each component (Since each one loads itself based
> on Country Language)
>
> Kind of a catch-22 for text objects based on displayed language.
>
> Maybe Microsoft flickers when it changes its display language, so I will
> just do the same.
>
> Cheers,
>
> md
>
>
> On 9/14/2015 1:11 AM, Bo Thorsen wrote:
>> Hi md,
>>
>> I don't know what it is you see, you just say it flickers. We use a lot
>> of Loader objects for customer code, and that doesn't flicker.
>>
>> The only guess I have on how this could happen is if you have lots of
>> bindings that keep propagating through the system.
>>
>> For example, you mentioned a Text object that switches from one string
>> to another. This is an indication that your code is the reason for those
>> problems. When you activate the loader, set the proper text immediately,
>> don't switch it later.
>>
>> Anything like what you're trying to do below is an attempt to solve the
>> symptom rather than the problem.
>>
>> Den 11-09-2015 kl. 20:37 skrev md at rpzdesign.com:
>>> Someone must have come across this problem before.
>>>
>>> Loader->sourceComponent is too heavy and causes screen flicker.
>>>
>>> QMetaObject::invokeMethod(gobj,"doLayout",Qt::QueuedConnection) does not
>>> work on QQuickText class objects.
>>
>> Bo Thorsen,
>> Director, Viking Software.
>>
>

Bo Thorsen,
Director, Viking Software.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Interest mailing list