QScroller Grab Gesture causes Rendering issues on Android
-
Hi,
It seems that every time I create an area that requires scrolling via touch Gesture, the left and top side are slightly cuttoff in the scroll Area and Cause tearing on screen. This works perfectly fine on Windows (have not tested on IOS) but on Android it keeps happening. Can anyone help? I am using QT 6.8 on a Google Pixel 8 with ndk 28.0.13004108.
Here is a sample of the code that causes the Issue#include "MainWindow.h" #include <QDomDocument> #include <QRandomGenerator> //#include "CustomTextBrowser.h" #include <QScroller> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { m_pTextBrowser = new QTextBrowser(this); m_pTextBrowser->setReadOnly(true); QScroller::grabGesture(m_pTextBrowser->viewport(), QScroller::TouchGesture); m_pTextBrowser->setTextInteractionFlags(Qt::NoTextInteraction); m_pTextBrowser->setStyleSheet("color: white; font-size: 18px; font-family: Courier; border: none; background-color: #121212;"); // **Main Layout** QWidget *centralWidget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(centralWidget); layout->addWidget(m_pTextBrowser); centralWidget->setLayout(layout); setCentralWidget(centralWidget); generateAndDisplayXml(); } void MainWindow::generateAndDisplayXml() { QString xmlContent = generateRandomXml(); m_pTextBrowser->setText(xmlContent); } // **Generates a Random XML Document** QString MainWindow::generateRandomXml() { QDomDocument doc; QDomElement root = doc.createElement("Root"); doc.appendChild(root); for (int i = 0; i < 50; ++i) { QDomElement item = doc.createElement("Item"); item.setAttribute("id", i + 1); item.appendChild(doc.createTextNode(QString("RandomValue%1").arg(QRandomGenerator::global()->bounded(100)))); root.appendChild(item); } return doc.toString(4); }
-
I believe I am also encountering this issue. Considering the characteristic visual distortion I think it's plausible this is an upstream issue. Have you opened a ticket with the maintainers?
-
https://bugreports.qt.io/browse/QTBUG-135011
for anyone else encountering this, I have opened a bug with the upstream https://bugreports.qt.io/browse/QTBUG-135011