Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtWebEngine flashes when the frameless window is maximized



  • I have a frameless QtWebEngine program that flashes when the focus changes after running on a screen without a taskbar and maximizing the window.

    It works fine on a screen with a taskbar.

    Following is my test code:

    #include <QWidget>
    #include <QHBoxLayout>
    #include <QApplication>
    #include <QWebEngineView>
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QWidget* widget = new QWidget(0);
        widget->setWindowFlags(Qt::FramelessWindowHint);
        QHBoxLayout* lay_parent = new QHBoxLayout;
        QWebEngineView *webView = new QWebEngineView;
        webView->load(QUrl("https://qt.io"));
        widget->show();
        lay_parent->addWidget(webView);
        widget->setLayout(lay_parent);
        widget->showMaximized();
        return app.exec();
    }
    

    I tried setting up OpenGL, and it works.
    But on some machines the program will fails to run.

    QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
    

    or

    QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
    

    Is there a better way to stop it from flickering?

    This is my test environment:

    Operating System: Windows 7, Windows 10

    Qt: 5.9.6, 5.12.1

    I have two screens, there's no taskbar on the home screen, the taskbar is expanding the screen, and when I run the program on the home screen it's going to trigger a flicker


Log in to reply