您的位置:首页 > 其它

Mouse wheel events, event filters, and QScrollArea

2017-09-15 15:33 447 查看
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
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Wheel