Hi to all,
I'm trying to build a rectangle (QGraphicsRectItem) with a text inside (QGraphicsTextItem) perfectly centered both vetically and horizontally as child, if it's the best solution. I've tried the following code:

Qt Code:
  1. for (int i = 0; i < 12; i++)
  2. {
  3. new QGraphicsRectItem(QRect(margineX + 60 * i, endY - margineY + 2, 60, 30), 0, scene);
  4. month->setPen(QPen(Qt::red, 1, Qt::SolidLine));
  5. month->setBrush(Qt::NoBrush);
  6.  
  7. QGraphicsTextItem *textMonth =
  8. new QGraphicsTextItem(QString("%1").arg(i + 1), month);
  9. }
To copy to clipboard, switch view to plain text mode 

and...it doesn't work. Thanks in advance!