窗口打开默认在屏幕中间显示:
CameraWidget::CameraWidget(QWidget *parent, int index) : QWidget(parent), ui(new Ui::CameraWidget) { ui->setupUi(this); //隐藏标题栏 setWindowFlags(Qt::FramelessWindowHint);//无边框 //窗口显示在屏幕正中间 QDesktopWidget *desktop = QApplication::desktop(); move((desktop->width()-this->width())/2,(desktop->height()-this->height())/2); }
窗口打开默认在屏幕右下角显示:
CameraWidget::CameraWidget(QWidget *parent, int index) : QWidget(parent), ui(new Ui::CameraWidget) { ui->setupUi(this); //隐藏标题栏 setWindowFlags(Qt::FramelessWindowHint);//无边框 //打开的窗口在屏幕右下角 QDesktopWidget *widget= QApplication::desktop(); move(widget->width()-this->width(),widget->height()-this->height()); }