Repository navigation
Conversation
… arrows in the bounds The graph view owns its scene as a child, so the scene is deleted after the view's destructor has run. Clearing the selection during that deletion called the view's selection slot on an object that was already half destroyed, which crashed the editor on close when a mission was selected. Disconnect the scene first. Mission cards drew their ports half outside their bounding rectangle, edges drew arrowheads outside the path's bounds, and the END pill's port pen reached past its top. The view only repaints bounding rectangles, so dragging left fragments behind. Grow both bounds to cover what they draw; a card keeps its old shape for clicks and drops. Fixes scp-fs2open#7730 Fixes scp-fs2open#7728
TheForce172
left a comment
There was a problem hiding this comment.
The code itself looks good to me but I'm not in a situation where I can build right now so I have not seen what the graphical changes have
… item type Dropping a connection just above the END pill now creates a new mission again: the pill and the drop checks use the pill's own rect, not the larger paint bounds. Layout reads a cardRect() accessor instead of shape(), the border padding is one shared constant, and the view removes its application event filter when it is destroyed. MissionNodeItem declared no Qt item type, so qgraphicsitem_cast let any scene item through as a mission card. A drop or right-click on the END pill or on a branch line was handled as if it hit a card, reading a mission index from an object that has none. Cards now have their own type, so those clicks fall through to the END and empty-space handling.
… scene with the view Half of each port is drawn outside its card, and a card's hit shape was the card alone. Dropping a connection on the upper half of an inbound port created a new mission instead of a branch, and pressing the lower half of an outbound port panned the view instead of starting a connection. The hit shape now includes the three ports. The END pill gets the same treatment for its one port, and the two END checks ask the item whether it contains the point. The view disconnected the scene's signals on close but left the scene to be deleted later as a child. The scene's items are connected to the view too, so anything one of them sent while being deleted would have reached a view whose own part was already gone. The view now deletes the scene in its destructor.
… guard comment The END pill builds its rect in one place, and its padding follows the width of the pen it draws with. The bounds check where a connection drag starts no longer mentions dragging the END pill, which the item type check now rules out, and uses in_bounds(). The border constant's comment says what the padding covers.
…ble drag-start guard The destructor comment now covers both the disconnect and the delete, and the two shape comments say why the paths use winding fill. The bounds check where a connection drag starts is removed with its comment: cards are built from the model's mission list and rebuilt on every change to it, so a card's index is always in range.
…ton only A right or middle press on an outbound port started a connection drag, because the press handler never looked at the button. After the card menu closed, the preview line followed the mouse with no button held, and the next release could add a branch or open the new-mission picker. This was already so on the part of a port inside its card; the port halves outside the card now reach the same handler. The port hit circles also take in half the outline's width, so the drawn ring is part of the port.
|
Pushed four commits for the latest review notes. The two "worth raising" points
Side effects of 1
Also fixed
Testing qtFRED on Linux, Release and Debug, with the retail campaign file, driven through an automated harness on a virtual display (not by hand):
Not tested: Windows, macOS, and the hover cursor. |
Right-clicking while a connection was being dragged opened the card or empty-space menu, and the menu took the left release that would have ended the drag. Afterwards the preview line followed the mouse with no button held. The drag is now cancelled when the context menu event arrives. That includes an event over the END pill, where no menu opens. cancelDrag() now restores the hand-drag mode itself, so finishing a connection and this cancel both get it from one place.
|
One more small commit (048db80). While testing the last round I found that right-clicking during a connection drag left the preview line stuck to the mouse: the menu took the left release that would have ended the drag. Master does the same. The drag is now cancelled when the context menu event arrives, and
Tested by hand in qtFRED (Release): a right-click during a drag over a card, over empty space and over END, with Escape, with the left button released while the menu was still open, and with the keyboard menu key; "Delete mission" on the card the drag started from, then a pan and a normal connection. No preview line is left behind in any of them, no card moves, and the next connection makes exactly one branch. Release and Debug build without warnings. |
What?
Two fixes in qtFRED's campaign editor graph. Fixes #7730 and #7728.
Why?
How?
shape()stays the old rectangle, so clicks, drops and the places that position things from the card (self-loops, the END pill) behave as before.Testing?
Anything Else?
~CampaignMissionGraph()destructor. This one now deletes the scene inside the destructor, which also destroys the mission cards, so Various fixes for qtFRED #8030's version is not needed on top of it. If the two are combined anyway, Various fixes for qtFRED #8030's disconnects have to come before thedelete.