[Development] QWindow::setScreen() and QQuickWindow

Rafael Roquetto rafael.roquetto at kdab.com
Fri Apr 11 21:56:12 CEST 2014


Hello,

I have been investigating an interesting bug (using QNX as the platform for
Qt). Here is a brief summary:

(all code inside main() and before app.exec())

    QQuickView v;
    v.setScreen(someSecondScreen);
    v.show(); // works as expected

but

    QQuickView v;
    v.show();
    v.setScreen(someSecondScreen); // window is never shown

Is this the expected behavior? The reason this happens is because
QWindow::setScreen() calls destroy(), which triggers setVisible(false).
Afterwards, it calls create() but create() never bothers to display the window
again. In other words, it does

    QWindow::setVisible(true) //coming from show();
    QWindow::setVisible(false) //coming from setScreen() -> destroy()

For some reason beyond my knowledge, QtWidgets do not suffer for this bug,
i.e.:

    QWidget w;
    w.setScreen(secondScreen);
    w.show(); // works!

and
    QWidget w;
    w.show();
    w.setScreen(secondScreen); // also works

I digged a bit inside the QWidget code and it also follows the pattern of
having setVisible(true) followed by setVisible(false) called, just like in the
QQuickWindow case. However, something is happening that in spite of that the
widget is being shown regardlessy.

Any thoughts? Comments?

Thanks for reading,
Rafael
-- 
Qt Developer Days 2014 - October 6 - 8 at BCC, Berlin

Rafael Roquetto | rafael.roquetto at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4861 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140411/f84fcc7a/attachment.bin>


More information about the Development mailing list