Added a Spacer widget so people can add spacing between other widgets

(as requested in ##226).
Spacer: create variable width invisible rectangle
BarWidgetSettingsDialog: add Spacer support
BarWidgetRegistry: add Spacer
This commit is contained in:
Ly-sec 2025-09-06 12:27:06 +02:00
parent e76b2c5497
commit 977b2d9e7c
3 changed files with 91 additions and 0 deletions

View file

@ -68,6 +68,8 @@ Popup {
sourceComponent: {
if (settingsPopup.widgetId === "CustomButton") {
return customButtonSettings
} else if (settingsPopup.widgetId === "Spacer") {
return spacerSettings
}
// Add more widget settings components here as needed
return null
@ -157,4 +159,28 @@ Popup {
}
}
}
// Spacer settings component
Component {
id: spacerSettings
ColumnLayout {
spacing: Style.marginM * scaling
function saveSettings() {
var settings = Object.assign({}, settingsPopup.widgetData)
settings.width = parseInt(widthInput.text) || 20
return settings
}
NTextInput {
id: widthInput
Layout.fillWidth: true
label: "Width (pixels)"
description: "Width of the spacer in pixels."
text: settingsPopup.widgetData.width || "20"
placeholderText: "Enter width in pixels"
}
}
}
}