QTableView scrolling gets stuck (touch screen / grab gesture)
-
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-70681Noticed 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);