mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 10:31:34 -08:00
23 lines
518 B
QML
23 lines
518 B
QML
import QtQuick 2.15
|
|
|
|
Item {
|
|
objectName: "dynamic"
|
|
|
|
property Component component
|
|
property Item item
|
|
|
|
function createItem(file) {
|
|
// for custom QML items to be loaded on top of REPL app
|
|
if (item != null) {
|
|
item.destroy()
|
|
}
|
|
Engine.clearCache()
|
|
var pre = (Qt.platform.os === "windows") ? "file:/" : "file://"
|
|
component = Qt.createComponent(pre + file)
|
|
if (component.status === Component.Ready) {
|
|
item = component.createObject()
|
|
return item
|
|
}
|
|
return null
|
|
}
|
|
}
|