如何以编程方式使窗口全屏显示?

How can I programmatically make a window fullscreen?

本文关键字:显示 窗口 方式使 编程      更新时间:2023-10-16

如何以编程方式使窗口全屏显示?

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
scene = new QNewScene(this);
ui->graphicsView->setScene(scene);
// here is some code that will make the window fullscreen

}

例如:

QTimer::singleShot(0, this, SLOT(showFullScreen()));

使窗口全屏显示的方法:

QWidget::showFullScreen()

在这里检查: https://doc.qt.io/qt-5/qwidget.html#showFullScreen