我希望把我的主窗口显示在屏幕的右侧。
我使用了这段代码:
QRect r = this->frameGeometry();
r.moveRight(QDesktopWidget::availableGeometry());
this->move(r.topRight());
我收到了这个错误:
错误:无法在没有对象的情况下调用成员函数'const QRect QDesktopWidget::availableGeometry(int) const'
如果我使用1024代替QDesktopWidget::availableGeometry()
,它可以工作...但我不想静态初始化...
如何动态地为不同的屏幕尺寸重新定位窗口?