Forums

OverviewV-Play 2 Support (Qt 5) › V-Play Splash Screen Pops Up Twice

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #10990

    Cal

    I have a simple v-play app running with the following code under Debian 8/64 V-Play 2.61. The app works but i see the splash screen popping up twice. running the same code built with a qtquick does not show this. can someone show me what is wrong

    V-play cpp

    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        VPApplication vplay;
    
        // Use platform-specific fonts instead of V-Play's default font
        vplay.setPreservePlatformFonts(true);
    
        // QQmlApplicationEngine is the preferred way to start qml projects since Qt 5.2
        // if you have older projects using Qt App wizards from previous QtCreator versions than 3.1, please change them to QQmlApplicationEngine
        QQmlApplicationEngine engine;
        vplay.initialize(&engine);
    
        // use this during development
        // for PUBLISHING, use the entry point below
        vplay.setMainQmlFileName(QStringLiteral("qml/Main.qml"));
    
        // use this instead of the above call to avoid deployment of the qml files and compile them into the binary with qt's resource system qrc
        // this is the preferred deployment option for publishing games to the app stores, because then your qml files and js files are protected
        // to avoid deployment of your qml files and images, also comment the DEPLOYMENTFOLDERS command in the .pro file
        // also see the .pro file for more details
        //play.setMainQmlFileName(QStringLiteral("qrc:/qml/Main.qml"));
        // main.cpp
    
        engine.load(QUrl(vplay.mainQmlFileName()));
    
        QQmlComponent component(&engine, "qml/Main.qml");
        QObject *object = component.create();
        QVariant returnedValue;
        QVariant msg = "Hello from C++";
        QMetaObject::invokeMethod(object, "myQmlFunction",
                Q_RETURN_ARG(QVariant, returnedValue),
                Q_ARG(QVariant, msg));
    
        qDebug() << "QML function returned:" << returnedValue.toString();
        delete object;
    
        return app.exec();
    }
    
    vplay qml main.qml
    
    import VPlayApps 1.0
    import QtQuick 2.5
    
    App     {
        width: 640
        height: 480
    
        function myQmlFunction(msg) {
            console.log("Got message:", msg);
            return "some return value fromm qml";
        }
    }

     

     

     

    #11241

    Günther
    V-Play Team

    Hi Cal!

    I tried the code you provided and didn’t run into your problem. (at least on MacOS – I have yet to test it on Linux)
    Does the SplashScreen problem also occur when you try the Empty V-Play Apps Project from the Project Wizard – or does it only happen with your code?

    Best,
    Günther

    #11245

    Cal

    I tried your suggestion and i did not see a second splash screen.

    i just can’t see why a see 2 here. would you like the complete src???

    #11246

    Günther
    V-Play Team
    #13947

    Sarevok

    Hi,
    I have the same problem but no solution so far:

        ...
    
        engine.load(QUrl(vplay.mainQmlFileName()));
    
        QQmlComponent component(&engine, "qml/StackTheBoxMain.qml");
        QObject *object = component.create();
        //do something with object
        delete object;
    
        return app.exec();
    }

    This is from the main.cpp of the ‘StackTheBox’ example. A second screen appears if I add the 3 lines in the middle of the code.

    #14067

    Günther
    V-Play Team

    Hi Sarevok!

    The StackTheboxMain.qml item is a GameWindow, which is derived from the QML ApplicationWindow type.
    Creating a new instance then means creating a new window. You would see the same behavior with a standard Qt Quick Application when creating a new window instance of the qml window in the main.cpp.

    Best,
    Günther

     

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support