From f5418415ac4ef307f46c3ff539949b545ecf76e3 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sat, 11 Jul 2026 22:11:47 +0800 Subject: [PATCH] fix(gui): stop clipping the nozzle-count edit button on flow changes HoverLabel's constructor used SetSizerAndFit, which records the count-hidden width as the panel's explicit minimum size. An explicit minimum outranks best size in sizer allocation, so once the "(N)" count was shown, any ancestor Layout() - e.g. switching the extruder flow type to Standard or High Flow - shrank the title row back to the stale width and clipped the trailing edit button. Hybrid only appeared correct while nothing had re-laid the row since its own Fit(). Use plain SetSizer and, on every title/count change, invalidate the cached best size and re-lay both the row and its parent so the sizer always allocates the current content width. --- src/slic3r/GUI/Plater.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 46706ec65c..30a7a514b7 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -484,7 +484,10 @@ public: sizer->Add(m_brace_right, 0, wxALIGN_CENTER_VERTICAL); sizer->Add(m_hover_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(5)); - SetSizerAndFit(sizer); + // No SetSizerAndFit: that would record the count-hidden width as an explicit min size, + // which outranks best size in sizer allocation, so once the count is shown any ancestor + // Layout() would shrink the row back and clip the trailing edit button. + SetSizer(sizer); Layout(); } @@ -508,20 +511,29 @@ public: m_brace_left->Show(); m_brace_right->Show(); } - Layout(); - Fit(); + UpdateSizing(); } void SetTitle(const wxString &title) { m_label->SetLabel(title); - Layout(); - Fit(); + UpdateSizing(); } void Rescale() { m_hover_btn->msw_rescale(); } private: + // Content changed: the cached best size (ours and, transitively, our ancestors') is stale, + // and the parent must re-lay this row or the sizer keeps allocating the old width. + void UpdateSizing() + { + InvalidateBestSize(); + Layout(); + Fit(); + if (GetParent()) + GetParent()->Layout(); + } + wxStaticText *m_label; wxStaticText *m_brace_left; wxStaticText *m_count;