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. Qqmlapplicationengine refuse to show me something
Forum Updated to NodeBB v4.3 + New Features

Qqmlapplicationengine refuse to show me something

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 6 Posters 5.5k 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.
  • H Offline
    H Offline
    hagenkaiser
    wrote on 21 Jun 2013, 13:45 last edited by
    #1

    Hi all,
    Just checked out qt51rc1.
    I tried to use qqmlapplicationengine to show a qml file. It seems the application runs silently without showing anything.

    I did it very simple:
    in c++
    int main(int argc, char *argv[])
    {
    QGuiApplication app(argc, argv);
    // QtQuick2ApplicationViewer viewer;
    // viewer.setMainQmlFile(QStringLiteral("qml/QMLApplication/main2.qml"));
    // viewer.showExpanded();

    QQmlApplicationEngine engine("qml/QMLApplication/main2.qml");
    return app.exec();
    

    }

    I qml:
    import QtQuick 2.1
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.0

    Rectangle
    {
    width: 640
    height: 480
    Button {
    text: qsTr("Hello World")
    anchors.horizontalCenter: parent.horizontalCenter
    anchors.verticalCenter: parent.verticalCenter
    }
    }

    If I use the commented out viewer it works.
    But Id like to use an ApplicationWindow instead of a Rectangle as root item.
    Am I missing something or is this just a bug in qt5.1?
    Cheers and thx to everyone

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Timmmm
      wrote on 21 Jun 2013, 18:03 last edited by
      #2

      Same problem. No solution yet, sorry.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jens
        wrote on 21 Jun 2013, 23:11 last edited by
        #3

        Window and ApplicationWindow is not visible by default. I suspect you simply have to set visible:true in your window definition

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Timmmm
          wrote on 21 Jun 2013, 23:32 last edited by
          #4

          Ah that did the trick! Quite confusing that it doesn't need it with QtQuick2ApplicationViewer, but never mind.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            amund_l
            wrote on 31 Jul 2013, 07:49 last edited by
            #5

            [quote author="Jens" date="1371856261"]Window and ApplicationWindow is not visible by default. I suspect you simply have to set visible:true in your window definition[/quote]

            That's just shocking. The examples given for ApplicationWindow e.g. "this example":http://doc-snapshot.qt-project.org/qt5-stable/qtquickcontrols/qtquickcontrols-overview.html don't mention this.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              redwyre
              wrote on 25 Jan 2014, 13:43 last edited by
              #6

              This just bit me too, can someone add a note to http://qt-project.org/doc/qt-5/qqmlapplicationengine.html that mentions it?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 25 Jan 2014, 22:06 last edited by
                #7

                Hi,

                Can you provide a minimal example for the note ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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