Hi Kai,

I tried using onLoaded instead of onStatusChanged, but still loader is not
loaded, & even the log is not printed on the console. Am i doing something
strange ? i just want to load the source file. But with the following code,
its not achieving the result.

Repeater {

        model: config.launchers

        delegate: Loader {

            id: loader

            anchors.fill: parent

            Component.onCompleted: console.log("-------- Loader loaded
-----------");

            source: file

            onLoaded: {

                if (loader.status == Loader.Ready) {

                    loading.opacity = 0

                    loading.visible = false

                }

            }

        }

    }




Thanks & Regards,
Kalpesh Jain.



On Wed, Apr 25, 2012 at 11:56 PM, <kai.koe...@nokia.com> wrote:

> > -----Original Message-----
> > Subject: [Qt-qml] How can i verify that QML elements are loaded or not?
> >
> > Hi,
> >
> >
> >
> > I have the following code snippet in QML, but i doubt statements inside
> > Repeater element is not executed. Is there any way through which i can
> > debug these, i know that there is a log property present for Repeater
> > element but i am not sure how to use these.
>
> The documentation for Loader  tells you onStatusChanged() might never be
> called for local files:
>
> "Note that if the source is a local file, the status will initially be
> Ready (or Error). While there will be no onStatusChanged signal in that
> case, the onLoaded will still be invoked."
>
> So you probably want to use onLoaded() instead of onStatusChanged().
>
> Regarding how to 'debug' this: You can use e.g. the QML debugger/inspector
> integrated into Qt Creator. Or just use 'console.log("This is executed")' :)
>
> Regards
>
> Kai
>
> > import QtQuick 1.1
> >
> > Item {
> >
> > id: screen
> >
> >
> >
> > width: 1024
> > height: 600
> >
> > /*Loading Screen*/
> > Interactive {id: interactive}
> > Loading {id: loading;}
> >
> > /*Application Components*/
> > Pif {id: pif}
> > Config {id: config}
> > Media {id: media}
> >
> >
> > Repeater {
> >     model: config.launchers
> >     delegate: Loader {
> >         id:loader
> >         anchors.fill: parent
> >         source: file
> >         onStatusChanged: {
> >             if (loader.status == Loader.ready)
> >             {
> >                 loading.opacity = 0
> >                 loading.visible = false
> >             }
> >         }
> >     }
> >
> >
> > }
> >
> >
> >
> > Fullscreen {id: fullscreen}
> >
> >
> > }
> >
> >
> >
> > Thanks & Regards,
> > Kalpesh Jain.
> >
>
>
_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to