[solved] terminate application
-
wrote on 17 Jun 2011, 19:06 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?
-
wrote on 17 Jun 2011, 19:32 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()));
@ -
wrote on 29 Sept 2011, 13:50 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...
-
wrote on 29 Sept 2011, 14:11 last edited by
What does "does not start" mean?
-
wrote on 29 Sept 2011, 14:15 last edited by
Signal QDeclarativeEngine::quit() emitted, but no receivers connected to handle it.
-
wrote on 29 Sept 2011, 14:52 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?
-
wrote on 29 Sept 2011, 14:59 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.
@ -
wrote on 29 Sept 2011, 15:06 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"
-
wrote on 29 Sept 2011, 15:34 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.
-
wrote on 5 Mar 2012, 14:40 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 ;)