Skip to content

Commit

Permalink
Experimental support for top level widget changing + window flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jonoomph committed Oct 3, 2024
1 parent a454b7f commit fe607ed
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -3290,6 +3290,23 @@ def ignore_updates_callback(self, ignore):
# Keep track of ignore / not ignore
self.ignore_updates = ignore

def dock_top_level_changed(self):
log.info("dock_top_level_changed")
dw = self.sender()

if dw.isFloating():
# Set custom window flags for the floating dock widget
dw.setWindowFlags(Qt.CustomizeWindowHint |
Qt.Window |
Qt.WindowMinimizeButtonHint |
Qt.WindowMaximizeButtonHint |
Qt.WindowCloseButtonHint)
dw.show()
else:
# Restore default window flags when docked
dw.setWindowFlags(Qt.Widget)
dw.show()

def style_dock_widgets(self):
"""Check if any dock widget is part of a tabbed group and hide the title text if tabbed."""
theme = None
Expand Down Expand Up @@ -3610,6 +3627,7 @@ def __init__(self, *args):
# Connect the signals for each dock widget from self.getDocks()
for dock_widget in self.getDocks():
dock_widget.dockLocationChanged.connect(self.style_dock_widgets)
dock_widget.topLevelChanged.connect(self.dock_top_level_changed)

# Ensure toolbar is movable when floated (even with docks frozen)
self.toolBar.topLevelChanged.connect(
Expand Down

0 comments on commit fe607ed

Please sign in to comment.