Unsolved Why does Qt.quit() not close the application?
-
Why does Qt.quit() not close the application?
-
@Rohn
Did you read and act on http://doc.qt.io/qt-5/qml-qtqml-qt.html#quit-method and http://doc.qt.io/qt-5/qml-qtqml-qt.html#exit-method? For example:to quit a C++ application when this method is called, connect the QQmlEngine::quit() signal to the QCoreApplication::quit() slot.
Did you investigate that?
-
@JonB I am working with PyQt5 binding....please let me how I can handle -> Signal QQmlEngine::quit() emitted, but no receivers connected to handle it............in python file using pyqt5.........................In my QML file Qt.Quit() called at that this error is generated
-
@Rohn said in Why does Qt.quit() not close the application?:
Then if you Googled for:pyqt5 QQmlEngine
you would have come across:
https://stackoverflow.com/questions/30586983/how-to-close-pyqt5-program-from-qml
which answers excatly for you...? -
@JonB My .py file is.......
@test.py
import os
import sysfrom PyQt5.QtCore import QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtWebEngine import QtWebEngineif name == 'main':
sys.argv.extend(['-platform', 'eglfs'])
app = QGuiApplication(sys.argv)
app.setApplicationName("Hello World")QtWebEngine.initialize() view = QQuickView() view.setResizeMode(QQuickView.SizeRootObjectToView) view.setSource( QUrl.fromLocalFile(os.path.join(os.path.dirname(__file__), 'textScrollView.qml')) ) view.show() sys.exit(app.exec_())
I am using the following logic in My QML application
@ qml code
Timer {
id:startTimer
interval: 1
repeat: true
running: true
onTriggered: {
if( flickArea.contentY === 0)
delay(1000);
flickArea.contentY = flickArea.contentY + 1
if(flickArea.contentY > textArea.height){
Qt.quit() // this line giving an error} } }
please let me know how can I overcome this issue
-
@Rohn
As I already posted, https://stackoverflow.com/a/30605174/489865 shows you the necessary code you need to put into yourdef main()
. Did you do that?