Quote Originally Posted by d_stranz View Post
Move your ellipse up and to the left by 50 each:

Qt Code:
  1. path.addEllipse( QRectF( 0, 0, 100, 100 ) );
To copy to clipboard, switch view to plain text mode 
Hmmm.... why so?

This works perfectly fine:

Qt Code:
  1. #include <QtGui>
  2.  
  3. class Item : public QGraphicsItem {
  4. public:
  5. Item(QGraphicsItem *parent = 0) : QGraphicsItem(parent) {}
  6. QRectF boundingRect() const { return QRectF(-50, -50, 100, 100); }
  7. QPainterPath shape() const { QPainterPath p; p.addEllipse(boundingRect()); return p; }
  8. void paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) {
  9. p->drawEllipse(boundingRect());
  10. }
  11. protected:
  12. void mousePressEvent(QGraphicsSceneMouseEvent *e) {
  13. qDebug() << Q_FUNC_INFO;
  14. }
  15. };
  16.  
  17. int main(int argc, char **argv) {
  18. QApplication app(argc, argv);
  19. view.setScene(&sc);
  20. sc.addItem(new Item);
  21. view.show();
  22. return app.exec();
  23. }
To copy to clipboard, switch view to plain text mode