Add NLoader
This commit is contained in:
parent
c612347f0c
commit
a7e17c25ef
5 changed files with 91 additions and 101 deletions
31
Widgets/NLoader.qml
Normal file
31
Widgets/NLoader.qml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import QtQuick
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
|
||||
// Boolean control to load/unload the item
|
||||
property bool isLoaded: false
|
||||
|
||||
// Provide the component to load.
|
||||
// Example usage:
|
||||
// content: Component { NPanel { /* ... */ } }
|
||||
property Component panel
|
||||
|
||||
active: isLoaded
|
||||
asynchronous: true
|
||||
sourceComponent: panel
|
||||
|
||||
onActiveChanged: {
|
||||
if (active && item && item.show) item.show()
|
||||
}
|
||||
|
||||
onItemChanged: {
|
||||
if (active && item && item.show) item.show()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: loader.item
|
||||
function onDismissed() { loader.isLoaded = false }
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue