Set QScrollerProperties::OvershootPolicy not working ?



  • I'm trying to change the OvershootPolicy of QScroller with the following code:

    @
    

    QScroller::grabGesture( m_scrollArea->viewport(), QScroller::LeftMouseButtonGesture );
    QScroller* qs = QScroller::scroller( m_scrollArea->viewport() );

    QScrollerProperties sp = qs->scrollerProperties();
    sp.setScrollMetric( QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff );
    sp.setScrollMetric( QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff );

    qs->setScrollerProperties( sp );
    @

    But it seems to have no effect. There is still overshooting from the borders. Am I missing something?



  • @Tsweti

    need QVariant cast.

    QScrollerProperties properties = QScroller::scroller(scrollWidget)->scrollerProperties();
    
    QVariant overshootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff);
    properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy);
    
    QScroller::scroller(scrollWidget)->setScrollerProperties(properties); 
    

    http://stackoverflow.com/questions/24677152/qt-how-to-stop-dragging-viewport-of-qlistview-when-using-qscroller


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.