title: cannot resize window properly to 1/4 and resize back to original size
body: <p>I cannot resize window properly to 1/4 of the screen when the minimize button is clicked and resize back to the whole screen in the next click. when the minimize button is clicked, </p>
  
  <pre><code>this-&gt;setMaximumSize(400, 400);
  </code></pre>
  
  <p>works, but it overwrites previous window and the other parts of the UI still remain on the screen. The ui does not become smaller. Similarly, when I click minimize again to maximize UI, it again does not become bigger to the original size</p>
  
  <pre><code>ui-&gt;widget_display-&gt;setGeometry(200, 0, 791, 800);
  </code></pre>
  
  <p>I used the update() method, but still does not render the mainwindow from the beginning.</p>
  
  <pre><code>void MainWindow::on_pushButton_clicked()
  {
     if(minimized == false)
     {
        this-&gt;setMaximumSize(400, 400);
        ui-&gt;widget-&gt;hide();
        ui-&gt;widget_display-&gt;setGeometry(10, 10, 400, 400);
        minimized = true;
  
        update();
     }
     else
     {
        this-&gt;setMaximumSize(1152, 864);
        ui-&gt;widget-&gt;show();
        ui-&gt;widget_display-&gt;setGeometry(200, 0, 791, 800);
        minimized = false;
  
        update();
     }
  
     qDebug() &lt;&lt; "Minimizing";
  }
  </code></pre>