[Qt-interest] Overridden wheelEvent not being called

Cole, Derek dcole at integrity-apps.com
Fri Jan 21 17:09:26 CET 2011


As I was discussing in my other thread - I am trying to get zoom capability on an item being displayed in a QGraphicsView.

I have turned mousetracking on for the QGraphicsView - but do I need to somehow do that for my new QGraphicsPixmapItem?

Heres my header file:

#include <QGraphicsPixmapItem>
class ImagePixmapItem: public QGraphicsPixmapItem
    {
    public:
        ImagePixmapItem(const QPixmap &pixmap, QGraphicsItem *parentItem=0);
        ~ImagePixmapItem();
        QRectF boundingRect() const;
        void paint(QPainter *painter,
                   const QStyleOptionGraphicsItem *option, QWidget *widget=0);
        void setSize(qreal size);
    protected:
        void wheelEvent ( QGraphicsSceneWheelEvent * event );


    private:
        qreal             size;
    };


And I just put a qDebug("Hello"); in the wheelEvent function, yet it seems to never get called. my item does load and display correctly in the QGraphicsView though, it seems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110121/c834f2b5/attachment.html 


More information about the Qt-interest-old mailing list