Forums

OverviewV-Play 2 Support (Qt 5) › Can we use v-play components in a Qt Quick Controls 2 application?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #16125

    Syed Ferhan

    Hi! I’m new to v-play. Previously I was developing using QtQuick alone. I have an application whose interface is in QML using Qt Quick Controls 2.

    I need to use one of the components that v-play provides, specifically the “Storage” component. Can I use just this component in my application? Please note that I don’t want to convert my whole application into a v-play application because a lot of code has already been written.

    #16126

    Günther
    V-Play Team

    Hi Syed!

    The Storage component is only available as part of the V-Play SDK, which requires some V-Play specific project setup. However, V-Play Components can also be used in Qt Quick Projects with some additional modifications to correctly initialize V-Pay.

    To add V-Play to your Qt Quick Project, you can follow these steps (please note that V-Play SDK must be installed and available with your selected Build Kit):

    1.  Modify your .pro file configuration to link the V-Play SDK to your project
      CONFIG += v-play
    2. Open the main.cpp of your project and initialize V-Play (see code comments)
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <VPApplication> // 1 - include VPApplication
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
          VPApplication vplay; // 2 - create VPApplication instance
      
          QQmlApplicationEngine engine;
          vplay.initialize(&engine); // 3 - initialize V-Play
      
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          return app.exec();
      }
    3. In your main.qml, use V-Play GameWindow as your main ApplicationWindow (required for license validation and other checks)
      import VPlay 2.0
      
      GameWindow {
        licenseKey: "<your-license-key>"
        // ...
      }

      Alternatively, you can also add a GameWindowItem instead:

      import VPlay 2.0
      
      ApplicationWindow {
          // ...
          GameWindowItem {
            licenseKey: "<your-license-key>"
          }
      }
    4. Add a new file qml/config.json to your project resources, and configure your correct application id / version that matches your V-Play Apps licenseKey:
      {
          "title": "V-Play App",
          "identifier": "<your app identifier>",
          "orientation": "auto",
          "versioncode": 1,
          "versionname": "1",
          "stage": "test"
      }

    With these changes, you should be able to include V-Play and use the Storage Component in your project.

    Best,
    Günther from V-Play

    #16131

    Günther
    V-Play Team

    You can find an example Qt Quick project that uses the V-Play Storage for download here: QtQuickVPlay.zip

    Hope this helps!

    Cheers,
    Günther

    #17025

    Marcin

    Hi all,
    Günther the explanation you provided, is it somewhere in the docs? That would be really useful to have there.
    Just the bits you provided here would be extremely useful if are not in documentation already.

    PS. Sorry for adding something to old topic.

    #17026

    Günther
    V-Play Team
Viewing 5 posts - 1 through 5 (of 5 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