Add close logic for WallpaperSelector
This commit is contained in:
parent
7844cc2975
commit
8a6b842ed0
2 changed files with 27 additions and 3 deletions
|
|
@ -294,7 +294,14 @@ PanelWithOverlay {
|
|||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: panelMain.dismiss()
|
||||
onClicked: {
|
||||
// If wallpaper selector is open, close it instead of the settings window
|
||||
if (wallpaperSelector.visible) {
|
||||
wallpaperSelector.hide();
|
||||
} else {
|
||||
panelMain.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,23 +8,38 @@ import qs.Settings
|
|||
|
||||
Rectangle {
|
||||
id: wallpaperOverlay
|
||||
focus: true
|
||||
|
||||
// Function to show the overlay and load wallpapers
|
||||
function show() {
|
||||
// Ensure wallpapers are loaded
|
||||
WallpaperManager.loadWallpapers();
|
||||
wallpaperOverlay.visible = true;
|
||||
wallpaperOverlay.forceActiveFocus();
|
||||
}
|
||||
|
||||
// Function to hide the overlay
|
||||
function hide() {
|
||||
wallpaperOverlay.visible = false;
|
||||
}
|
||||
|
||||
color: Theme.backgroundPrimary
|
||||
visible: false
|
||||
z: 1000
|
||||
|
||||
// Handle escape key to close
|
||||
Keys.onPressed: function(event) {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
wallpaperOverlay.hide();
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Click outside to close
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
wallpaperOverlay.visible = false;
|
||||
wallpaperOverlay.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +56,8 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
|
||||
|
||||
// Wallpaper Grid
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -133,7 +150,7 @@ Rectangle {
|
|||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
WallpaperManager.changeWallpaper(modelData);
|
||||
wallpaperOverlay.visible = false;
|
||||
wallpaperOverlay.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue