Important: Please read the Qt Code of Conduct -

Full screen with Stacked Widget

  • I am developing an application where there are multiple screens to make selection and enter data. Then as per selection, a video is played. So I created a MainWindow as first screen, added a stacked widget. Each screen is a widget inside stacked widget including one which plays video (played using QMediaPlayer and I have called showFullScreen()).

    If i do MainWindow.showFullScreen()
    One of the screen has QGraphicsView, and it does not display anything I draw on it but the video plays full screen which is what I want.

    If I do not do MainWindow.showFullScreen()
    QGraphicsView works ok but now QMediaPlayer does not play full screen (Title bar of main window does not hide)

    Problem is the title bar does not hide as i want when playing video. Can someone help, on how to hide titlebar when playing video?


  • I also tried setting w.setWindowFlags(Qt::WindowType::Window | Qt::WindowType::FramelessWindowHint); in main.cpp (developing using Visual Studio).

    Again, now the Video does play full screen but QGraphicsView is screwed and does not draw anything. I think the main problem is making QGraphicsView work as expected in Full screen mode. Any one has any suggestions ?

    Code for QGraphicsView class:

    secondPage::secondPage(QWidget *parent)
    : QWidget(parent)

    graphicsView = new QGraphicsView(this);
    scene = new QGraphicsScene(this);
    graphicsView->setMinimumSize(1600, 900);
    graphicsView->setSceneRect(0,0, 1600, 900);
    connect(this, SIGNAL(callParent()), this->parent(), SLOT(changePage()));
    mytimer = new QTimer(this);
    connect(mytimer, SIGNAL(timeout()), this, SLOT(moveEllipse()));


  • Lifetime Qt Champion


    Your QGraphicsView is not set in any layout so it won't follow any resizing that could happen to your secondPage class.

    On a side note: connect(this, SIGNAL(callParent()), this->parent(), SLOT(changePage())); that's wrong by design. Child widget shoulds not have any expectation nor knowledge of their parent. That's creating tight coupling and becomes maintenance nightmare.

Log in to reply