# SUMMARY When poping out a widget (make it to its own floating window) and then closing it. I am unable to get the widget back. STEPS TO REPRODUCE 1. Make a widget float, for example Map (press the little pop out button in the top right of every widget) 2. Close the floating widget with a hotkey, such as ALT+F4 (depending on your window manager/desktop environment) 3. Now you can't get this widget back. Even a restart restores the old layout and leaves the widget missing. OBSERVED RESULT Also, when right-clicking on the menu bar, it's shown, that a widget is missing, such as the map. But everything is disabled, so you can't make the widget visible again. The only workaround so far is to edit `$XDG_CONFIG_HOME/kgeotagrc` (normally ~/.config/kgeotagrc) and removing `windowState` under `[main]`. EXPECTED RESULT It would be nice, to either disable the possibility of removing widget, so ALT+F4 does not do anything on widgets or just moves them back to the main window. Or, it would be nice to enable removed widgets again via the menu bar. SOFTWARE/OS VERSIONS Distro: Arch Linux Linux: 6.9.4-zen1-1-zen Qt Version: 6.7.1 and Distro: Ubuntu 22.04 LTS Linux: 6.5.0-35-generic Qt version: 5.15.3 (happens on both of them) ADDITIONAL INFORMATION If I add the following feature to the widgets: `QDockWidget::DockWidgetClosable`, then it's possible to recover a lost widget via the menu bar on top of the main window.
Hi, thanks for your report! The docks shouldn't be closable in the first place ... at least, it's not possible to close them via mouse click (the features set are "QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable", so QDockWidget::DockWidgetClosable is not enabled). If you can close such a floating dock nevertheless, this maybe depends on the window manager and I can't fix or prevent this at all (I think I can't do more than define that the docks are not closable) ... I'll have to investigate this. As a workaround, you should be able to recover all docks and their default position via "Settings" → "Set default dock arrangement". About the kgeotagrc: Current git master now uses KMainWindow's state instead of saving the state twice, so the state is now MainWindow/State. However, there will be a (now unused) main/windowState entry. Maybe, I'll add a quick check to remove this key later on to prevent confusion.
Git commit 2d298421ab3f4d4f8c9e39f33e4f95ac3a4b7f92 by Tobias Leupold. Committed on 17/06/2024 at 09:50. Pushed by tleupold into branch 'master'. Be sure to actually show all docks when settuing the default arrangement M +5 -0 src/MainWindow.cpp https://invent.kde.org/graphics/kgeotag/-/commit/2d298421ab3f4d4f8c9e39f33e4f95ac3a4b7f92
Okay, this at least ensures that a closed dock widget is shown again when applying the default dock arrangement. However, I think this is an upstream bug: The dock widget should not be closable in the first place. I'll file an according kwin bug.
FYI: I just filed Bug #488616 about this. I think I'll try to work around this by using a QDockWidget subclass that catches the QCloseEvent that should be ignored. I'm not sure if I can detect if the dock is closed because the program is quit or by using a shortcut to close it, but let's see. However, recovering such a closed dock is now possible by setting the default dock arrangement, so at least, we have a workaround.
Hi, wow, thanks for the quick response! I have no experience with QT, but I suspected, that you explicitly left out `QDockWidget::DockWidgetClosable`, so it's not possible to close those widgets, I just wanted to add it as a workaround :) Also, thanks for the quick fix with the `Set default dock arrangement` button, that works great! Finally, thanks for filing those bug reports upstream, I am just amazed by how quickly everything went. Thanks for all the help!! Let's see where https://bugreports.qt.io/browse/QTBUG-126418 gets us :)
You're welcome :-) The fact that the Qt guys already triaged this as "important" is maybe a good sign. I think I'll wait what they say. If this is fixed upstream, there's no need to implement a workaround. And for accidental closing of floating docks, we now have the "default arrangement" workaround to get them back. Well, let's see … I think I'll let this bug open as a reminder to check what upstream does now and then …
Closing this as it's actually an upstream bug and we at least have a workaround.