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. QTableView scrolling gets stuck (touch screen / grab gesture)
Forum Updated to NodeBB v4.3 + New Features

QTableView scrolling gets stuck (touch screen / grab gesture)

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 710 Views
  • 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.
  • S Offline
    S Offline
    sslakk
    wrote on last edited by sslakk
    #1

    Hello,

    I just changed OS from Debian 9 (Qt 5.7.1) to Debian 10 (Qt 5.11.3) and faced some strange issues with QTableView and scrolling. I am using scroller with grab gesture to achieve mobile device style scrolling on the tableview widget area.

    Unfortunately the scrolling gets stuck pretty soon (no response at all). Anyhow the traditional scrolling with scrollbar is still working normally after it gets stuck.

    I don't know how to exactly reproduce the issue, but just clicking (touching) randomly here and there for a while usually triggers it. Currently the only solution is to restart the software.

    The software is used on a touch panel, but the same issue can be reproduced with mouse (on virtualized environment and on real hardware). I have removed all the custom event handlers that could block something.

    Any ideas? Thank you very much!

    Edit:
    It can be related to this bug because I am also using QStackedWidget with multiple QTableViews/QScrollers on different pages:
    https://bugreports.qt.io/browse/QTBUG-70681

    Noticed that the problem can be reproduced by scrolling one tableview so that it keeps scrolling by itself and immediately switch to another page with tableview.

    QTableView and QScroller initialization:

    ui->tableView->setStyleSheet(HelperClass::ReadStyleSheet("x.qss"));
    ui->tableView->verticalScrollBar()->setStyleSheet(HelperClass::ReadStyleSheet("y.qss"));
    ui->tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
    ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->tableView->setFocusPolicy(Qt::NoFocus);
    ui->tableView->verticalHeader()->setVisible(false);
    ui->tableView->verticalHeader()->setDefaultSectionSize(50);
    ui->tableView->setAutoScroll(false);
    ui->tableView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    ui->tableView->setSelectionMode(QAbstractItemView::NoSelection);
    ui->tableView->setSortingEnabled(false);
    ui->tableView->setShowGrid(false);
    ui->tableView->setAlternatingRowColors(true);
    ui->tableView->horizontalHeader()->setVisible(true);
    
    QScroller* scroller = QScroller::scroller(ui->tableView);
    QScrollerProperties properties = QScroller::scroller(scroller)->scrollerProperties();
    QVariant overshootPolicy = QVariant::fromValue<QScrollerProperties::OvershootPolicy>(QScrollerProperties::OvershootAlwaysOff);
    properties.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, overshootPolicy);
    scroller->setScrollerProperties(properties);
    properties.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, overshootPolicy);
    scroller->setScrollerProperties(properties);
    scroller->grabGesture(ui->tableView, QScroller::LeftMouseButtonGesture);
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      sslakk
      wrote on last edited by
      #2

      Subclassed QGestureRecognizer and created own custom solution. It's little bit ugly, but working. Waiting for bug fix.

      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