Skip to content

Prevent preferences sidebar from collapsing - #1728

Merged
ltfish merged 2 commits into
angr:masterfrom
hidehiroanto:fix/preferences-sidebar-collapse
Sep 4, 2026
Merged

Prevent preferences sidebar from collapsing#1728
ltfish merged 2 commits into
angr:masterfrom
hidehiroanto:fix/preferences-sidebar-collapse

Conversation

@hidehiroanto

@hidehiroanto hidehiroanto commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Problem

The Preferences navigation pane uses the default collapsible behavior of QSplitter. Dragging its divider fully left reduces the pane to zero width, making every preferences section inaccessible until the dialog is reopened.

Reproduction

  1. Open File > Preferences.
  2. Drag the divider beside the navigation pane fully left.
  3. Observe that the navigation pane disappears.

Expected behavior

The navigation pane should remain wide enough to display its entries while the settings pane continues to receive the remaining space.

Summary

  • derive the navigation pane minimum width from its populated content
  • prevent the first splitter pane from collapsing
  • add a regression test that forces the splitter toward zero and verifies the readable minimum is preserved

Testing

  • QT_QPA_PLATFORM=offscreen python3 -m pytest -q tests/dialogs/test_preferences.py
  • ruff check angrmanagement/ui/dialogs/preferences.py tests/dialogs/test_preferences.py
  • ruff format --check angrmanagement/ui/dialogs/preferences.py tests/dialogs/test_preferences.py
  • python3 -m py_compile tests/dialogs/test_preferences.py
  • git diff --check

@hidehiroanto
hidehiroanto force-pushed the fix/preferences-sidebar-collapse branch from b9222d0 to 4090bb1 Compare September 3, 2026 10:10
@hidehiroanto
hidehiroanto marked this pull request as ready for review September 3, 2026 10:10
@ltfish ltfish self-assigned this Sep 3, 2026
@ltfish ltfish added the bug label Sep 3, 2026
@ltfish

ltfish commented Sep 3, 2026

Copy link
Copy Markdown
Member

LGTM. Thanks!

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.59%. Comparing base (543ace8) to head (872861f).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1728      +/-   ##
==========================================
+ Coverage   59.18%   60.59%   +1.41%     
==========================================
  Files         323      333      +10     
  Lines       37598    38911    +1313     
  Branches     4444     4579     +135     
==========================================
+ Hits        22251    23578    +1327     
+ Misses      14550    14459      -91     
- Partials      797      874      +77     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ltfish

ltfish commented Sep 3, 2026

Copy link
Copy Markdown
Member

Thanks for the fix!

=========================== short test summary info ============================
FAILED tests/dialogs/test_preferences.py::TestPreferences::test_sidebar_cannot_collapse - assert 146 == 142
 +  where 142 = <built-in method width of PySide6.QtCore.QSize object at 0x136421700>()
 +    where <built-in method width of PySide6.QtCore.QSize object at 0x136421700> = PySide6.QtCore.QSize(142, 102).width
 +      where PySide6.QtCore.QSize(142, 102) = <built-in method sizeHint of PySide6.QtWidgets.QListWidget object at 0x136dd9580>()
 +        where <built-in method sizeHint of PySide6.QtWidgets.QListWidget object at 0x136dd9580> = <PySide6.QtWidgets.QListWidget(0x13a786980) at 0x136dd9580>.sizeHint
==== 1 failed, 679 passed, 30 skipped, 3531 warnings in 1182.28s (0:19:42) =====

Any idea why this doesn't work on MacOS?

@twizmwazin

Copy link
Copy Markdown
Member

I suspect that the extra few pixels are from theming. I'd suggest just changing the test to be >= instead of ==

@hidehiroanto

Copy link
Copy Markdown
Contributor Author

Addressed in 872861f. The test now avoids comparing against a post-show sizeHint(), which is theme/platform dependent in both directions, and instead checks the actual invariants: the sidebar has a positive minimum width, is non-collapsible, and cannot be resized below that minimum. I also added explicit None checks for layout() and itemAt() to fix the typecheck regression. Focused pytest, Ruff check/format, and ty all pass locally.

@ltfish
ltfish merged commit aa843e5 into angr:master Sep 4, 2026
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants