From 06b6b15bfbc7aed864ca7ff6e0c586c595e484f3 Mon Sep 17 00:00:00 2001 From: Tian Shilin Date: Thu, 9 Apr 2026 14:22:39 +0800 Subject: [PATCH] Fix: Network panel input field in the taskbar is not within the visible area. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Log: sizeHint always returns a fixed row height (30–36px). After the password input field is dynamically added via addPasswordWidget, the row height does not expand to match the actual height of the editor, causing the password area to be clipped and hidden by the QTreeView. Additionally, updateLayout skips calling updateGeometries when the panel is visible, preventing the row height from being refreshed in time. The fix ensures that sizeHint checks the actual editor height and uses the larger value, and removes the isVisible() condition in updateLayout so that updateGeometries is always invoked. PMS: bug-336757 --- net-view/window/netview.cpp | 3 +-- net-view/window/private/netdelegate.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/net-view/window/netview.cpp b/net-view/window/netview.cpp index f7a9947c..5faadecd 100644 --- a/net-view/window/netview.cpp +++ b/net-view/window/netview.cpp @@ -317,8 +317,7 @@ void NetView::onActivated(const QModelIndex &index) void NetView::updateLayout() { scheduleDelayedItemsLayout(); - if (!isVisible()) - updateGeometries(); + updateGeometries(); } void NetView::onExpandStatusChanged() diff --git a/net-view/window/private/netdelegate.cpp b/net-view/window/private/netdelegate.cpp index a7940416..82c4ac42 100644 --- a/net-view/window/private/netdelegate.cpp +++ b/net-view/window/private/netdelegate.cpp @@ -266,7 +266,18 @@ QWidget *NetDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & QSize NetDelegate::sizeHint(const QStyleOptionViewItem &, const QModelIndex &index) const { ItemSpacing itemSpacing = getItemSpacing(index); - return QSize(-1, itemSpacing.top + itemSpacing.height + itemSpacing.bottom); + int h = itemSpacing.top + itemSpacing.height + itemSpacing.bottom; + + // 当密码输入框展开时,编辑器实际高度会大于默认行高,需要使用实际高度 + // 否则密码输入区域会被裁剪导致不可见 + QWidget *editor = m_view->indexWidget(index); + if (editor) { + int editorH = editor->sizeHint().height(); + if (editorH > h) + h = editorH; + } + + return QSize(-1, h); } void NetDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const