Error on startup for QML app on MeeGo



  • Hi all.
    I'm trying to port my QML app on Meego. When testing it on the simulator all works, but when I try to launch it on the meego emulator, it installed fine, but then I obtain the following error:
    @QObject: Cannot create children for a parent that is in a different thread.
    (Parent is QIcdEngine(0x1fb71100), parent's thread is QThread(0x1fb6f5e8), current thread is QThread(0x1f588318)@

    Is there someone that can point me on the right direction? The app start with a QML spalshscreen with a loader that load the main app as described in a nokia developer wiki page (http://www.developer.nokia.com/Community/Wiki/Implementing_a_Splash_Screen_with_Qt_Quick#Pure_QML_approach).
    After this the main app is showed.
    If I remove the spashscreen the app seems to start correctly.
    This is the splashscreen nad loader code:

    AppLoader.qml (the file called from the main.cpp)
    @import QtQuick 1.1

    Item {
    id: mainAppLoaderItem

    property bool splashScreenCanBeClosed: false
    
    // Loaders for the main application and the splash screen.
    Loader {
        id: mainAppLoader
        width: mainAppLoaderItem.width
        height: mainAppLoaderItem.height
    }
    
    Loader {
        id: splashScreenLoader
        source: Qt.resolvedUrl("SplashScreen.qml");
        width: mainAppLoaderItem.width
        height: mainAppLoaderItem.height
    }
    
    // Timers for starting to load the main application and eventually deleting
    // the splash screen.
    Timer {
        id: firstPhaseTimer
        property int phase: 0
        interval: 50
        running: true
        repeat: false
    
        onTriggered: {
            if(!mainAppLoader.Loading) {
                mainAppLoader.source = Qt.resolvedUrl("AppMainWin.qml");
                secondPhaseTimer.start();
            }
        }
    }
    
    Timer {
        id: secondPhaseTimer
        property int phase: 0
        interval: 800
        running: false
        repeat: true
    
        onTriggered: {
            if (phase == 0) {
                if(mainAppLoader.Loading) {
                    return;
                }
                // Set the phase for deletion.
                phase += 1;
            }
            else if(phase == 1) {
                if(!splashScreenCanBeClosed)
                    return;
    
                // Hide the splash screen.
                if(splashScreenLoader.item) {
                    splashScreenLoader.item.opacity = 0;
                }
    
                phase += 1;
            }
            else {
                // By setting the source property to an empty string destroys
                // the loaded item.
                splashScreenLoader.source = "";
    
                secondPhaseTimer.stop();
            }
        }
    }
    

    }@

    Splascreen.qml
    @import QtQuick 1.1

    Item {
    id: splashScreen

    z: 150
    
    Rectangle {
        color: "#1D3652"
        anchors.fill: parent
    }
    
    Item {
        anchors {
            top: parent.top
            right: parent.right
            rightMargin: 10
            topMargin: 10
        }
        width: 30
        height: 30
    
        visible: splashScreen.opacity == 1
    
        Image {
            anchors.centerIn: parent
            fillMode: Image.PreserveAspectFit
            source: "qrc:images/close.svg"
            sourceSize.height: parent.height - 10
            smooth: true
        }
    
        MouseArea {
            anchors.fill: parent
            onClicked: Qt.quit()
        }
    }
    
    Item {
        id: appLogo
        anchors.centerIn: parent
        height: childrenRect.height
    
        Image {
            id: appIcon
            anchors.horizontalCenter: parent.horizontalCenter
            sourceSize.width: 100
            fillMode: Image.PreserveAspectFit
            smooth: true
            source: "qrc:images/icon.svg"
        }
    
        Image {
            id: appName
            anchors.top: appIcon.bottom
            anchors.horizontalCenter: parent.horizontalCenter
            source: "qrc:images/app_banner.png"
        }
    }
    
    Image {
        anchors {
            top: appLogo.bottom
            topMargin: splashScreen.width > splashScreen.height ? 30 : 50
            horizontalCenter: parent.horizontalCenter
        }
    
        scale: 0.8
    
        source: "qrc:images/loadingapp.png"
        visible: splashScreen.opacity == 1
    
        NumberAnimation on rotation {
            running: splashScreen.opacity == 1
            from: 0
            to: 360
            loops: Animation.Infinite
            duration: 1200
        }
    }
    
    Text {
        anchors {
            bottom: parent.bottom
            right: parent.right
            bottomMargin: 5
            rightMargin: 5
        }
        ...
    }
    
    Behavior on opacity {
        NumberAnimation {
            duration: 800
        }
    }
    

    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.