Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QScroller Grab Gesture causes Rendering issues on Android

QScroller Grab Gesture causes Rendering issues on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
android6.8tearingqscrollbarc++
3 Posts 2 Posters 149 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.
  • A Offline
    A Offline
    alex_santelli
    wrote on last edited by alex_santelli
    #1

    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);
    }
    

    Screenshot_20250312-072444[1].png

    1 Reply Last reply
    0
    • E Offline
      E Offline
      ezra-varady
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ezra-varady
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved