diff --git a/shell/plugins/menu/Menu.qml b/shell/plugins/menu/Menu.qml index 70c5181782..fb8841f7f6 100644 --- a/shell/plugins/menu/Menu.qml +++ b/shell/plugins/menu/Menu.qml @@ -1010,14 +1010,14 @@ Item { Row { id: trail - width: Style.space(14) + width: row.childCount > 0 ? Style.space(44) : Style.space(14) anchors.right: parent.right anchors.rightMargin: root.rowReservedBorderRight + Style.space(8) y: contentColumn.y + labelText.y + (labelText.height - height) / 2 - spacing: 0 + spacing: Style.space(4) Text { - visible: false + visible: row.childCount > 0 && (row.kind === "menu" || row.kind === "link") text: row.childCount color: root.foreground opacity: 0.45 diff --git a/test/shell.d/menu-test.sh b/test/shell.d/menu-test.sh index ec7fad18c9..34551a11e0 100644 --- a/test/shell.d/menu-test.sh +++ b/test/shell.d/menu-test.sh @@ -90,6 +90,11 @@ assertDeepEqual( }, 'menu builds display rows' ) +assertEqual( + menu.displayRow(merged.items, merged.itemOrder, {}, merged.items.style, '', 0, '').childCount, + 1, + 'menu display rows expose submenu child counts' +) const defaultItems = menu.parseMenuJsonc(defaultMenuJsonc) const defaultById = Object.fromEntries(defaultItems.map(item => [item.id, item])) @@ -105,6 +110,10 @@ assert( /font\.family: row\.iconFont\.length > 0 \? row\.iconFont : root\.fontFamily/.test(menuQml), 'menu rows support per-icon font families' ) +assert( + /visible: row\.childCount > 0 && \(row\.kind === "menu" \|\| row\.kind === "link"\)/.test(menuQml), + 'menu rows show submenu child counts' +) assert( /function select\(delta\)[\s\S]*root\.disarmPointer\(\)[\s\S]*selectedIndex =/.test(menuQml),