I have re-implemented keyPressEvent for my class inherited from QDialog

void my_dialog::keyPressEvent(QKeyEvent* e)
{
QCursor c = this->cursor();
QCursor::setPos (mapToGlobal( QPoint( width()/2, height()/2 )) );

}
I want to move cursor to the center of widget, but nothing happens

which is my mistake ?