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

Alexander Akulich akulichalexander at gmail.com
Wed Oct 3 15:02:12 CEST 2012


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());
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.

On Wed, Oct 3, 2012 at 3:50 PM, Samuel Rødal <samuel.rodal at digia.com> wrote:

> On 10/03/2012 11:29 AM, Oleg Shparber wrote:
> > See QQuickView - http://doc-snapshot.qt-project.org/5.0/qquickview.html
> >
> > On Wed, Oct 3, 2012 at 7:54 AM, Alexander Akulich
> > <akulichalexander at gmail.com <mailto:akulichalexander at gmail.com>> wrote:
> >
> >     Hi all.
> >     Is there any replacement for QDeclarativeView in Qt5? If not, is it
> >     planned in future releases?
> >     How to port large Qt4 widget-based application with few Qt Quick
> >     scene and use Qt Quick 2?
>
> For now you'll need to create your own QWidget that creates a QQuickView
> as a child of the QWidget or top level window's windowHandle(). The
> resizeEvent() etc should position the QQuickView based on the QWidgets
> geometry. Not sure if event forwarding is necessary or if the QQuickView
> will automatically get the events.
>
> Hopefully something like this (a class QWindowProxy or similar
> inheriting QWidget) can become a part of the API at some point.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121003/cbf89ebf/attachment.html>


More information about the Interest mailing list