hi ppl,

I've got the following small prob:

Qt Code:
  1. #include <QtGui>
  2.  
  3. class MyGraphicsItem : public QGraphicsItem
  4. {
  5. public:
  6. MyGraphicsItem(QGraphicsItem *parent = 0) : QGraphicsItem(parent), _width(40), _height(10){}
  7. ~MyGraphicsItem(void){qDebug("delBand");}
  8.  
  9. QRectF boundingRect() const{
  10. return QRectF(0, 0, _width, _height);
  11. }
  12. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0){
  13. painter->setBrush(Qt::darkRed);
  14. painter->setPen(Qt::black);
  15. painter->drawRoundRect(0, 0, _width, _height);
  16. }
  17.  
  18. private:
  19. int _width;
  20. int _height;
  21. };
To copy to clipboard, switch view to plain text mode 

using:
Qt Code:
  1. setToolTip(QString("testToolTip"));
To copy to clipboard, switch view to plain text mode 
in the constructor, works perfectly to enable tooltips for the item

but using:
Qt Code:
  1. QString toolTip() const {
  2. return QString("testToolTip");
  3. }
To copy to clipboard, switch view to plain text mode 
does not work

why???