Skip to content

QTreeView item stylesheet: row shift on hover and excessive padding #1217

@codemedic

Description

@codemedic

The stylesheet applied to QTreeView::item in treeview.py has two related problems:

  1. Row content shifts on hover. Normal items use margin: 5px while hover/selected states switch to margin: 0px; padding: 5px. These are different box model properties and cause the row content to visibly jump a few pixels to the right when the cursor enters the row.

  2. Excessive row padding. The margin: 5px on the base item state makes rows taller than necessary.

Fix: Use padding consistently across all item states (base, :hover, :selected) and suppress the focus rectangle with QTreeView { outline: 0 }. This eliminates the shift, reduces row height, and keeps the hover/selection highlight flush across cells.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions