Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. <SOLVED> QQuickWindow not shown
Forum Updated to NodeBB v4.3 + New Features

<SOLVED> QQuickWindow not shown

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.0k 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.
  • Q Offline
    Q Offline
    Qnoobish
    wrote on last edited by
    #1

    Hello,

    I am testing stuff but I just can't be able to understand why the following code does not work:

    @
    int main(int argc, char *argv[])
    {
    QGuiApplication app(argc, argv);

    QQmlEngine engine;
    //The QQmlComponent class encapsulates a QML component definition
    QQmlComponent component( &engine, QUrl::fromLocalFile&#40;"qml/myTEst/main.qml"&#41;&#41;;
    
    //Create an object instance from this component
    QObject* myComponent = component.create();
    
    QQuickWindow*  window = qobject_cast<QQuickWindow *>(myComponent);
    window->show(); 
    
    return app.exec&#40;&#41;;
    

    }
    @

    In the end when I try to run no window is displayed and the App. exits with:
    "The program has unexpectedly finished
    app.exe exited with code -1073741819"

    Don't know what I am doing wrong.

    In short, software is eating the world.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qnoobish
      wrote on last edited by
      #2

      I think I solved it, the problem is related to the .pro file.

      I needed to add the line: QT += core gui

      And re-run Qmake, and is linking and running.

      In short, software is eating the world.

      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