fix(ui): adapt icon position labels based on bar orientation

- Add barIsVertical property to BarWidgetSettingsDialog
- Pass barIsVertical from NSectionEditor to dialog
- Show Top/Bottom for vertical bar, Left/Right for horizontal bar
- Keep fallback to oppositeDirection when iconPosition not set
- Fix BarPillVertical iconPosition mapping (left=top, right=bottom)
This commit is contained in:
loner
2026-04-06 07:12:49 +08:00
parent 36a9d7afee
commit b6a85d88e7
5 changed files with 23 additions and 4 deletions
@@ -15,6 +15,7 @@ Popup {
property string widgetId: ""
property string sectionId: ""
property var screen: null
property bool barIsVertical: false
property var settingsCache: ({})
readonly property real maxHeight: (screen ? screen.height : (parent ? parent.height : 800)) * 0.8
@@ -185,6 +186,7 @@ Popup {
}
settingsLoader.setSource(source, {
"screen": screen,
"barIsVertical": barIsVertical,
"widgetData": currentWidgetData,
"widgetMetadata": BarWidgetRegistry.widgetMetadata[widgetId]
});
@@ -17,6 +17,9 @@ ColumnLayout {
signal settingsChanged(var settings)
// Bar orientation (per-screen) - passed from parent
property bool barIsVertical: false
property string valueIcon: widgetData.icon !== undefined ? widgetData.icon : widgetMetadata.icon
property string valueIconPosition: widgetData.iconPosition !== undefined ? widgetData.iconPosition : widgetMetadata.iconPosition
property bool valueTextStream: widgetData.textStream !== undefined ? widgetData.textStream : widgetMetadata.textStream
@@ -101,9 +104,19 @@ ColumnLayout {
NComboBox {
id: iconPositionComboBox
visible: valueShowIcon
label: I18n.tr("bar.custom-button.icon-position-label")
description: I18n.tr("bar.custom-button.icon-position-description")
model: [
model: barIsVertical ? [
{
name: I18n.tr("bar.custom-button.icon-position-top"),
key: "left"
},
{
name: I18n.tr("bar.custom-button.icon-position-bottom"),
key: "right"
}
] : [
{
name: I18n.tr("bar.custom-button.icon-position-left"),
key: "left"