Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Set QScrollerProperties::OvershootPolicy not working ?
Forum Updated to NodeBB v4.3 + New Features

Set QScrollerProperties::OvershootPolicy not working ?

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tsweti
    wrote on last edited by
    #1

    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?

    S 1 Reply Last reply
    0
    • T Tsweti

      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?

      S Offline
      S Offline
      sharethl
      wrote on last edited by sharethl
      #2

      @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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved