w.move((a.desktop()->width() - w.width())/2, (a.desktop()->height() - w.height())/2);
上述方法可以置中,但是是在排除任务栏之外的区域置中。
其他方式: