Hi Martin,

I had the same issue while dealing with a similar problem where start
page was showing BusyIndicator while the application is loading. What
I did is connected to Component.onCompleted in ApplicationWindow,
start the initialization procedure and replace the page after
initialization is done:

// main.qml

ApplicationWindow
{
    Component.onCompleted: {
        pageStack.push(Qt.resolvedUrl("pages/Loader.qml"))
        myApp.initialize(); // call of an exposed C++ method
    }
}

// Loader.qml:

Page {
    BusyIndicator {
        running: myApp.initializing // Q_PROPERTY exposed in C++ class
    }
    onRunningChanged: {
        if (!running)
            pageStack.replace(Qt.resolvedUrl("FirstPage.qml"))
    }
}

I think you can add both of your pages in Component.onCompleted() of
the ApplicationWindow and switch between them in runtime.

Cheers

2014-07-16 18:45 GMT+06:00 Marcin M. <marmistrz...@gmail.com>:
> Take back what I said. The workaround doesn't work. :P
>
> --
> Marcin
>
>
> 2014-07-16 14:42 GMT+02:00 Marcin M. <marmistrz...@gmail.com>:
>
>> This way the dialog opens after closing the dialog. Worked it around by
>>
>>
>>     Component.onCompleted:
>>     {
>>         while (status != PageStatus.Active) {}
>>         openWelcomeDialog()
>>     }
>>
>> --
>> Marcin
>>
>>
>> 2014-07-16 11:01 GMT+02:00 Andrey Kozhevnikov <coderusin...@gmail.com>:
>>
>>> do not use onCompleted in this case. use status == PageStatus.Active
>>> instead
>>>
>>> 16.07.2014 14:58, Marcin M. пишет:
>>>
>>> I'd like to open a welcome dialog at startup which can be disabled by a
>>> user.
>>>
>>> Page
>>> {
>>>     id: mainPage
>>>     function openWelcomeDialog()
>>>     {
>>>         var component = Qt.createComponent("WelcomeDialog.qml")
>>>         var popup = component.createObject(mainPage)
>>>         popup.open()
>>>     }
>>>
>>>     Component.onCompleted: openWelcomeDialog()
>>>     // ...
>>> }
>>>
>>> In fact
>>>
>>> [W] unknown:90 - file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:90:
>>> Error: Cannot push while operation is in progress: push
>>>
>>> happens.
>>>
>>>
>>> What's done wrong?
>>>
>>> --
>>> Marcin
>>>
>>>
>>> _______________________________________________
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>>
>>>
>>>
>>> _______________________________________________
>>> SailfishOS.org Devel mailing list
>>> To unsubscribe, please send a mail to
>>> devel-unsubscr...@lists.sailfishos.org
>>
>>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to