QML C++ application runs much slower than pure QML



  • Hi everyone.

    I'm writing small game in qml. When i run it in qmlviewer everything works fine, application uses 10-15% CPU. When i create QtQuick project and run application with QmlApplicationViewer C++ class it runs much slower, there is about 70-80 % CPU usage.

    Is it normal? Can i deploy pure QML application?
    Can I make package or bin file from my app without writing C++ code?

    Thanks everyone.



  • It's weird. Since everything is works properly for me, can you paste your env? Desktop ? Mobile ?



  • Very strange, because the QML viewer app does not much more than use the same class. Did you try setting a QGLWidget as your viewport widget?



  • You may try to use QML Profiler in Qt Creator. It should give you some clue.



  • Thank's everyone for replies!
    "Here's the link to my project. Main file is _arca.qml.":http://www.filefactory.com/file/c496a01/n/_arca.rar

    1. I ran it with qmlviewer ("qmlviewer _arca.qml" in terminal)
    2. I made QtQuick project. My main.cpp:
      @
      #include <QtGui/QApplication>
      #include "qmlapplicationviewer.h"

    Q_DECL_EXPORT int main(int argc, char *argv[])
    {
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile&#40;QLatin1String("_arca.qml"&#41;);
    viewer.showExpanded();
    return app->exec&#40;&#41;;
    

    }
    @
    Now i understood, that it's bad idea to use javascript in C++ application so i'm rewriting all logic in C++.
    But the problem wasn't solved.



  • And i forgot to say that its desktop configuration.

    I'll try to use QGLWidget and write about results



  • Have you tried
    @ QApplication::setGraphicsSystem("raster");@

    at the beginning of the main (I would say in Line 7 or so)

    For me, this makes the application much faster



  • Yes, i already tried it before, but application is still very slow.
    Can somebody give advice how to make an explosion animation?
    I tried two variant but both are too slow.

    1. Dynamically create some objects and make them move to different corners of screen
    2. Use Particles qml object (burst method)
      [quote author="outdoor_guy" date="1331547299"]Have you tried
      @ QApplication::setGraphicsSystem("raster");@

    at the beginning of the main (I would say in Line 7 or so)

    For me, this makes the application much faster[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.