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. Why does Qt.quit() not close the application?
Forum Updated to NodeBB v4.3 + New Features

Why does Qt.quit() not close the application?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 4.6k 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.
  • R Offline
    R Offline
    Rohn
    wrote on last edited by
    #1

    Why does Qt.quit() not close the application?

    JonBJ 1 Reply Last reply
    0
    • R Rohn

      Why does Qt.quit() not close the application?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @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?

      R 1 Reply Last reply
      2
      • JonBJ JonB

        @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?

        R Offline
        R Offline
        Rohn
        wrote on last edited by
        #3

        @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

        JonBJ 1 Reply Last reply
        0
        • R Rohn

          @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

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @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...?

          R 1 Reply Last reply
          0
          • JonBJ JonB

            @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...?

            R Offline
            R Offline
            Rohn
            wrote on last edited by Rohn
            #5

            @JonB My .py file is.......

            @test.py

            import os
            import sys

            from PyQt5.QtCore import QUrl
            from PyQt5.QtGui import QGuiApplication
            from PyQt5.QtQuick import QQuickView
            from PyQt5.QtWebEngine import QtWebEngine

            if 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

            JonBJ 1 Reply Last reply
            0
            • R Rohn

              @JonB My .py file is.......

              @test.py

              import os
              import sys

              from PyQt5.QtCore import QUrl
              from PyQt5.QtGui import QGuiApplication
              from PyQt5.QtQuick import QQuickView
              from PyQt5.QtWebEngine import QtWebEngine

              if 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

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #6

              @Rohn
              As I already posted, https://stackoverflow.com/a/30605174/489865 shows you the necessary code you need to put into your def main(). Did you do that?

              1 Reply Last reply
              1

              • Login

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