C

Qt 3D Studio Runtime: Dynamic Loading Example

Demonstrates how resources can be loaded dynamically.

This example demonstrates deferred loading.

Running the Example

To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.

Description

The presentation consists of three slides with images, effect, subpresentation and custom material. Images and subpresentation are loaded dynamically before entering the slide using the preloadSlide function and unloaded when exiting a slide using the unloadSlide function.

Presentation {
    property string slidePath: "dynamicloading:Scene:Slide"
    property int curSlideIndex: 1
    property int maxSlideIndex: 3

    id: presentation
    delayedLoading: true
    source: "qrc:/presentation/dynamicloading.uia"

    onSlideEntered: {
        console.log("Entered: " + name)

        curSlideIndex = index + 1
        if (curSlideIndex > maxSlideIndex)
            curSlideIndex = 1
        console.log("preloadSlide: " + slidePath + curSlideIndex)
        preloadSlide(slidePath + curSlideIndex)
    }

    onSlideExited: {
        console.log("Exited: " + name)
        unloadSlide(name)
    }
}

Files:

Images:

Available under certain Qt licenses.
Find out more.