From 441544ec9b61234f87c15c11280c35a9bf1348ec Mon Sep 17 00:00:00 2001 From: minecart551-prog Date: Fri, 9 Oct 2026 14:09:36 -0900 Subject: [PATCH] fix(timeline): the add-track menu's rows take their clicks The tray's plus opened a menu whose Add track row flew a top-or-bottom submenu out beside it. A PopupWindow inside a PopupWindow draws where it likes, but the part hanging outside its parent never receives the pointer, so both rows could be seen and neither pressed (slint-ui/slint#7322). The menu is flat now - top and bottom as rows of the one popup, like every other menu here - so a press on either adds the lane it names. Signed-off-by: minecart551-prog --- src/crates/concat/ui/timeline/tray.slint | 65 +++++------------------- 1 file changed, 14 insertions(+), 51 deletions(-) diff --git a/src/crates/concat/ui/timeline/tray.slint b/src/crates/concat/ui/timeline/tray.slint index ffdbf4724..d95455476 100644 --- a/src/crates/concat/ui/timeline/tray.slint +++ b/src/crates/concat/ui/timeline/tray.slint @@ -94,10 +94,12 @@ component MenuItem inherits Rectangle { } } -// The plus at the head of the tray: a menu whose first row adds a lane, -// and whose submenu, opened by hovering that row, says where - on top of -// the stack or under it. A click on the row itself adds on top, as the -// plus always did. +// The plus at the head of the tray: a menu that adds a lane on top of the +// stack or under it, one row each. Flat rather than a row that flies a +// submenu out beside it: a PopupWindow inside a PopupWindow draws, but the +// part of it hanging outside its parent never takes the click, so top and +// bottom could be seen and neither pressed. +// https://github.com/slint-ui/slint/issues/7322 component AddMenu inherits Rectangle { callback add-track(bottom: bool); @@ -117,7 +119,7 @@ component AddMenu inherits Rectangle { x: 0; y: root.height + 4px; width: 168px; - height: root.row-h + 8px; + height: 2 * root.row-h + 8px; close-policy: close-on-click-outside; Rectangle { @@ -130,57 +132,18 @@ component AddMenu inherits Rectangle { padding: 4px; alignment: start; - add := MenuItem { - text: I18n.t("tray.addTrack"); - trailing: Glyph.chevron-right; + MenuItem { + text: I18n.t("tray.addTrackTop"); clicked => { - sub.close(); list.close(); root.add-track(false); } - changed hovered => { - if (self.hovered) { - sub.show(); - } - } } - } - } - - // Beside the row it belongs to, overlapping the menu's edge by a - // hair so the pointer crosses no gap on its way in. - sub := PopupWindow { - x: parent.width - 4px; - y: 0; - width: 156px; - height: 2 * root.row-h + 8px; - close-policy: close-on-click-outside; - - Rectangle { - background: Theme.raised; - border-width: 1px; - border-color: Theme.line-strong; - border-radius: Theme.r; - - VerticalLayout { - padding: 4px; - alignment: start; - - MenuItem { - text: I18n.t("tray.addTrackTop"); - clicked => { - sub.close(); - list.close(); - root.add-track(false); - } - } - MenuItem { - text: I18n.t("tray.addTrackBottom"); - clicked => { - sub.close(); - list.close(); - root.add-track(true); - } + MenuItem { + text: I18n.t("tray.addTrackBottom"); + clicked => { + list.close(); + root.add-track(true); } } }