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. Dockable widget gone AWOL
Qt 6.11 is out! See what's new in the release blog

Dockable widget gone AWOL

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 4 Posters 1.5k Views 4 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

    @Perdrix

    Check @jsulm 's comment here

    PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #6

    @Pl45m4 I thought that was just to prevent the X to close the widget from being displayed. I want to stop alt-F4 from closing it/

    PerdrixP 1 Reply Last reply
    0
    • PerdrixP Perdrix

      @Pl45m4 I thought that was just to prevent the X to close the widget from being displayed. I want to stop alt-F4 from closing it/

      PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #7

      @Perdrix I can confirm that on Windows at least, the following does not prevent the dock widget from being closed:

      	setFeatures(features() & ~QDockWidget::DockWidgetClosable);
      

      To prevent it being closed it appears that you need to do this:

      //
      // The user may not close the undocked window
      //
      void ExplorerBar::closeEvent(QCloseEvent* event)
      {
      	event->ignore();
      }
      
      1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @Perdrix

        Your reported issue is normal behavior. Once you close (X or Alt F4) a dockwidget, it is hidden and by default you have no possibility to show it again using the GUI. This has to be done by code or with the help of the dockWidget's toggles.

        The DockWidgets Example has this implemented as @SGaist described.

        • https://doc.qt.io/qt-6/qtwidgets-mainwindows-dockwidgets-example.html#mainwindow-class-implementation
        Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by Chris Kawa
        #8

        @Pl45m4 said:

        Once you close (X or Alt F4) a dockwidget, it is hidden and by default you have no possibility to show it again using the GUI

        That's not entirely true. If your main window has either a menu bar, tool bar or any other docks you can right click on any of them and a list of all dock windows will pop up. You can show the hidden docks from there.

        I'd say don't block closing of the docks. That's working against user experience because you don't want to deal with it. Not a good thing. A proper way to handle this is make the reopening feature more discoverable. A usual way of dealing with it is providing a "Windows" menu with all the dock actions that let you toggle their visibility. That's what I would suggest. A dock already provides the actions and all the handling. All you have to do is put them in a menu.

        PerdrixP 1 Reply Last reply
        1
        • Chris KawaC Chris Kawa

          @Pl45m4 said:

          Once you close (X or Alt F4) a dockwidget, it is hidden and by default you have no possibility to show it again using the GUI

          That's not entirely true. If your main window has either a menu bar, tool bar or any other docks you can right click on any of them and a list of all dock windows will pop up. You can show the hidden docks from there.

          I'd say don't block closing of the docks. That's working against user experience because you don't want to deal with it. Not a good thing. A proper way to handle this is make the reopening feature more discoverable. A usual way of dealing with it is providing a "Windows" menu with all the dock actions that let you toggle their visibility. That's what I would suggest. A dock already provides the actions and all the handling. All you have to do is put them in a menu.

          PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote on last edited by
          #9

          @Chris-Kawa That sort of works for an application with a regular menu but for an application that doesn't have one:

          b6b983a1-24a3-4ae4-9c2b-b61840ee78c7-image.png

          then blocking the close action seems to make sense (at least for me):

          Chris KawaC 1 Reply Last reply
          0
          • PerdrixP Perdrix

            @Chris-Kawa That sort of works for an application with a regular menu but for an application that doesn't have one:

            b6b983a1-24a3-4ae4-9c2b-b61840ee78c7-image.png

            then blocking the close action seems to make sense (at least for me):

            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @Perdrix Blocking close event means providing a button in UI that, from user's perspective, does nothing. No, that's not better. That's bad UX. Providing a way to restore the dock is the right thing to do.

            PerdrixP 1 Reply Last reply
            0
            • Chris KawaC Chris Kawa

              @Perdrix Blocking close event means providing a button in UI that, from user's perspective, does nothing. No, that's not better. That's bad UX. Providing a way to restore the dock is the right thing to do.

              PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by Perdrix
              #11

              @Chris-Kawa There's no close button on my dockable widgets so no possible confusion there.!

              df0d1594-9bfb-44a4-b7a2-fc9e27191d13-image.png

              Chris KawaC 1 Reply Last reply
              0
              • PerdrixP Perdrix

                @Chris-Kawa There's no close button on my dockable widgets so no possible confusion there.!

                df0d1594-9bfb-44a4-b7a2-fc9e27191d13-image.png

                Chris KawaC Offline
                Chris KawaC Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on last edited by
                #12

                @Perdrix Note that your user complained that they can't restore the dock. Not that they can close it. The next issue reported by users will probably be that they can't close the dock now.

                Anyway, no point in arguing. I think blocking the close is the wrong thing to do, but it's obviously your app, so it's up to you. You know the options.

                PerdrixP 1 Reply Last reply
                0
                • Chris KawaC Chris Kawa

                  @Perdrix Note that your user complained that they can't restore the dock. Not that they can close it. The next issue reported by users will probably be that they can't close the dock now.

                  Anyway, no point in arguing. I think blocking the close is the wrong thing to do, but it's obviously your app, so it's up to you. You know the options.

                  PerdrixP Offline
                  PerdrixP Offline
                  Perdrix
                  wrote on last edited by Perdrix
                  #13

                  @Chris-Kawa No actually, that is not the case.

                  The initial user complaint was that the left dockable window wasn't displayed and the user had no idea how it had "gone away". After quite a bit of experimentation, he discovered that Alt-F4 was the culprit and that line I quoted was from his email reporting that it was Alt-F4 that caused the problem. I have so far had this reported at least 5 times.

                  Once the widgets are undocked you can right click on their title bar until you are blue in the face and no menu to show/hide the dockable widgets is displayed. That only shows up (AFAICT) when the widgets are docked - I wasn't even aware that menu existed until now.

                  Chris KawaC 1 Reply Last reply
                  0
                  • PerdrixP Perdrix

                    @Chris-Kawa No actually, that is not the case.

                    The initial user complaint was that the left dockable window wasn't displayed and the user had no idea how it had "gone away". After quite a bit of experimentation, he discovered that Alt-F4 was the culprit and that line I quoted was from his email reporting that it was Alt-F4 that caused the problem. I have so far had this reported at least 5 times.

                    Once the widgets are undocked you can right click on their title bar until you are blue in the face and no menu to show/hide the dockable widgets is displayed. That only shows up (AFAICT) when the widgets are docked - I wasn't even aware that menu existed until now.

                    Chris KawaC Offline
                    Chris KawaC Offline
                    Chris Kawa
                    Lifetime Qt Champion
                    wrote on last edited by
                    #14

                    @Perdrix Really no point in arguing over this. It's a matter of opinion. If an app gave me a floating window I couldn't close, the next thing I would probably do is close it, uninstall and never look back. But that's me. Your app and your design - up to you.

                    PerdrixP 1 Reply Last reply
                    0
                    • Chris KawaC Chris Kawa

                      @Perdrix Really no point in arguing over this. It's a matter of opinion. If an app gave me a floating window I couldn't close, the next thing I would probably do is close it, uninstall and never look back. But that's me. Your app and your design - up to you.

                      PerdrixP Offline
                      PerdrixP Offline
                      Perdrix
                      wrote on last edited by Perdrix
                      #15

                      @Chris-Kawa How can I programmatically display that menu for app windows? Found it QMainWindow::createPopupMenu()

                      PerdrixP 1 Reply Last reply
                      0
                      • PerdrixP Perdrix

                        @Chris-Kawa How can I programmatically display that menu for app windows? Found it QMainWindow::createPopupMenu()

                        PerdrixP Offline
                        PerdrixP Offline
                        Perdrix
                        wrote on last edited by
                        #16
                        This post is deleted!
                        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