Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in top-left screen corner)

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qquickwindowfullscreenrepaint
3 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Diego DonateD Offline
    Diego DonateD Offline
    Diego Donate
    wrote on last edited by
    #1

    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:

    m_pAppMainWindow->load(QUrl("qrc:/qml/ViewMain.qml"));
    

    to set Image providers:

    m_pAppMainWindow->addImageProvider(...);
    

    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:

    m_pQuickWindow->setMinimumWidth(...)
    

    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):

    m_pQuickWindow->showFullScreen();
    or 
    m_pQuickWindow->showNormal();
    

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

    Hope anyone can help me

    Thanks

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @Diego-Donate
      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.

      157

      Diego DonateD 1 Reply Last reply
      1
      • p3c0P p3c0

        @Diego-Donate
        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.

        Diego DonateD Offline
        Diego DonateD Offline
        Diego Donate
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved