title: Docking animation for right side doesn't reappear after size adjustment while floating
body: <p>In my current layout, I have a table in a dock widget that is initially docked (right side).  I adjust the contents of the QMainWindow by connecting a function to topLevelChanged() to fill the blank space while floating</p>
  <pre><code>self.log_dock.topLevelChanged.connect(self.resize_dock)
  
  def resize_dock(self):
          layout = self.tb_utils.findChild(QtWidgets.QLayout)
          layout.setExpanded(True)
          self.adjustSize()
  </code></pre>
  <p>This works wonderfully - however; after doing so - I'm not entirely sure how to get it to redock to it's original position, or animate to expand the window again.  If I manually adjust the QMainWindow slightly, it will allow the dock - or it can be moved into another dock area, and then moved back into position - but this is not ideal.</p>
  <p>EDIT: New program using minimal reproducible example</p>
  <pre><code>from PyQt5 import uic
  from PyQt5.QtWidgets import QApplication, QMainWindow, QLayout
  import sys
  
  gui = uic.loadUiType('dock_behavior.ui')[0]
  
  class Window(QMainWindow, gui):
      def __init__(self):
          super(Window, self).__init__()
          self.setupUi(self)
          self._connectEvents()
          
      def _connectEvents(self):
          self.dockWidget.topLevelChanged.connect(self.resize_dock)
          self.show_dock.toggled.connect(self.enable_dock)
          
      def resize_dock(self):     
          self.adjustSize()        
          layout = self.toolBar.findChild(QLayout)
          layout.setExpanded(True)
                  
      def enable_dock(self):
          self.dockWidget.toggleViewAction().trigger()
          
  if __name__ == &quot;__main__&quot;:
      app = QApplication(sys.argv)
      window = Window()
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  <p>The GUI as produced by Qt Designer</p>
  <pre><code>&lt;ui version=&quot;4.0&quot;&gt;
   &lt;class&gt;MainWindow&lt;/class&gt;
   &lt;widget class=&quot;QMainWindow&quot; name=&quot;MainWindow&quot;&gt;
    &lt;property name=&quot;geometry&quot;&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;825&lt;/width&gt;
      &lt;height&gt;600&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name=&quot;minimumSize&quot;&gt;
     &lt;size&gt;
      &lt;width&gt;500&lt;/width&gt;
      &lt;height&gt;600&lt;/height&gt;
     &lt;/size&gt;
    &lt;/property&gt;
    &lt;property name=&quot;windowTitle&quot;&gt;
     &lt;string&gt;MainWindow&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class=&quot;QWidget&quot; name=&quot;centralwidget&quot;&gt;
     &lt;widget class=&quot;QFrame&quot; name=&quot;frame&quot;&gt;
      &lt;property name=&quot;geometry&quot;&gt;
       &lt;rect&gt;
        &lt;x&gt;19&lt;/x&gt;
        &lt;y&gt;19&lt;/y&gt;
        &lt;width&gt;461&lt;/width&gt;
        &lt;height&gt;541&lt;/height&gt;
       &lt;/rect&gt;
      &lt;/property&gt;
      &lt;property name=&quot;minimumSize&quot;&gt;
       &lt;size&gt;
        &lt;width&gt;461&lt;/width&gt;
        &lt;height&gt;541&lt;/height&gt;
       &lt;/size&gt;
      &lt;/property&gt;
      &lt;property name=&quot;frameShape&quot;&gt;
       &lt;enum&gt;QFrame::StyledPanel&lt;/enum&gt;
      &lt;/property&gt;
      &lt;property name=&quot;frameShadow&quot;&gt;
       &lt;enum&gt;QFrame::Raised&lt;/enum&gt;
      &lt;/property&gt;
      &lt;widget class=&quot;QWidget&quot; name=&quot;horizontalLayoutWidget&quot;&gt;
       &lt;property name=&quot;geometry&quot;&gt;
        &lt;rect&gt;
         &lt;x&gt;19&lt;/x&gt;
         &lt;y&gt;19&lt;/y&gt;
         &lt;width&gt;411&lt;/width&gt;
         &lt;height&gt;501&lt;/height&gt;
        &lt;/rect&gt;
       &lt;/property&gt;
       &lt;layout class=&quot;QHBoxLayout&quot; name=&quot;horizontalLayout&quot;/&gt;
      &lt;/widget&gt;
     &lt;/widget&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QToolBar&quot; name=&quot;toolBar&quot;&gt;
     &lt;property name=&quot;windowTitle&quot;&gt;
      &lt;string&gt;toolBar&lt;/string&gt;
     &lt;/property&gt;
     &lt;property name=&quot;layoutDirection&quot;&gt;
      &lt;enum&gt;Qt::RightToLeft&lt;/enum&gt;
     &lt;/property&gt;
     &lt;attribute name=&quot;toolBarArea&quot;&gt;
      &lt;enum&gt;TopToolBarArea&lt;/enum&gt;
     &lt;/attribute&gt;
     &lt;attribute name=&quot;toolBarBreak&quot;&gt;
      &lt;bool&gt;false&lt;/bool&gt;
     &lt;/attribute&gt;
     &lt;addaction name=&quot;show_dock&quot;/&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QDockWidget&quot; name=&quot;dockWidget&quot;&gt;
     &lt;property name=&quot;minimumSize&quot;&gt;
      &lt;size&gt;
       &lt;width&gt;291&lt;/width&gt;
       &lt;height&gt;0&lt;/height&gt;
      &lt;/size&gt;
     &lt;/property&gt;
     &lt;attribute name=&quot;dockWidgetArea&quot;&gt;
      &lt;number&gt;2&lt;/number&gt;
     &lt;/attribute&gt;
     &lt;widget class=&quot;QWidget&quot; name=&quot;dockWidgetContents&quot;/&gt;
    &lt;/widget&gt;
    &lt;action name=&quot;show_dock&quot;&gt;
     &lt;property name=&quot;checkable&quot;&gt;
      &lt;bool&gt;true&lt;/bool&gt;
     &lt;/property&gt;
     &lt;property name=&quot;text&quot;&gt;
      &lt;string&gt;Show / Hide Dock&lt;/string&gt;
     &lt;/property&gt;
    &lt;/action&gt;
   &lt;/widget&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  
  
  </code></pre>