Fixed call sequence for GraphComponent::parentChanging().

When a child is being transferred from one parent to another, it is now called at a point where the child still has the original parent.

Also added the ability to override `parentChanged()` in Python, making it possible to write unit tests.
Merge pull request #937 from johnhaddon/parentChanging

Fixed call sequence for GraphComponent::parentChanging().