I want to make the scroll bar can't scroll, such an event filter is added, but no, even if direct return true have no filter, can still scroll, not too understand, novice, do not know whether have great god tell scrollAreaWidgetContents is the inside of the scroller controls,
Bool MainWindow: : eventfilters (QObject * obj, QEvent * ev)
{
If (obj==UI - & gt; ScrollAreaWidgetContents)
{
If (QEvent: : Wheel==ev - & gt; The type ())
{
QWheelEvent * WE=dynamic_cast & lt; QWheelEvent * & gt; (ev);
return true;
If (WE - & gt; Delta () & gt; 0)
{
}
The else
{
Return QWidget: : eventfilters (obj, ev);
}
}
}
The else
{
Return QWidget: : eventfilters (obj, ev);
}
}
CodePudding user response:
Does not add the function of the scroll bar controls should be directly, without a rewrite the class and methodCodePudding user response: