Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. If ((parent = newParent)) - seriously?
Qt 6.11 is out! See what's new in the release blog

If ((parent = newParent)) - seriously?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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

      Greetz, Jeroen

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved