From b85d68f4cbd7ca6232af474eb6b8c70101094ba2 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sat, 23 Aug 2025 16:03:23 +0200 Subject: [PATCH] Fix modular bar (remove option) --- Modules/SettingsPanel/Tabs/BarTab.qml | 13 +++++++++++++ Widgets/NWidgetCard.qml | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index 2811787..906d958 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -218,6 +218,8 @@ ColumnLayout { function removeWidgetFromSection(section, index) { console.log("Removing widget from section", section, "at index", index) var sectionArray = Settings.data.bar.widgets[section] + console.log("Current section array:", JSON.stringify(sectionArray)) + if (sectionArray && index >= 0 && index < sectionArray.length) { // Create a new array to avoid modifying the original var newArray = sectionArray.slice() @@ -226,6 +228,17 @@ ColumnLayout { // Assign the new array Settings.data.bar.widgets[section] = newArray + + // Force a settings save + console.log("Settings updated, triggering save...") + + // Verify the change was applied + Qt.setTimeout(function() { + var updatedArray = Settings.data.bar.widgets[section] + console.log("Verification - updated section array:", JSON.stringify(updatedArray)) + }, 100) + } else { + console.log("Invalid section or index:", section, index, "array length:", sectionArray ? sectionArray.length : "null") } } diff --git a/Widgets/NWidgetCard.qml b/Widgets/NWidgetCard.qml index 92446af..22f4f5a 100644 --- a/Widgets/NWidgetCard.qml +++ b/Widgets/NWidgetCard.qml @@ -175,6 +175,19 @@ NBox { drag.target: parent onPressed: { + // Check if the click is on the close button area + const closeButtonX = widgetContent.x + widgetContent.width - 20 * scaling + const closeButtonY = widgetContent.y + const closeButtonWidth = 20 * scaling + const closeButtonHeight = 20 * scaling + + if (mouseX >= closeButtonX && mouseX <= closeButtonX + closeButtonWidth && + mouseY >= closeButtonY && mouseY <= closeButtonY + closeButtonHeight) { + // Click is on the close button, don't start drag + mouse.accepted = false + return + } + Logger.log("NWidgetCard", `Started dragging widget: ${modelData} at index ${index}`) // Bring to front when starting drag widgetItem.z = 1000