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

Fix inspection of graphics scenes with nested items #969

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

dfaure-kdab
Copy link
Member

The SceneModel had a broken parent() implementation, it always returned row = 0 for toplevel items, instead of looking up the position in the topLevelItems() list.

While at it, make this model more robust against the fact that the order of QGraphicsItem::childItems() can change due to stackBefore() or changing the Z order, so sort that list (by pointer address) to make it stable.

There's still one way to break that model:
QGraphicsItem::setParentItem(). But that's for another day.

The SceneModel had a broken parent() implementation,
it always returned row = 0 for toplevel items, instead of
looking up the position in the topLevelItems() list.

While at it, make this model more robust against the fact
that the order of QGraphicsItem::childItems() can change
due to stackBefore() or changing the Z order, so sort that
list (by pointer address) to make it stable.

There's still one way to break that model:
QGraphicsItem::setParentItem(). But that's for another day.
@dfaure-kdab dfaure-kdab requested a review from Waqar144 April 5, 2024 08:42
@dfaure-kdab dfaure-kdab merged commit a6a55e1 into KDAB:master Apr 5, 2024
13 of 14 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.

2 participants