title: Trying to use boundingRect in Qt
body: <p>What is wrong with class <code>Kwadrat</code>? I have an error:</p>
  
  <blockquote>
    <p>Invalid new-expression of abstract class type 'Kwadrat'</p>
  </blockquote>
  
  <pre><code>Kwadrat* kwadrat = new Kwadrat(20);
  </code></pre>
  
  <p>I want a moving square on the screen (when it hit 370 on X or 370 on Y coordinate it comes back to middle).</p>
  
  <p>when Kwadrat is classic <code>QGraphicsRectItem</code> I have a bug with (0,0) coordinate.</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QGraphicsView&gt;
  #include &lt;QGraphicsScene&gt;
  #include &lt;QPixmap&gt;
  #include "poruszanie.h"
  #include &lt;QRectF&gt;
  #include &lt;QGraphicsRectItem&gt;
  
  class Kwadrat : public QGraphicsItem
  {
      Q_OBJECT
  
  public:
      Kwadrat(int size)
          : QGraphicsItem(NULL) // we could parent, but this may confuse at first
      {
          m_boundingRect = QRectF(0, 0, size, size);
      }
  
      QRectF boundingRect() const
      {
          return m_boundingRect;
      }
  
  private:
      QRectF m_boundingRect;
  };
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      QGraphicsScene*scena=new QGraphicsScene();
  
     // Poruszanie*kwadrat=new Poruszanie();
     // kwadrat-&gt;setRect(0,0,20,20);
     // kwadrat-&gt;setBrush(QBrush(Qt::white));
     // scena-&gt;addItem(kwadrat);
  
      Kwadrat*kwadrat=new Kwadrat(20);
      kwadrat-&gt;setBrush(QBrush(Qt::white));
      scena-&gt;addItem(kwadrat);
  
      kwadrat-&gt;setFlag(QGraphicsItem::ItemIsFocusable);
      kwadrat-&gt;setFocus();
  
      QGraphicsView *widok=new QGraphicsView(scena);
      widok-&gt;setBackgroundBrush(QBrush(Qt::yellow));
      widok-&gt;setMinimumSize(400,400);
      widok-&gt;show();
  
      return a.exec();
  }
  </code></pre>