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. Qt app doesn't close properly (still visible in task manager)
Forum Updated to NodeBB v4.3 + New Features

Qt app doesn't close properly (still visible in task manager)

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 3 Posters 3.7k Views 2 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.
  • Pl45m4P Pl45m4

    @hobbyProgrammer

    Normally a MessageBox is shown above some parent Widget like QDialog, QWindow or QMainWindow. If you hide / close all widgets except your MessageBox and close the MessageBox afterwards, your program exits.

    Maybe you can replace your windows with one or two windows with a widget container like QStackedWidget or you replace widgets on runtime. This would reduce the amount of show / hide processes. But depends on you and your needs, what will work best for you. :)

    H Offline
    H Offline
    hobbyProgrammer
    wrote on last edited by hobbyProgrammer
    #7

    @Pl45m4 said in Qt app doesn't close properly (still visible in task manager):

    Maybe you can replace your windows with one or two windows with a widget container like QStackedWidget or you replace widgets on runtime. This would reduce the amount of show / hide processes. But depends on you and your needs, what will work best for you. :)

    That sounds pretty good, but all the windows have different functions. The first window is to login the second is to select something and the third is a drawing app using qgraphicsview.

    Pl45m4P 1 Reply Last reply
    0
    • H hobbyProgrammer

      @Pl45m4 said in Qt app doesn't close properly (still visible in task manager):

      Maybe you can replace your windows with one or two windows with a widget container like QStackedWidget or you replace widgets on runtime. This would reduce the amount of show / hide processes. But depends on you and your needs, what will work best for you. :)

      That sounds pretty good, but all the windows have different functions. The first window is to login the second is to select something and the third is a drawing app using qgraphicsview.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #8

      @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

      replace it with the new window

      Widget, not window.

      @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

      So with QStackedWidget I don't need to hide my window

      Yes, it works like a book. You can dynamically flip pages / widgets instead of showing a new window with static content.

      @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

      The first window is to login the second is to select something and the third is a drawing app using qgraphicsview

      I think two windows are enough. You could use a QDialog to login. After successful login, you show your QMainWindow with your QGraphicsView and your "settings". Either at the same time or you put a QStackedWidget on your QMainWindow and flip after you set everything up, to start drawing


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      H 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

        replace it with the new window

        Widget, not window.

        @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

        So with QStackedWidget I don't need to hide my window

        Yes, it works like a book. You can dynamically flip pages / widgets instead of showing a new window with static content.

        @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

        The first window is to login the second is to select something and the third is a drawing app using qgraphicsview

        I think two windows are enough. You could use a QDialog to login. After successful login, you show your QMainWindow with your QGraphicsView and your "settings". Either at the same time or you put a QStackedWidget on your QMainWindow and flip after you set everything up, to start drawing

        H Offline
        H Offline
        hobbyProgrammer
        wrote on last edited by hobbyProgrammer
        #9

        @Pl45m4 I understand, but I would (for now) really just like to find a way to make it work with 3 screens. Unless there's an easy way to change the screens to widgets, but I don't have much experience with that.
        I currently have screens with different UI's.
        I use screens with menu bars etc. so how can I convert that to a widget?

        Pl45m4P 1 Reply Last reply
        0
        • H hobbyProgrammer

          @Pl45m4 I understand, but I would (for now) really just like to find a way to make it work with 3 screens. Unless there's an easy way to change the screens to widgets, but I don't have much experience with that.
          I currently have screens with different UI's.
          I use screens with menu bars etc. so how can I convert that to a widget?

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by Pl45m4
          #10

          @hobbyProgrammer

          I've edited my last post. Check it out.

          @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

          I use screens with menu bars etc. so how can I convert that to a widget?

          You use Menus in your QMainWindow, right? You can leave them as they are.
          The QStackedWidget would only affect your MainWindows CentralWidget (Content of QMainWindow)

          QWidget is the base class of nearly everything in Qt. Every widget is... well... a QWidget (or inherits it).

          See:
          https://doc.qt.io/qt-5/qwidget.html


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          H 1 Reply Last reply
          1
          • Pl45m4P Pl45m4

            @hobbyProgrammer

            I've edited my last post. Check it out.

            @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

            I use screens with menu bars etc. so how can I convert that to a widget?

            You use Menus in your QMainWindow, right? You can leave them as they are.
            The QStackedWidget would only affect your MainWindows CentralWidget (Content of QMainWindow)

            QWidget is the base class of nearly everything in Qt. Every widget is... well... a QWidget (or inherits it).

            See:
            https://doc.qt.io/qt-5/qwidget.html

            H Offline
            H Offline
            hobbyProgrammer
            wrote on last edited by
            #11

            @Pl45m4 no the menus are different for each screen. However, I think I can apply this to the first two screens. The third one is diferent...

            Pl45m4P H 2 Replies Last reply
            0
            • H hobbyProgrammer

              @Pl45m4 no the menus are different for each screen. However, I think I can apply this to the first two screens. The third one is diferent...

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by
              #12

              @hobbyProgrammer

              I think you are making it more complicated than it really is or I dont understand what you are actually doing / planing to do :)
              From what I've read the last days, you are coding a more or less "simple" drawing app (with clickable and editable polygons / objects, contextMenu on rightclick and further settings in a different window.... and now with a login window at program start) Correct?


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              H 1 Reply Last reply
              1
              • Pl45m4P Pl45m4

                @hobbyProgrammer

                I think you are making it more complicated than it really is or I dont understand what you are actually doing / planing to do :)
                From what I've read the last days, you are coding a more or less "simple" drawing app (with clickable and editable polygons / objects, contextMenu on rightclick and further settings in a different window.... and now with a login window at program start) Correct?

                H Offline
                H Offline
                hobbyProgrammer
                wrote on last edited by
                #13

                @Pl45m4 yes that's correct

                1 Reply Last reply
                0
                • H hobbyProgrammer

                  @Pl45m4 no the menus are different for each screen. However, I think I can apply this to the first two screens. The third one is diferent...

                  H Offline
                  H Offline
                  hobbyProgrammer
                  wrote on last edited by hobbyProgrammer
                  #14

                  @Pl45m4

                  I wouldn't mind it if I had to remake the .ui file, but is there a way to keep the classes as they are?
                  I really don't want 1 big class for this as it would probably be 500 lines of code. I would like it to stay organized.

                  Pl45m4P 1 Reply Last reply
                  0
                  • JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #15

                    @hobbyProgrammer
                    Briefly, because you need this whole behaviour sorted out, as per the mess which is developing in your other thread, https://forum.qt.io/topic/108715/check-button-press-of-qmessagebox.

                    You have two choices:

                    • setQuitOnLastWindowClosed(true): Make sure your code always has a window open, till you/the user chooses to close it and exit the application.

                    • setQuitOnLastWindowClosed(false): If you cannot do the above, you must recognise in code when the last of your windows is closed and then exit the application explicitly.

                    1 Reply Last reply
                    0
                    • H hobbyProgrammer

                      @Pl45m4

                      I wouldn't mind it if I had to remake the .ui file, but is there a way to keep the classes as they are?
                      I really don't want 1 big class for this as it would probably be 500 lines of code. I would like it to stay organized.

                      Pl45m4P Offline
                      Pl45m4P Offline
                      Pl45m4
                      wrote on last edited by Pl45m4
                      #16

                      @hobbyProgrammer said in Qt app doesn't close properly (still visible in task manager):

                      I really don't want 1 big class for this as it would probably be 500 lines of code

                      500 LOC are not that much actually :)

                      You need to know what you want. If you set setQuitOnLastWindowClosed(false) only because of your MessageBox behavior, there is something wrong / not well structured with your classes.


                      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                      ~E. W. Dijkstra

                      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