Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Render Qml efficiently on GraphicsView
Forum Updated to NodeBB v4.3 + New Features

Render Qml efficiently on GraphicsView

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    ytbryan
    wrote on last edited by
    #1

    Hi all,

    My code is below.

    How do I efficiently render qml on graphicsView? my animation qml is appearing very slow when rendered in QDeclarativeEngine. Is there a way to optimise it at the c++ level?

    It was running ok at qml level.

    Thank you

    @
    int main(int argc, char *argv)
    {
    QApplication app(argc, argv);
    GraphicsView view;
    view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
    view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    OpenGLScene
    scene = new OpenGLScene;
    // provides an environment for instantiating QML components
    QDeclarativeEngine engine;
    // encapsulates a QML component definition
    QDeclarativeComponent component(&engine, QUrl::fromLocalFile("BounceAnimation.qml"));
    // creates the graphics item for QML at the engine's root context
    QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(component.create());
    // set position of item
    item->setPos(10,500);
    scene->addItem(item);
    view.setScene(scene);
    view.show();
    view.resize(1024, 2000);

    return app.exec(&#41;;
    

    }
    @

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      "This":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeview.html#details might help you.

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        ytbryan
        wrote on last edited by
        #3

        Thanks Lukas for the reply.

        Is there render performance difference comparing the QDeclarativeView with QDeclarativeEngine?

        Also, i did the following but the qml rendering is still not smooth. Any other advices? anyone?

        @ scene->setStickyFocus(true);
        scene->setItemIndexMethod(QGraphicsScene::NoIndex);@

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved