Skip to content

Commit e7da4ed

Browse files
committed
owsilhouetteplot: Correct scene geometry update
The scene rect was not adjusted properly when decreasing the bar size height.
1 parent 195383d commit e7da4ed

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Orange/widgets/visualize/owsilhouetteplot.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,20 +326,14 @@ def _replot(self):
326326

327327
self.scene.addItem(silplot)
328328
self._update_annotations()
329-
330-
silplot.resize(silplot.effectiveSizeHint(Qt.PreferredSize))
331329
silplot.selectionChanged.connect(self.commit)
332-
333-
self.scene.setSceneRect(
334-
QRectF(QPointF(0, 0),
335-
self._silplot.effectiveSizeHint(Qt.PreferredSize)))
330+
silplot.layout().activate()
331+
self._update_scene_rect()
332+
silplot.geometryChanged.connect(self._update_scene_rect)
336333

337334
def _update_bar_size(self):
338335
if self._silplot is not None:
339336
self._set_bar_height()
340-
self.scene.setSceneRect(
341-
QRectF(QPointF(0, 0),
342-
self._silplot.effectiveSizeHint(Qt.PreferredSize)))
343337

344338
def _update_annotations(self):
345339
if 0 < self.annotation_var_idx < len(self.annotation_var_model):
@@ -360,6 +354,9 @@ def _update_annotations(self):
360354
else:
361355
self._silplot.setRowNames(None)
362356

357+
def _update_scene_rect(self):
358+
self.scene.setSceneRect(self._silplot.geometry())
359+
363360
def commit(self):
364361
"""
365362
Commit/send the current selection to the output.
@@ -541,6 +538,7 @@ def setRowNamesVisible(self, visible):
541538
self.__rowNamesVisible = visible
542539
for item in self.__textItems():
543540
item.setVisible(visible)
541+
self.updateGeometry()
544542

545543
def rowNamesVisible(self):
546544
return self.__rowNamesVisible

0 commit comments

Comments
 (0)