Scrolling a QTableView via touch

    1. Problem:
      For a QTableView I have configured VerticalScrollMode = ScrollPerItem.
      Therefore it should be possible to scroll the TableView via 2FingerTouch
      This work not correct. It scrolls round about 10 Items by a move of round about 1 table row-height.

    2. Problem:
      I dont like the 2 Finger touchgestures for scroll, so I found the following code:
      QScroller::grabGesture(ui->TableView, QScroller::LeftMouseButtonGesture);
      This enables indeed the touch scrolling feature with on finger.
      This does not work a well. I scrolls much more faster, therefore I think here I scrollPerPixel is used.

    How can I get a "normal" scrolling via touch? Distance of finger move should amount of scrolling.

  • Moderators

    try playing around with the QScrollerProperties:

    QScroller::grabGesture(ui->TableView, QScroller::LeftMouseButtonGesture);
    QScroller* scroller = QScroller::scroller( ui->TableView );
    QScrollerProperties props = scroller ->scrollerProperties();
    props.setScrollMetric( QScrollerProperties::MaximumVelocity, QVariant::fromValue<qreal>(0.5) );
    // ... take a look at the other properties also
    scroller->setScrollerProperties( props );

Log in to reply

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