Skip to content

Commit cb85a2a

Browse files
JWWTSLdeepin-bot[bot]
authored andcommitted
Fix: Network panel input field in the taskbar is not within the visible area.
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
1 parent ff7ad66 commit cb85a2a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

net-view/window/netview.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ void NetView::onActivated(const QModelIndex &index)
317317
void NetView::updateLayout()
318318
{
319319
scheduleDelayedItemsLayout();
320-
if (!isVisible())
321-
updateGeometries();
320+
updateGeometries();
322321
}
323322

324323
void NetView::onExpandStatusChanged()

net-view/window/private/netdelegate.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,18 @@ QWidget *NetDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &
266266
QSize NetDelegate::sizeHint(const QStyleOptionViewItem &, const QModelIndex &index) const
267267
{
268268
ItemSpacing itemSpacing = getItemSpacing(index);
269-
return QSize(-1, itemSpacing.top + itemSpacing.height + itemSpacing.bottom);
269+
int h = itemSpacing.top + itemSpacing.height + itemSpacing.bottom;
270+
271+
// 当密码输入框展开时,编辑器实际高度会大于默认行高,需要使用实际高度
272+
// 否则密码输入区域会被裁剪导致不可见
273+
QWidget *editor = m_view->indexWidget(index);
274+
if (editor) {
275+
int editorH = editor->sizeHint().height();
276+
if (editorH > h)
277+
h = editorH;
278+
}
279+
280+
return QSize(-1, h);
270281
}
271282

272283
void NetDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const

0 commit comments

Comments
 (0)