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

QQuickView - singleton Component question



  • Here is my simple Singleton component:

    pragma Singleton
    import QtQuick 2.0
    
    Item {
        id: va
        objectName: "va"
    
        property font my_font: Qt.font({
            family: "Arial",
                                       });
    
        property real version: 1;
    }
    

    How can I update the version property through C++ code?

    I tried this, but to no avail:

    QQuickItem obj = quickview->rootObject()->findChild<QQuickItem>("va");
    ...
    obj->setProperty("version", "2");

    quickview loads a qml file that includes the singleton component.

    Thanks


Log in to reply