V-Play has a new name, say hi to Felgo!Learn More

Forums

OverviewFelgo 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
    Felgo Team

    Hi Syed!

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

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

    1.  Modify your .pro file configuration to link the Felgo SDK to your project
      CONFIG += v-play
    2. Open the main.cpp of your project and initialize Felgo (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 Felgo
      
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          return app.exec();
      }
    3. In your main.qml, use Felgo GameWindow as your main ApplicationWindow (required for license validation and other checks)
      import Felgo 3.0
      
      GameWindow {
        licenseKey: "<your-license-key>"
        // ...
      }

      Alternatively, you can also add a GameWindowItem instead:

      import Felgo 3.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 Felgo Apps licenseKey:
      {
          "title": "Felgo App",
          "identifier": "<your app identifier>",
          "orientation": "auto",
          "versioncode": 1,
          "versionname": "1",
          "stage": "test"
      }

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

    Best,
    Günther from Felgo

    #16131

    Günther
    Felgo Team

    You can find an example Qt Quick project that uses the Felgo 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
    Felgo 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