Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How I do to run Maroon In Trouble example?
Qt 6.11 is out! See what's new in the release blog

How I do to run Maroon In Trouble example?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k Views 2 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.
  • Cold_DistanceC Offline
    Cold_DistanceC Offline
    Cold_Distance
    wrote on last edited by
    #1

    Hi. Is there anyone who can run Maroon in Trouble? I downloaded the source code from examples in Qt Creator and I changed the code from main.cpp to the next (the original code doesn't find shared.h):

    /*#include "../../shared/shared.h"
    DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon)*/
    
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/demos/maroon/maroon.qml")));
    
        return app.exec();
    }
    

    I copied the code from the documentation file by file and it still not working.

    I use Qt-Creator 3.4.1 and Qt 5.4.2 on Kubuntu 14.04. What am I doing bad?

    p3c0P 1 Reply Last reply
    0
    • Cold_DistanceC Cold_Distance

      Hi. Is there anyone who can run Maroon in Trouble? I downloaded the source code from examples in Qt Creator and I changed the code from main.cpp to the next (the original code doesn't find shared.h):

      /*#include "../../shared/shared.h"
      DECLARATIVE_EXAMPLE_MAIN(demos/maroon/maroon)*/
      
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/demos/maroon/maroon.qml")));
      
          return app.exec();
      }
      

      I copied the code from the documentation file by file and it still not working.

      I use Qt-Creator 3.4.1 and Qt 5.4.2 on Kubuntu 14.04. What am I doing bad?

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi @Cold_Distance,
      QQmlApplicationEngine unlike QQuickView does not automatically create a root window which means you have to create a Window or ApplicationWindow in the QML file.
      The file which you are loading maroon.qml does not contain a Window or ApplicationWindow as root but contains and Item as root. So QQmlApplicationEngine will fail here.
      To rectify it you will either need to add Window to QML OR use QQuickView load that QML.
      Using QQuickView instead of QQmlApplicationEngine in this case will be faster with minimal changes.

      157

      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