Hi Rafael,

I was looking at this today and I am also a bit puzzled about why the QWidget 
stays on the screen.
It might have something to do with the 4 platform windows that are created for 
each top level QWidget.

Does anyone btw. know why this is necessary?

About the behaviour of "setScreen". I too find it a bit awkward that it hides 
the window. If we can't change
this any more, than it should at least be mentioned in the documentation.

Fabian
________________________________________
From: [email protected] 
[[email protected]] on behalf of 
Alan Alpert [[email protected]]
Sent: Saturday, April 12, 2014 2:16 AM
To: Rafael Roquetto
Cc: Qt Project Development Mailing-List
Subject: Re: [Development] QWindow::setScreen() and QQuickWindow

On Fri, Apr 11, 2014 at 12:56 PM, Rafael Roquetto
<[email protected]> wrote:
> 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?

Yes. setScreen expects to destroy the backing window and recreate it,
so it passes onto users the expectation that they will have to reset
all window properties afterwards.

I'm not sure what QQuickView should do, but in the declarative case
where you might have a "Window { visible: true; visibility:
Window.FullScreen }" it would be expected to reset all the properties
to what's in QML. I doubt it does that yet, and that's a bug ;) .

> 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?

Last time I was playing around with multiwindow support (about a year
ago), QNX was the only platform where setScreen worked reliably. So
the strange stuff happening could be related to the platform
implementation, as we have no other platforms to compare it with. It
also makes it hard to determine the "correct" multi-screen API, when
there's no clear picture of how it would work on the majority of
platforms.

--
Alan Alpert
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to