@@ -174,7 +174,7 @@ class OWWidget(QDialog, OWComponent, Report, ProgressBarMixin,
174174 contextOpened = Signal ()
175175 contextClosed = Signal ()
176176
177- # pylint: disable=protected-access
177+ # pylint: disable=protected-access, access-member-before-definition
178178 def __new__ (cls , * args , captionTitle = None , ** kwargs ):
179179 self = super ().__new__ (cls , None , cls .get_flags ())
180180 QDialog .__init__ (self , None , self .get_flags ())
@@ -207,6 +207,8 @@ def __new__(cls, *args, captionTitle=None, **kwargs):
207207
208208 # flag indicating if the widget's position was already restored
209209 self .__was_restored = False
210+ # flag indicating the widget is still expecting the first show event.
211+ self .__was_shown = False
210212
211213 self .__statusMessage = ""
212214
@@ -573,16 +575,6 @@ def _fullscreen_to_maximized(geometry):
573575 y = max (0 , space .height () / 2 - height / 2 )
574576
575577 self .move (x , y )
576-
577- # Mark as explicitly moved/resized if not already. QDialog would
578- # otherwise adjust position/size on subsequent hide/show
579- # (move/resize events coming from the window manager do not set
580- # these flags).
581- if not self .testAttribute (Qt .WA_Moved ):
582- self .setAttribute (Qt .WA_Moved )
583- if not self .testAttribute (Qt .WA_Resized ):
584- self .setAttribute (Qt .WA_Resized )
585-
586578 return restored
587579
588580 def __updateSavedGeometry (self ):
@@ -654,6 +646,15 @@ def showEvent(self, event):
654646 if self .savedWidgetGeometry is not None :
655647 self .__restoreWidgetGeometry (bytes (self .savedWidgetGeometry ))
656648 self .__was_restored = True
649+
650+ if not self .__was_shown :
651+ # Mark as explicitly moved/resized if not already. QDialog would
652+ # otherwise adjust position/size on subsequent hide/show
653+ # (move/resize events coming from the window manager do not set
654+ # these flags).
655+ self .setAttribute (Qt .WA_Moved , True )
656+ self .setAttribute (Qt .WA_Resized , True )
657+ self .__was_shown = True
657658 self .__quicktipOnce ()
658659
659660 def wheelEvent (self , event ):
0 commit comments