[Interest] How to show Qt Quick 2 scene on widget?

Samuel Rødal samuel.rodal at digia.com
Wed Oct 3 17:37:16 CEST 2012


On 10/03/2012 03:02 PM, Alexander Akulich wrote:
> Thanks for answers.
> *Oleg Shparber*, i already look on it, but haven't idea, how to render
> <something like this> on widget.
> *Samuel Rødal*, you perfectly right!
> QQuickView accept only QWindow, so the only way is use windowHandle().
> When i wrote "new QQuickView(windowHandle());" in first line of QWidget
> subclass constructor, new QWindow with QuickView, separated from
> widget's QWindow, was created.
> When i wrote same code after line such "setWindowTitle("Title");", it
> does nothing.
> But all works fine, when QQuickView created after subclass constructor,
> like here:
>      CMyWidget widget;
>      QQuickView view(widget.windowHandle());

Right, windowHandle() is probabl 0 until the widget has been shown or 
until you call winId() on it which forces it to create a QWindow if it 
hasn't already.

> Quick test show few mouse events issues (i.e. When button overlapped by
> view and mouse moved from button to view, button doesn't become
> unhovered.), but it's enough good solution.
> Thanks you very much.

Right, maybe no Leave event being sent in that case, since the QWidget 
world doesn't know about other QWindows and vice versa... Might be 
possible to work around it somehow by using private API.

--
Samuel



More information about the Interest mailing list