Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Kinetic scrolling on QTableView, randomly selecting row.
Forum Updated to NodeBB v4.3 + New Features

Kinetic scrolling on QTableView, randomly selecting row.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 462 Views 2 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.
  • P Offline
    P Offline
    Poonam Gupta
    wrote on last edited by
    #1

    Hi, I need some help and I am struggling to solve this problem. I am implementing kinetic scrolling on a QTableView and I also need row selection feature. Once the row is selected I show some details about that row. Also row has delegate assigned for the view purpose.
    However, my problem is when user is scrolling via touch, it's selecting one of the row by default and it shows the detail of that row as per my specs. But now here problem is user dint select row. he/she is just scrolling but I guess when user is releasing the touch its consider as a mouse released for the Table view and selecting that row.

    is there any way i can avoid this or any other implementation I can do to achieve this.

    Here is my sample code for the kinetic scrolling and row selection

    QScroller *scroller = QScroller::scroller(view);
    view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    //view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);

    QScrollerProperties properties =
    QScroller::scroller(scroller)->scrollerProperties();
    QVariant overshootPolicy =
    QVariant::fromValueQScrollerProperties::OvershootPolicy(
    QScrollerProperties::OvershootAlwaysOff);

    properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy);
    scroller->setScrollerProperties(properties);
    properties.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, overshootPolicy);
    scroller->setScrollerProperties(properties);
    scroller->grabGesture(view, QScroller::TouchGesture);

    view is QTableView instance here.

    // this is how I am using row selection signal
    void TableWidget::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
    {
    emit sig_selectionChanged(selectedIndexes());
    }

    any help appreciated. Thank you in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You should add which version of Qt you are using as well as the platform.

      A full minimal compilable example would be better so people can test the same things as you.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        You should add which version of Qt you are using as well as the platform.

        A full minimal compilable example would be better so people can test the same things as you.

        P Offline
        P Offline
        Poonam Gupta
        wrote on last edited by
        #3

        @SGaist
        Thanks for replying. I am using qt 5.12.8 and linux ubuntu platform.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If possible you should test with a more recent version.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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