Skip to content

Commit

Permalink
FIX: partial fix, top-level widgets resize properly when emptied now
Browse files Browse the repository at this point in the history
  • Loading branch information
ZLLentz committed Jun 13, 2024
1 parent 0afb0ef commit b605ca7
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions typhos/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,31 @@ def open_context_menu(self, ev):
menu = self.generate_context_menu()
menu.exec_(self.mapToGlobal(ev.pos()))

def resizeEvent(self, event: QtGui.QResizeEvent):
def maybe_fix_parent_size(self):
if self.nested_panel:
# force this widget's container to give it enough space!
# force this widget's containers to give it enough space!
self.parent().setMinimumHeight(self.parent().minimumSizeHint().height())

def resizeEvent(self, event: QtGui.QResizeEvent):
"""
Fix the parent container's size whenever our size changes.
This also runs when we add or filter rows.
"""
self.maybe_fix_parent_size()
return super().resizeEvent(event)

def setVisible(self, visible: bool):
"""
Fix the parent container's size whenever we switch visibility.
This also runs when we toggle a row visibility using the title
and when all signal rows get filtered all at once.
"""
rval = super().setVisible(visible)
self.maybe_fix_parent_size()
return rval


class CompositeSignalPanel(SignalPanel):
"""
Expand Down

0 comments on commit b605ca7

Please sign in to comment.