Important: Please read the Qt Code of Conduct -

QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in top-left screen corner)

  • I have a Qt/QML application and I have a problem when setting the main window to Full Screen.

    It goes Full Screen, but first it seems to be moved to the top-left corner of my screen. Then it changes to Full Screen, BUT this top-left window is there until I repaint my application. For instance, moving it to background and to foreground again.

    I hope I am explaining properly...

    In my code, I have a QWidget class where I create a QQmlApplicationEngine:

    .h file:

    QQmlApplicationEngine* m_pAppMainWindow;
    QQuickWindow* m_pQuickWindow;

    .cpp file:

    m_pAppMainWindow = new QQmlApplicationEngine();

    I use it to get app qml context

    QQmlContext* pQmlContext = m_pAppMainWindow->rootContext();

    to load the main QML file from resources:


    to set Image providers:


    and to get QQuickWindow object:

    m_pQuickWindow = m_pQuickWindow = qobject_cast<QQuickWindow *>(m_pAppMainWindow->rootObjects()[0]);

    I use the QQuickWindow object to set app window minimum size:


    to get the QML objects to work with:

    QObject* pObjViewMain = m_pQuickWindow->findChild<QObject*>("viewMain");

    and to set app in full screen mode (on/off):


    My problem is with this last point, when I enter Full Screen...

    Hope anyone can help me


  • Moderators

    Not sure but as I understand from the description you are first creating the widget and then from there trying to load the QML using QQmlApplicationEngine. So there are 2 windows here. May be that could be the problem ?
    Instead of QQmlApplicationEngine you can use QQuickWidget so that the QML type gets embedded into the widget. QQuickWidget requires root element to be of type Item.

  • @p3c0 Thanks for your help, I will try your option, I hope I could use QQuickWidget instead of QQmlApplicationEngine with no problem or unexpected effect.