Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    [solved] terminate application

    QML and Qt Quick
    3
    10
    13695
    Loading More Posts
    • 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.
    • S
      spode last edited by

      if i click on onClicked: Qt.quit()
      i receive the error "Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it."

      ideas for fixing?

      1 Reply Last reply Reply Quote 1
      • L
        lgeyer last edited by

        You have to connect the QDeclarativeEngine::quit() signal to the QApplication::quit() slot.
        @
        connect(view->engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
        @

        1 Reply Last reply Reply Quote 1
        • S
          spode last edited by

          @
          QDeclarativeView *primaSchermata = new QDeclarativeView(this);
          primaSchermata->setSource(QUrl::fromLocalFile("qml/OpenOrario/main.qml"));
          primaSchermata->show();
          QObject::connect(primaSchermata->engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
          @

          this one does not start...

          1 Reply Last reply Reply Quote 0
          • L
            lgeyer last edited by

            What does "does not start" mean?

            1 Reply Last reply Reply Quote 0
            • S
              spode last edited by

              Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it.

              1 Reply Last reply Reply Quote 0
              • L
                lgeyer last edited by

                The code - as you have posted - does work and the application should be closed.

                Are there any further debug outputs? Is the connect() successful?

                1 Reply Last reply Reply Quote 0
                • S
                  spode last edited by

                  no, it is not.
                  @
                  QObject::connect(primaSchermata->engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
                  @
                  returns
                  @
                  ..\OpenOrario\prima.cpp:28: error: no matching function for call to 'prima::connect(QDeclarativeEngine*, const char*, QCoreApplication*, const char*)'
                  c:\QtSDK\Desktop\Qt\4.7.3\mingw\include/QtCore/qobject.h:198: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
                  c:\QtSDK\Desktop\Qt\4.7.3\mingw\include/QtCore/qobject.h:313: note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
                  @

                  if i delete the snippet and click on the button to close the app:
                  @
                  Rectangle { ... MouseArea { anchors.fill: parent; onClicked: Qt.quit() } }
                  @
                  there is this error:
                  @
                  Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it.
                  @

                  1 Reply Last reply Reply Quote 0
                  • S
                    spode last edited by

                    solved with
                    @
                    QObject::connect(obj, SIGNAL(signal_chiudiClicked()), this, SLOT(close()));
                    @

                    and the relative signal from QML. the class inherits from "qwidget"

                    1 Reply Last reply Reply Quote 0
                    • L
                      lgeyer last edited by

                      [quote author="spode" date="1317308378"]no, it is not.[/quote]

                      I could not reproduce your problem. The snippet works whatsoever I try. In addition, the signature the compiler complains about matches one of the suggested signatures - which is rather strange.

                      However the problem has been solved for you.

                      To all the others: please someone enlighten me why this snippet might not work and how it can be forced to produce the error stated above.

                      1 Reply Last reply Reply Quote 0
                      • 5
                        5c2v last edited by

                        Hello,

                        I bumped into the same problem minutes ago. You just have to remember to include both of the headers - for QDeclarativeEngine and QCoreApplication.

                        Enjoy ;)

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post