Use loader to load the components come with Qt(ex: Rectangle)



  • A simple example
    @
    iimport QtQuick 2.0
    import QtGraphicalEffects 1.0

    Rectangle {
    width: 640
    height: 480

    Loader{
       id: loader
    
       anchors.fill: parent
    }
    
    Component.onCompleted: {
        loader.source("DirectionalBlur.qml")
    }
    

    }
    @

    However, this wouldn't work, is it possible to load the build in qml component by loader?



  • I guess the double letter 'i' is a typo in your example.
    @
    iimport QtQuick 2.0
    @

    Try changing line 15 to
    @
    loader.source = "DirectionalBlur.qml"
    @


Log in to reply
 

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