void MainWindow::changeEvent ( QEvent * event)
{
if(windowState() & Qt::WindowMinimized)
{
setWindowState(windowState() & ~Qt::WindowMinimized);
resize(size()*0.5);
}
}
@
But this code doesn't run as I supposed .
After I press the minimize button ,
the window minimizes before its size has been changed ,
and then appears with a shortened size .

What should I do if I want to change the size of a window when press the minimize button instead of minimizing it .

I think you should accept the event in your code, after it has done your stuff. If you don't do that, the event is passed further down the event loop, and then the default handler minimizes the window. But if you accept, processing of this particular event stops: