@@ -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
@@ -577,16 +579,6 @@ def _fullscreen_to_maximized(geometry):
577579 y = max (0 , space .height () / 2 - height / 2 )
578580
579581 self .move (x , y )
580-
581- # Mark as explicitly moved/resized if not already. QDialog would
582- # otherwise adjust position/size on subsequent hide/show
583- # (move/resize events coming from the window manager do not set
584- # these flags).
585- if not self .testAttribute (Qt .WA_Moved ):
586- self .setAttribute (Qt .WA_Moved )
587- if not self .testAttribute (Qt .WA_Resized ):
588- self .setAttribute (Qt .WA_Resized )
589-
590582 return restored
591583
592584 def __updateSavedGeometry (self ):
@@ -658,6 +650,15 @@ def showEvent(self, event):
658650 if self .savedWidgetGeometry is not None :
659651 self .__restoreWidgetGeometry (bytes (self .savedWidgetGeometry ))
660652 self .__was_restored = True
653+
654+ if not self .__was_shown :
655+ # Mark as explicitly moved/resized if not already. QDialog would
656+ # otherwise adjust position/size on subsequent hide/show
657+ # (move/resize events coming from the window manager do not set
658+ # these flags).
659+ self .setAttribute (Qt .WA_Moved , True )
660+ self .setAttribute (Qt .WA_Resized , True )
661+ self .__was_shown = True
661662 self .__quicktipOnce ()
662663
663664 def wheelEvent (self , event ):
0 commit comments