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. QScrollArea issue on Android
Forum Update on Monday, May 27th 2025

QScrollArea issue on Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 6 Posters 564 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.
  • B Offline
    B Offline
    Balazs Beregnyei
    wrote on 12 Sept 2024, 11:59 last edited by
    #1

    It seems to me that QScrollArea doesn't update the screen properly on Android (Qt 6.7.2, Samsung Galaxy S21). When I scroll, the top part and the left part of the screen remains the same. When I rotate the device, it recovers, but in general, I cannot publish any app with this behaviour. Is it a Qt issue or a Samsung issue? How can I fix it? I just wrote a minimalistic app to demonstrate the issue. It works fine on any other platform but Android. This is the original screen before I scroll:

    android-QScrollArea-1.jpg

    .... and after:

    android-QScrollArea-2.jpg

    The source code:

    #include "mainwidget.h"
    
    #include <QScrollArea>
    #include <QVBoxLayout>
    #include <QLabel>
    
    MainWidget::MainWidget(QWidget *parent)    : QWidget(parent)
    {
        QScrollArea *scroll = new QScrollArea();
        QVBoxLayout *outerLayout = new QVBoxLayout();
        QVBoxLayout *innerLayout = new QVBoxLayout();
        QWidget * innerWidget = new QWidget();
    
        innerWidget->setLayout(innerLayout);
    
        for (int i = 0; i < 30; i++)
        {
            auto mlabel = new QLabel(QString::number(i));
            innerLayout->addWidget(mlabel);
        }
    
        scroll->setWidget(innerWidget);
        outerLayout->addWidget(scroll);
    
        setLayout(outerLayout);
    }
    
    MainWidget::~MainWidget()
    {
    }
    
    

    Any help is very appreciated. Thanks!

    J 1 Reply Last reply 28 days ago
    0
    • M Offline
      M Offline
      MartinGU
      wrote on 16 Sept 2024, 19:32 last edited by
      #2

      Android screen redraws are really fucked up in C++,
      I have not tried QML myself but read other who has switched to QML. I myself have no interest of switching to QML but if it helps you then.

      Example of bugreport:
      https://bugreports.qt.io/browse/QTBUG-128794

      /Martin

      1 Reply Last reply
      1
      • A Offline
        A Offline
        ankou29666
        wrote on 16 Sept 2024, 20:12 last edited by ankou29666
        #3

        no, Qt Widgets has just never been intended to be used on mobile devices.
        If you want your app to run on android or ios devices, you need Qt Quick / QML !!!

        B 1 Reply Last reply 17 Sept 2024, 00:14
        0
        • A ankou29666
          16 Sept 2024, 20:12

          no, Qt Widgets has just never been intended to be used on mobile devices.
          If you want your app to run on android or ios devices, you need Qt Quick / QML !!!

          B Offline
          B Offline
          Balazs Beregnyei
          wrote on 17 Sept 2024, 00:14 last edited by
          #4

          @ankou29666
          I didn't know it has never been intended to be used on mobile, but my app with around 7.000 lines of C++ QWidget code runs just fine on iOS. It cannot be a giant coincidence, at Qt they must have some intention to make it work. I would much rather solve the scroll issue on Android instead of rewriting the whole app in Qt Quick. But yes, most probably you are right about Qt Quick being a better fit for mobile. It is already on my list to learn it, thanks for the reminder.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            ankou29666
            wrote on 17 Sept 2024, 08:15 last edited by ankou29666
            #5

            as far as I know the Qt Company has always recommended Qt Quick for mobile devices. According to this video, Qt Quick and QML were created because Qt Widgets didn't suit the job of mobile UI.
            so your code may work on iOS, I seriously doubt it is intended to.

            As far as I know, the intention of the Qt Company, that they've had for long now, is to stop developing new features with Qt Widgets, those new features are available with Qt Quick only. Just have a look at recent modules like Qt Location : it does have UI elements to display maps in Qt Quick / QML, but there's obviously none in Qt Widgets. There's only non UI classes in C++.

            By the way, there's a popular tool for UI mockup named Figma that allows you to design your UI, and Qt offers a bridge (which is a Figma plugin, not a Qt Design Studio plugin) that allows you to import your design into Design Studio. (Or use Design Studio directly ? yours to see.)

            I'm currently looking at it. It seems really nice.

            1 Reply Last reply
            2
            • M Offline
              M Offline
              MarkSI
              wrote on 14 Jan 2025, 02:55 last edited by
              #6

              I have the same/similar problem with my app. The problem does not appear to occur in Qt 5.7.3. Unfortunately, the Android video camera works unreliably in 5.7.3 but does work in 6.8.1. I have not discovered a combination where the screen updates and the camera work reliably. Disappointing. Does anyone have any progress to report on the "screen tearing" in Qt-Android?

              1 Reply Last reply
              0
              • B Balazs Beregnyei
                12 Sept 2024, 11:59

                It seems to me that QScrollArea doesn't update the screen properly on Android (Qt 6.7.2, Samsung Galaxy S21). When I scroll, the top part and the left part of the screen remains the same. When I rotate the device, it recovers, but in general, I cannot publish any app with this behaviour. Is it a Qt issue or a Samsung issue? How can I fix it? I just wrote a minimalistic app to demonstrate the issue. It works fine on any other platform but Android. This is the original screen before I scroll:

                android-QScrollArea-1.jpg

                .... and after:

                android-QScrollArea-2.jpg

                The source code:

                #include "mainwidget.h"
                
                #include <QScrollArea>
                #include <QVBoxLayout>
                #include <QLabel>
                
                MainWidget::MainWidget(QWidget *parent)    : QWidget(parent)
                {
                    QScrollArea *scroll = new QScrollArea();
                    QVBoxLayout *outerLayout = new QVBoxLayout();
                    QVBoxLayout *innerLayout = new QVBoxLayout();
                    QWidget * innerWidget = new QWidget();
                
                    innerWidget->setLayout(innerLayout);
                
                    for (int i = 0; i < 30; i++)
                    {
                        auto mlabel = new QLabel(QString::number(i));
                        innerLayout->addWidget(mlabel);
                    }
                
                    scroll->setWidget(innerWidget);
                    outerLayout->addWidget(scroll);
                
                    setLayout(outerLayout);
                }
                
                MainWidget::~MainWidget()
                {
                }
                
                

                Any help is very appreciated. Thanks!

                J Offline
                J Offline
                jporcher
                wrote 28 days ago last edited by
                #7

                @Balazs-Beregnyei did you find a workaround? Did you report a Qt bug?

                I agree with you Qwidget is supposed to work under Android. I also have apps with hundred thousand lines of code ... can't rewrite it all on QML...

                This bug appeared when upgrading from Qt 6.2.2 to Qt 6.9.0.

                JoeCFDJ 1 Reply Last reply 28 days ago
                0
                • J jporcher
                  28 days ago

                  @Balazs-Beregnyei did you find a workaround? Did you report a Qt bug?

                  I agree with you Qwidget is supposed to work under Android. I also have apps with hundred thousand lines of code ... can't rewrite it all on QML...

                  This bug appeared when upgrading from Qt 6.2.2 to Qt 6.9.0.

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote 28 days ago last edited by JoeCFD
                  #8

                  @jporcher Can you try to change the scrolling speed? For example:
                  tableWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
                  The default one could be too fast. Qt Widgets do have issues on touch screen(not only on phone screens). It may be hardware or drivers problem as well. Try another brand of phone to see if your app has the same problem.

                  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