سؤال

I found a conflict between QScroller and QScrollBar. So I have a QScrollArea with vertical scrollbar. I also activate a QScroller that allows me to do kinetic scrolling with left click button. But I can't grab the scrollbar handle any more. Because once I grab it, QScroller begins to take over. This is how I add the QScroller:

QScroller::grabGesture(mArea, QScroller::LeftMouseButtonGesture) ; 

Any idea how can I slove the conflict?

هل كانت مفيدة؟

المحلول 2

I got a solution. I redefined the enterEvent and leaveEvent of QScrollBar, dis-activate and activate the QScroller inside with QScroller::ungrabGesture() QScroller::grabGesture(). It works fine now. Besides, a event filter can also do the job.

نصائح أخرى

I've had the same issue. It can be avoided by applying the grabGesture to the viewport of the QScrollArea, instead of the whole widget:

QScroller::grabGesture(mArea->viewport(), QScroller::LeftMouseButtonGesture) ; 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top