You need to override boundingRect() to return enlarged rect. I did some sample code.
This worked for me for all rotations and pixel sizes. Here it is.
Guess this is what you wanted

Qt Code:
  1. #include <QtGui>
  2.  
  3. class FloatText : public QGraphicsTextItem
  4. {
  5. //Q_OBJECT;
  6. public:
  7. FloatText( QGraphicsScene *scene )
  8. : QGraphicsTextItem(0, scene)
  9. {
  10. setPlainText ( "human ");
  11. QFont f = font();
  12. f.setPixelSize(40);
  13. setFont(f);
  14. rotate(-90);
  15. setFlags(QGraphicsItem::ItemIsMovable);
  16. }
  17.  
  18. QRectF boundingRect() const
  19. {
  20. return QGraphicsTextItem::boundingRect().adjusted(-2,-2,+2,+2);
  21. }
  22.  
  23. void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,QWidget *widget)
  24. {
  25. QGraphicsTextItem::paint(painter,option,widget);
  26. // Isn't this strange to call update in paint event ?
  27. //update();
  28. painter->setPen(Qt::black);
  29. painter->drawRect(boundingRect());
  30. }
  31.  
  32. };
  33.  
  34. int main(int argc, char *argv[])
  35. {
  36. QApplication app(argc,argv);
  37. QGraphicsScene scene(0,0,1024,768);
  38. FloatText t(&scene);
  39. t.setPos(500,500);
  40. QGraphicsView view(&scene);
  41. view.show();
  42. return app.exec();
  43. }
To copy to clipboard, switch view to plain text mode