Results 1 to 6 of 6

Thread: QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in top

  1. #1
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in top

    Hi,

    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:
    Qt Code:
    1. QQmlApplicationEngine* m_pAppMainWindow;
    2. QQuickWindow* m_pQuickWindow;
    To copy to clipboard, switch view to plain text mode 

    .cpp file:

    Qt Code:
    1. m_pAppMainWindow = new QQmlApplicationEngine();
    To copy to clipboard, switch view to plain text mode 

    I use it to get app qml context
    Qt Code:
    1. QQmlContext* pQmlContext = m_pAppMainWindow->rootContext();
    To copy to clipboard, switch view to plain text mode 
    to load the main QML file from resources:
    Qt Code:
    1. m_pAppMainWindow->load(QUrl("qrc:/qml/ViewMain.qml"));
    To copy to clipboard, switch view to plain text mode 
    to set Image providers:
    Qt Code:
    1. m_pAppMainWindow->addImageProvider(...);
    To copy to clipboard, switch view to plain text mode 
    and to get QQuickWindow object:
    Qt Code:
    1. m_pQuickWindow = m_pQuickWindow = qobject_cast<QQuickWindow *>(m_pAppMainWindow->rootObjects()[0]);
    To copy to clipboard, switch view to plain text mode 

    I use the QQuickWindow object to set app window minimum size:
    Qt Code:
    1. m_pQuickWindow->setMinimumWidth(...)
    To copy to clipboard, switch view to plain text mode 
    to get the QML objects to work with:
    Qt Code:
    1. QObject* pObjViewMain = m_pQuickWindow->findChild<QObject*>("viewMain");
    To copy to clipboard, switch view to plain text mode 
    and to set app in full screen mode (on/off):
    Qt Code:
    1. m_pQuickWindow->showFullScreen();
    2. or
    3. m_pQuickWindow->showNormal();
    To copy to clipboard, switch view to plain text mode 

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

    Hope anyone can help me

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,418
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in

    If you were to use a QQuickView you could try to use its resize mode to resize the content to the window's size.

    Does your content follow the Window element's size changes?

    Cheers,
    _

    P.S.: I shudder at the though of what "get the QML objects to work with" could mean

  3. #3
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in

    Thanks anda_skoa,

    My content follows the fullscreen change. In fact, the full screen over the QQuickWindow works, BUT this 'old size' window badly repainter over my new size in the the top-left (the app window seems to go there before applying the fullscreen mode)

    I meant I use the QML objects from the c++ to access QML methods or properties

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,418
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in

    Quote Originally Posted by ddonate View Post
    My content follows the fullscreen change. In fact, the full screen over the QQuickWindow works, BUT this 'old size' window badly repainter over my new size in the the top-left (the app window seems to go there before applying the fullscreen mode)
    I am afraid I don't understand then.
    So when the app goes full screen, the content resizes nicely and all is well.
    But when you switch back from full screen then the old, fullscreen content is still visible?

    Quote Originally Posted by ddonate View Post
    I meant I use the QML objects from the c++ to access QML methods or properties
    Yes, that's what I though.
    But you will learn soon enough that there are less hacky ways

    Cheers,
    _

  5. #5
    Join Date
    Apr 2013
    Posts
    61
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in

    Quote Originally Posted by anda_skoa View Post
    So when the app goes full screen, the content resizes nicely and all is well.
    But when you switch back from full screen then the old, fullscreen content is still visible?
    _
    No, my problem is when going to fullScreen: The application size changes properly to full screen, but before changing the size, the old application window (with size previous to FS) seems to go to the top-left corner and it keeps there after the FS process is finished. So once the application is in FS, this window bad "frame" is like frozen there. When I repaint the application (for instance background and foreground again) this "frame" dissapears.

    Quote Originally Posted by anda_skoa View Post
    But you will learn soon enough that there are less hacky ways
    _
    Any suggestion to search?


    Thanks a lot

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,418
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QT-QML application: QQuickWindow to Full Screen: repaint failure ("bad window" in

    Quote Originally Posted by ddonate View Post
    No, my problem is when going to fullScreen: The application size changes properly to full screen, but before changing the size, the old application window (with size previous to FS) seems to go to the top-left corner and it keeps there after the FS process is finished. So once the application is in FS, this window bad "frame" is like frozen there. When I repaint the application (for instance background and foreground again) this "frame" dissapears.
    Hmm, strange. Doesn't the system trigger an update when the window goes fullscreen?

    Quote Originally Posted by ddonate View Post
    Any suggestion to search?
    http://doc.qt.io/qt-5/qtqml-cppinteg...ttributes.html

    I.e. always prefer accessing C++ from the QML side over accessing QML from the C++ side.

    Cheers,
    _

Similar Threads

  1. getting error Failure "SSL handshake failed"
    By Radhika in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2015, 21:26
  2. Replies: 2
    Last Post: 2nd March 2015, 15:27
  3. Replies: 0
    Last Post: 9th January 2015, 10:09
  4. Replies: 5
    Last Post: 29th September 2012, 19:30
  5. "Render" Qt dialog window from ".ui" file
    By BitEater in forum Qt Programming
    Replies: 1
    Last Post: 8th July 2011, 14:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.