Skip to content

Fix: Network panel input field in the taskbar is not within the visib…#545

Merged
deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
JWWTSL:master
Apr 9, 2026
Merged

Fix: Network panel input field in the taskbar is not within the visib…#545
deepin-bot[bot] merged 2 commits intolinuxdeepin:masterfrom
JWWTSL:master

Conversation

@JWWTSL
Copy link
Copy Markdown
Contributor

@JWWTSL JWWTSL commented Apr 9, 2026

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

JWWTSL and others added 2 commits April 9, 2026 14:22
…le 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
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the network panel’s item sizing and layout updates so that dynamically added password input fields are fully visible instead of being clipped by the QTreeView.

Sequence diagram for layout update when password editor is shown

sequenceDiagram
    actor User
    participant NetView
    participant QTreeView
    participant NetDelegate
    participant PasswordEditor

    User ->> NetView: onActivated(index)
    NetView ->> QTreeView: setIndexWidget(index, PasswordEditor)
    QTreeView ->> NetDelegate: createEditor(parent, option, index)
    NetDelegate ->> PasswordEditor: construct password input

    User ->> NetView: onExpandStatusChanged()
    NetView ->> NetView: updateLayout()
    NetView ->> QTreeView: scheduleDelayedItemsLayout()
    NetView ->> QTreeView: updateGeometries()

    QTreeView ->> NetDelegate: sizeHint(option, index)
    NetDelegate ->> QTreeView: editor = m_view.indexWidget(index)
    NetDelegate ->> PasswordEditor: editor.sizeHint()
    PasswordEditor -->> NetDelegate: editorHeight
    NetDelegate -->> QTreeView: max(defaultRowHeight, editorHeight)

    QTreeView ->> QTreeView: layout rows using updated height
    QTreeView ->> User: password editor fully visible
Loading

Class diagram for updated NetDelegate and NetView sizing behavior

classDiagram
    class NetDelegate {
        - QTreeView* m_view
        + QWidget* createEditor(QWidget* parent, QStyleOptionViewItem& option, QModelIndex& index)
        + QSize sizeHint(QStyleOptionViewItem& option, QModelIndex& index) const
        + void updateEditorGeometry(QWidget* editor, QStyleOptionViewItem& option, QModelIndex& index) const
    }

    class NetView {
        + void onActivated(QModelIndex& index)
        + void updateLayout()
        + void onExpandStatusChanged()
        + void scheduleDelayedItemsLayout()
        + void updateGeometries()
    }

    class QTreeView {
        + QWidget* indexWidget(QModelIndex& index) const
        + void scheduleDelayedItemsLayout()
        + void updateGeometries()
        + QSize sizeHintForIndex(QModelIndex& index) const
    }

    NetDelegate --> QTreeView : uses m_view
    NetView --> QTreeView : manages layout
    QTreeView --> NetDelegate : queries sizeHint
Loading

File-Level Changes

Change Details Files
Make row height size hint account for the actual editor widget height so expanded password fields are not clipped.
  • Compute base row height from item spacing, then compare it with the associated editor widget’s sizeHint().height().
  • Use the larger of the default row height and the editor’s height when returning the size hint, ensuring rows can grow when the password editor is expanded.
net-view/window/private/netdelegate.cpp
Ensure QTreeView geometries are always refreshed when layout updates are scheduled, even when the view is visible.
  • Remove the visibility check in updateLayout so updateGeometries() is always called after scheduleDelayedItemsLayout().
  • Allow row heights and other geometries to be recomputed promptly when the password widget is added or expanded.
net-view/window/netview.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In sizeHint, when using the editor’s sizeHint().height() you overwrite the padding-calculated height; consider adding top/bottom spacing to the editor height so the expanded row still respects the intended vertical margins.
  • Calling updateGeometries() unconditionally in updateLayout() may introduce extra layout work when the view is already up to date; it’s worth double-checking whether a cheaper condition (e.g., checking for pending geometry updates rather than visibility) could avoid unnecessary recalculations.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `sizeHint`, when using the editor’s `sizeHint().height()` you overwrite the padding-calculated height; consider adding `top`/`bottom` spacing to the editor height so the expanded row still respects the intended vertical margins.
- Calling `updateGeometries()` unconditionally in `updateLayout()` may introduce extra layout work when the view is already up to date; it’s worth double-checking whether a cheaper condition (e.g., checking for pending geometry updates rather than visibility) could avoid unnecessary recalculations.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, JWWTSL

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@JWWTSL
Copy link
Copy Markdown
Contributor Author

JWWTSL commented Apr 9, 2026

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot bot commented Apr 9, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit cb85a2a into linuxdeepin:master Apr 9, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants