[Qt-qml] Getting a QML component to reload itself
Alex
alexlordax+qt at gmail.com
Fri Sep 3 03:05:06 CEST 2010
On Thu, Sep 2, 2010 at 5:30 PM, Martin Jones <martin.jones at nokia.com> wrote:
> On Fri, 3 Sep 2010 07:37:17 am ext Alex wrote:
>> Hi all,
>>
>> I have several QML screens managed by a C++ application. In some
>> cases, I need to reload a QML screen, in response to a signal emitted
>> from that screen.
>> What is the correct way to do this?
>
> You could create a different slot for the QML call that calls the actual
> reload slot asynchronously:
>
> void MyClass::reload()
> {
> QMetaObject::invokeMethod(this, "doReload", Qt::QueuedConnection);
> }
>
> void MyClass::doReload()
> {
> currentView->setSource(currentView->source());
> }
>
>
> I'll investigate using deleteLater() instead so that this isn't a problem in
> future.
>
Thanks, Martin. That works great!
Alex
More information about the Qt-qml
mailing list