[Interest] Display QML in a QGraphicsScene ?

Jean-Michaël Celerier jeanmichael.celerier at gmail.com
Sun Feb 28 16:52:17 CET 2016


Hello,

Is there an easy way to display QML elements in a traditional
QGraphicsScene - QGraphicsView based application ?

e.g. something that would be like a QGraphicsQMLItem.

I tried this :


    QQuickView *view = new QQuickView();
    view->setSource(QUrl("qrc:/DummyProcess.qml"));
    QWidget *container = QWidget::createWindowContainer(view, graphicsView);
    container->setMinimumSize(QSize{100, 100});
    container->setMaximumSize(QSize{500, 500});
    container->setFocusPolicy(Qt::TabFocus);
    QGraphicsProxyWidget * proxy = new QGraphicsProxyWidget(this); //
"this" is a QGraphicsItem
    proxy->setWidget(container);
    view->show();

 But alas, what it does is that it opens the QML in a new window next to my
app.

Best regards,
Jean-Michaël Celerier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160228/4aed1170/attachment.html>


More information about the Interest mailing list