Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PyQt5 - self.hide causes app to terminate
QtWS25 Last Chance

PyQt5 - self.hide causes app to terminate

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 555 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.
  • C Offline
    C Offline
    corelanc0d3r
    wrote on last edited by
    #1

    Hi,

    I am currently writing my first project based on PyQt5. You can find the source here: https://github.com/corelan/pyencfsgui

    For some reason, when I try to hide the main window using self.hide(), the application terminates.

    Does anyone know what I'm doing wrong?

    thanks !

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean you would like your GUI application to continue running even without any widget available ?

      By the way, what version of PyQt5 or PySide2 are you using ?
      On what OS ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Do you mean you would like your GUI application to continue running even without any widget available ?

        By the way, what version of PyQt5 or PySide2 are you using ?
        On what OS ?

        C Offline
        C Offline
        corelanc0d3r
        wrote on last edited by
        #3

        @SGaist nvm fixed it - to launch my app, I was using <mainwindow>.exec_ instead of app.exec_. Doing a self.hide on the mainwindow made it terminate. Changing it to app.exec_ fixed it.

        JonBJ 1 Reply Last reply
        0
        • C corelanc0d3r

          @SGaist nvm fixed it - to launch my app, I was using <mainwindow>.exec_ instead of app.exec_. Doing a self.hide on the mainwindow made it terminate. Changing it to app.exec_ fixed it.

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

          @corelanc0d3r
          For the record: hiding/closing the main window made your application terminate because of https://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-prop

          This property holds whether the application implicitly quits when the last window is closed.

          The default is true.

          If this property is true, the applications quits when the last visible primary window (i.e. window with no parent) is closed.

          C 1 Reply Last reply
          3
          • JonBJ JonB

            @corelanc0d3r
            For the record: hiding/closing the main window made your application terminate because of https://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-prop

            This property holds whether the application implicitly quits when the last window is closed.

            The default is true.

            If this property is true, the applications quits when the last visible primary window (i.e. window with no parent) is closed.

            C Offline
            C Offline
            corelanc0d3r
            wrote on last edited by
            #5

            @JonB cool, good to know ! :)

            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