Add NLoader

This commit is contained in:
Ly-sec 2025-08-10 13:52:58 +02:00
parent c612347f0c
commit a7e17c25ef
5 changed files with 91 additions and 101 deletions

31
Widgets/NLoader.qml Normal file
View 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 }
}
}

View file

@ -10,9 +10,11 @@ PanelWindow {
property bool showOverlay: Settings.settings.dimPanels
property int topMargin: Style.barHeight * scaling
property color overlayColor: showOverlay ? Colors.overlay : "transparent"
signal dismissed()
function hide() {
visible = false
dismissed()
}
function show() {