title: Why doesn't child QGraphicsObject repaint its background correctly
body: <p><a href="https://i.stack.imgur.com/sMEaO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sMEaO.png" alt="enter image description here"></a></p>
  
  <p>The QGraphicsObject in green rectangle, it is the parent of the QGraphicsObject in red rectangle.</p>
  
  <pre><code>childInRed-&gt;setParentItem(this);
  </code></pre>
  
  <p>When I drag the parent object in green rect and move it fast, the background of the child object in red rect is not repainted correctly.
  <a href="https://i.stack.imgur.com/6T3rR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6T3rR.png" alt="enter image description here"></a></p>
  
  <p>I know I can use update in the parent's mouseMoveEvent force the child to repaint. But this is not good, because I don't need to repaint the parent at all.</p>
  
  <hr>
  
  <pre><code>#include "asdf.h"
  #include &lt;QtWidgets/QGraphicsScene&gt;
  #include &lt;QtWidgets/QGraphicsView&gt;
  
  #include &lt;QtWidgets&gt;
  
  class CTestGraphicsObject : public QGraphicsObject
  {
  public:
      QColor m_c;
      CTestGraphicsObject(QColor c)
          : QGraphicsObject(NULL)
          , m_c(c)
      {
          setFlag(QGraphicsItem::ItemIsMovable, true);
          setFlag(QGraphicsItem::ItemIsFocusable, true);
          setFlag(QGraphicsItem::ItemIsSelectable, true);
  
          auto effect = new QGraphicsDropShadowEffect;
          effect-&gt;setOffset(4, 4);
          effect-&gt;setBlurRadius(20);
  
          setGraphicsEffect(effect);
      }
      virtual QRectF boundingRect() const override
      {
          auto rc = QRectF(0, 0, 100, 100);
          return rc;
      }
      virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
      {
          painter-&gt;setPen(QPen(m_c));
          painter-&gt;drawRect(this-&gt;boundingRect());
      }
  };
  
  asdf::asdf(QWidget *parent)
      : QMainWindow(parent)
  {
      ui.setupUi(this);
      auto s = new QGraphicsScene(this);
      auto v = new QGraphicsView;
      v-&gt;setScene(s);
  
      CTestGraphicsObject* pParent = new CTestGraphicsObject(Qt::green);
      CTestGraphicsObject* pChild = new CTestGraphicsObject(Qt::red);
      pChild-&gt;setParentItem(pParent);
      pChild-&gt;setPos(0, 100);
      s-&gt;addItem(pParent);
      s-&gt;addItem(pChild);
  
      QVBoxLayout* l = new QVBoxLayout(this-&gt;centralWidget());
      l-&gt;addWidget(v);
  }
  
  asdf::~asdf()
  {
  
  }
  </code></pre>
  
  <p>The QGraphicsDropShadowEffect causes this problem, It seems I'm not using it in right way.</p>