mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Add NLoader
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user