Qt get screen size and set window location

WidgetMainWindow w;

QRect rec = QApplication::desktop()->screenGeometry();
int height = rec.height();
int width = rec.width();
w.setGeometry(width - 450, 10, 450, 700);
w.show();