Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListContainer alignment #5997

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Conversation

ericmehl
Copy link
Collaborator

@ericmehl ericmehl commented Aug 8, 2024

This fixes the excessive sizing of ListContainers when a child widget has non-default alignment. So far I've only seen one widget that now has incorrect placement, the annotations button in the Graph Editor, which is fixed in this PR. If anyone spots others, I can fix those up as well.

Checklist

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have tested my change(s) in the test suite, and added new test cases where necessary.
  • My code follows the Gaffer project's prevailing coding style and conventions.

@johnhaddon
Copy link
Member

I did some tests with this to check that the extra layout shenanigans on the Python side weren't too costly, and I think we're OK, particularly when #6063 is taken into account. @ericmehl, could you retarget this to main please, and then I'll merge?

`QBoxLayout` wraps child widgets in a `QWidgetItem`.
`QWidgetItem.maximumSize()` returns `QLAYOUTSIZE_MAX` if the item has
non-default alignment, resulting in unnecessary expansion into all
available space. By resetting the alignment to default, we can get the
real size the widget needs. Changing alignment this way does not have
side effects. See `QLayout::alignmentRect()` source for a similar
solution to this problem.
@ericmehl ericmehl changed the base branch from 1.4_maintenance to main October 2, 2024 21:25
@johnhaddon johnhaddon merged commit ebd2450 into GafferHQ:main Oct 3, 2024
5 of 6 checks passed
@johnhaddon
Copy link
Member

Thanks Eric! Mergity merged...

@ericmehl ericmehl mentioned this pull request Oct 4, 2024
4 tasks
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.

2 participants