Hi,

I have used the Canvas Example and it is giving the following error when i run it:

[HTML]release\imagezoomer.o(.text+0xe6e):imagezoomer.cpp : undefined reference to `ImageItem::hit(QPoint const&) const[/HTML]

the function which calls the hit function is :

Qt Code:
  1. void ImageZoomer::contentsMousePressEvent(QMouseEvent* e)
  2. {
  3. const QPoint p = inverseWorldMatrix().map(e->pos());
  4. Q3CanvasItemList l=canvas->collisions(p);
  5. for (Q3CanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
  6. if ( (*it)->rtti() == ImageItem::imageRTTI ) {
  7. ImageItem *item = (ImageItem*)(*it);
  8. if ( !(item->hit(p)) )
  9. continue;
  10. }
  11. moving = *it;
  12. moving_start = p;
  13. return;
  14. }
  15. moving = 0;
  16. }
To copy to clipboard, switch view to plain text mode 

and the hit function is :

ImageItem.h
Qt Code:
  1. class ImageItem : public Q3CanvasRectangle
  2. {
  3. public:
  4. //ImageItem();
  5. ImageItem( QImage img, Q3Canvas *canvas );
  6. int rtti () const { return imageRTTI; }
  7. bool hit( const QPoint&) const;
  8. static const int imageRTTI = 984376;
  9.  
  10. protected:
  11. void drawShape( QPainter & );
  12. private:
  13. QImage image;
  14. QPixmap pixmap;
  15.  
  16. };
To copy to clipboard, switch view to plain text mode 

ImageItem.cpp
Qt Code:
  1. bool ImageItem::hit( const QPoint &p ) const
  2. {
  3. int ix = p.x()-int(x());
  4. int iy = p.y()-int(y());
  5. if ( !image.valid( ix , iy ) )
  6. return FALSE;
  7. QRgb pixel = image.pixel( ix, iy );
  8. return qAlpha( pixel ) != 0;
  9. }
To copy to clipboard, switch view to plain text mode