// 设置一个高频定时器,移动当前窗口位置,然后又移动回来,来回交替就可以了!~
QTimer *timer = new QTimer(this);
timer->start(10);
connect(timer, SIGNAL(timeout()), this, SLOT(sltTimeout()));
void MainWindow::sltTimeout() {
static int nX = this->rect().x();
static int nY = this->rect().y();
if (nX == this->rect().x())
this->move(nX-10, nY -10);
else
this->move(nX, nY);
}