Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] OWWidget: Fix size hint propagation #3253

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion Orange/widgets/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,19 @@ def get_flags(cls):

class _Splitter(QSplitter):
handleClicked = Signal()

def _adjusted_size(self, size_method):
size = size_method(super())()
parent = self.parentWidget()
if isinstance(parent, OWWidget) \
and not parent.controlAreaVisible \
and self.count() > 1:
indices = range(1, self.count())
else:
indices = range(0, self.count())

height = max((size_method(self.widget(i))().height()
for i in range(self.count()) if self.sizes()[i]),
for i in indices),
default=0)
size.setHeight(height)
return size
Expand Down Expand Up @@ -618,6 +627,22 @@ def closeEvent(self, event):
self.__updateSavedGeometry()
QDialog.closeEvent(self, event)

def setVisible(self, visible):
# type: (bool) -> None
"""Reimplemented from `QDialog.setVisible`."""
if visible:
# Force cached size hint invalidation ... The size hints are
# sometimes not properly invalidated via the splitter's layout and
# nested left_part -> controlArea layouts. This causes bad initial
# size when the widget is first shown.
if self.controlArea is not None:
self.controlArea.updateGeometry()
if self.buttonsArea is not None:
self.buttonsArea.updateGeometry()
if self.mainArea is not None:
self.mainArea.updateGeometry()
super().setVisible(visible)

def showEvent(self, event):
"""Overloaded to restore the geometry when the widget is shown
"""
Expand Down