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] terminate application

[solved] terminate application

Scheduled Pinned Locked Moved QML and Qt Quick
10 Posts 3 Posters 14.7k Views
  • 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 Offline
    S Offline
    spode
    wrote on last edited by
    #1

    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
    1
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      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
      1
      • S Offline
        S Offline
        spode
        wrote on last edited by
        #3

        @
        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
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          What does "does not start" mean?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            spode
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              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
              0
              • S Offline
                S Offline
                spode
                wrote on last edited by
                #7

                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
                0
                • S Offline
                  S Offline
                  spode
                  wrote on last edited by
                  #8

                  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
                  0
                  • L Offline
                    L Offline
                    lgeyer
                    wrote on last edited by
                    #9

                    [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
                    0
                    • 5 Offline
                      5 Offline
                      5c2v
                      wrote on last edited by
                      #10

                      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
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved