@@ -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