Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML Splash Screen Not Working
Forum Updated to NodeBB v4.3 + New Features

QML Splash Screen Not Working

Scheduled Pinned Locked Moved Mobile and Embedded
1 Posts 1 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dakemz
    wrote on last edited by
    #1

    My app used to work before the latest belle update but doesnt anymore. The splash screen only works when i downgrade com.nokia.symbian 1.1 to 1.0 on both the init.qml file and the splashcreen.qml file but then doesnt display the main.qml file. When I instruct main.cpp to directly load main.qml the app does work.... Im lost! Here is the code I have for main.cpp:

    @
    #include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"

    Q_DECL_EXPORT int main(int argc, char *argv[])
    {
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
    viewer.setSource(QUrl("qrc:/qml/SmartFlyer/init.qml"));
    //viewer.setMainQmlFile&#40;QLatin1String("qrc:qml/SmartFlyer/main.qml"&#41;&#41;;
    viewer.showExpanded();
    
    return app->exec&#40;&#41;;
    

    }
    @

    For init.qml:
    @
    // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1
    import com.nokia.symbian 1.1

    Item {
    id: init

    SplashScreen {
        id: splash
        show: true              // show splash
        minTimeout: 3000         // show splash at least for 3 sec
        image: "data/splash_screen.png"  // path to splash image
        canFinish: false         // change to true when main QML will be loaded
        z: 100                   // highest page.
    }
    
    Loader { // this component performs deferred loading.
        id: mainLoader
        onStatusChanged: {
            if( mainLoader.status == Loader.Ready &#41;
            {
                // main page is loaded
                // time to hide splash
                splash.canFinish = true
            }
        }
    }
    
    Component.onCompleted:  {
        // splash is already rendered on the screen
        // user is looking on splash
        // now we can start loader to load main page
        mainLoader.source = "main.qml"
    }
    

    }
    @

    And for splashscreen.qml :

    @
    // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1
    import com.nokia.symbian 1.1

    Rectangle {
    id: splash

    anchors.fill: parent
    color: "black"
    
    property int minTimeout: 3000  // 3s by default.
    property string image;            // path to splash image
    property bool show: false       // if show is true then image opacity is 1.0, else 0.0
    
    property bool canFinish: false    // if true then we can hide spash after timeout
    
    state: show ? "showingSplash" : ""
    
    onStateChanged: {
        if( state == "showingSplash" )
            splashTimer.start();
    }
    
    opacity: 0.0
    
    Image {
        source: image
        fillMode: Image.PreserveAspectFit
        anchors.fill: parent
        smooth: true
    }
    
    Timer {
        id: splashTimer
        interval: minTimeout
        running: false
        repeat:  true
        onTriggered: {
            if( splash.canFinish )
            {
                // finally we can stop timer and hide splash
                splash.show = false
                splashTimer.repeat = false
            }
            else
            {
                // canFinish is false, but main.qml is not loaded yet
                // we should run timer again and again
                splashTimer.interval = 1000 // 1 sec
                splashTimer.repeat = true
            }
        }
    }
    
    states: [
        State {
            name: "showingSplash"
            PropertyChanges { target: splash;  opacity: 1.0 }
        }
    ]
    
    // hide splash using animation
    transitions: [
        Transition {
            from: ""; to: "showingSplash"
            reversible: true
            PropertyAnimation { property: "opacity";  duration: 500; }
        }
    ]
    

    }
    @

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved