Mouse wheel events, event filters, and QScrollArea

来源:互联网 发布:美少女战士 知乎 编辑:程序博客网 时间:2024/05/19 14:34
class MyWidget : public QObject{    public:        // ...        bool eventFilter(QObject* /*obj*/, QEvent* evt)        {            if (evt->type() == QEvent::Wheel)            {                // ignore the event (this effectively                 // makes it "skip" one object)                evt->ignore();            }            // return false to continue event propagation            // for all events            return false;        }    protected:        void wheelEvent(QWheelEvent* event)        {            // your own custom stuff            // ...            // if you handle the event and don't want it to            // propagate any further, accept it:            event->accept();        }};

Mouse wheel events, event filters, and QScrollArea



原创粉丝点击