Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtQuickView performance problem.



  • When a QtQuickView is overlaid on other views, the graphics performance drops severely(unless that view is not visible).
    **I built on macos 10.15.7 with qt 6.0.0 beta3 and used metalRHI **

    In fact, 5.15 also has the same problem, but the fps value cannot be displayed in xcode

    qml01.qml

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2.15
    
    Window{
        id:root
        visible: true
        width: 800
        height: 480
        Button{
            onClicked:{
                var component = Qt.createComponent("file:/Users/mano233/Documents/c_projects/untitled3/qml/qml02.qml")
                var window    = component.createObject(root)
                window.show()
            }
        }
    }
    

    qml02.qml

    import QtQuick 2.15
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.15
    
    Window {
        visible:true;
        width:720;
        height:640;
        Rectangle{
                width:100;height:100;
                color:"black";
                RotationAnimation on rotation {
                    loops: Animation.Infinite
                    from: 0
                    to: 360
                }
            }
    }
    

    main.cpp

    #include <Qtqml>
    #include <QtGui/QGuiApplication>
    #include <QtQuick/QQuickWindow>
    #include <QtCore/QUrl>
    #include <QDebug>
    
    int main(int argc, char* argv[]){
        QQuickWindow::setGraphicsApi(QSGRendererInterface::MetalRhi);
        QGuiApplication app(argc, argv);
        QQmlApplicationEngine engine;
        const QUrl url("file:/Users/mano233/Documents/c_projects/untitled3/qml/qml01.qml");
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                         &app, [url](QObject *obj, const QUrl &objUrl) {
                    if (!obj && url == objUrl)
                        QCoreApplication::exit(-1);
                }, Qt::QueuedConnection);
        engine.load(url);
        return QGuiApplication::exec();
    }
    
    

    When the views overlap,FPS is 40-45

    c9f3fd97-85ef-4525-8b85-91d392ccec2c-image.png

    unless that view is not visible,FPS is 60
    b19561ef-7819-4c85-8c0b-ec7c8aa0d0fd-image.png


Log in to reply