If ((parent = newParent)) - seriously?



  • Qt 4.8.1
    qgraphicsitem.cpp
    Method setParentItemHelper
    Line 1209:

    @if ((parent = newParent)) {@

    It might be intentional, but it looks like a bug at first glance. As it happens, I am wondering why reparenting my top-level item to a new parent doesn't work.

    Edit
    Same in 4.8.3



  • Hi there,
    Doesn't need to be a bug!! When the newParent is NULL, the if will not be executed and the parent will be set to NULL.
    Your right if it isn't nice coding style, but fully functional!
    Greetz



  • Thanks.
    In the meantime, I found that when changing the boundingRect prior to setParentItem, setParentItem fails (the new parent isn't set).
    I don't understand it, and couldn't even see the issue when debugging. However, setting the boundingRect after setParentItem is good enough for me.

    Also, setting a new parent that has ItemClipsChildrenToShape set causes repaint issues.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.