I cannot resize window properly. when the minimize button is clicked,
Qt Code:
  1. this->setMaximumSize(400, 400);
To copy to clipboard, switch view to plain text mode 
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
Qt Code:
  1. ui->widget_display->setGeometry(200, 0, 791, 800);
To copy to clipboard, switch view to plain text mode 
. I used the update() method, but still does not render the mainwindow from the beginning.

Qt Code:
  1. void MainWindow::on_pushButton_clicked()
  2. {
  3. if(minimized == false)
  4. {
  5. this->setMaximumSize(400, 400);
  6. ui->widget->hide();
  7. ui->widget_display->setGeometry(10, 10, 400, 400);
  8. minimized = true;
  9.  
  10. update();
  11. }
  12. else
  13. {
  14. this->setMaximumSize(1152, 864);
  15. ui->widget->show();
  16. ui->widget_display->setGeometry(200, 0, 791, 800);
  17. minimized = false;
  18.  
  19. update();
  20. }
  21.  
  22. qDebug() << "Minimizing";
  23. }
To copy to clipboard, switch view to plain text mode