Hi,

I have problems getting mouse events on my custom implemented pixmap item and text item. I am implementing boundingRect function in following way, can you please suggest what am I doing wrong? It seems that I am making some obvious mistake but not able to catch it :-(
Qt Code:
  1. QRectF ITGraphicsPixmapItem::boundingRect() const
  2. {
  3. qreal penWidth = 1;
  4. QRectF rect = QRectF(0-penWidth/2,0-penWidth/2,itemSize.width()+penWidth,itemSize.height()+penWidth);
  5. if(itemIsSelected)
  6. rect.adjust(-m_CornerSize,-m_CornerSize,m_CornerSize,m_CornerSize);
  7.  
  8. return rect;
  9. }
To copy to clipboard, switch view to plain text mode 
This way I get hover even only if the mouse cursor in somewhere boundary like (0,0,itemSize.width()+m_CormerSize,itemSize.height ()+m_CornerSize). It seems to be some problem with negative x and y coordinates. What is the correct way to implement this then?

Qt Code:
  1. QRectF ITGraphicsTextItem::boundingRect() const
  2. {
  3. qreal penWidth = 1;
  4. QRectF rect = QGraphicsTextItem::boundingRect();
  5.  
  6. if(itemIsSelected)
  7. rect.adjust(-m_CornerSize,-m_CornerSize,m_CornerSize,m_CornerSize);
  8.  
  9. return rect;
  10. }
To copy to clipboard, switch view to plain text mode 
This way I get hover event only if the mouse cursor in QGraphicsTextItem::boundingRect(). While painting, I can easily use bounding Rect with intended results but mouse events don't work on updated bounding rect. Can you please help me, Why is it doing so?

Regards,
Manoj