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. Andrioid Emulator no Widget GUI updates

Andrioid Emulator no Widget GUI updates

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 787 Views 1 Watching
  • 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by Andy314
    #1

    Hello, here my next problem with Andriod.

    I have created a simple test app with QCheckbox, QRadioButton and QTextEdit.
    On the simulator I get no GUI updates (Checked, text changes) when I interact via mouse with gui.

    It seem only a gui update problem. When I open a simple QMessagebox via a QButton the gui indates instantly before the messagebox opens.

    On real hardware all work as expected.

    What can be the problem ?

    Andy314A 1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zvoopz
      wrote on last edited by
      #2

      This is a bug of widget based Qt build for Android
      Sometimes it updates the screen but sometimes you need to update the screen manually

      I have created a function which updates screen - put next in MainWindow constructor
      #include <QTimer>

      { MainWindow constructor
      QTimer *timer = new QTimer(this);
      connect(timer, &QTimer::timeout, this, &MainWindow::updateScreen);
      timer->start(100);}

      //hidden somewhere in the helper
      void MainWindow::updateScreen()
      {
      update();
      }

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zvoopz
        wrote on last edited by
        #3

        Another bug you may face to is Android only null pointer crash of app due to QTextEdit widget
        If you do not need to edit the text (just plot) - substitute it with QTextBrowser

        1 Reply Last reply
        0
        • Andy314A Andy314

          Hello, here my next problem with Andriod.

          I have created a simple test app with QCheckbox, QRadioButton and QTextEdit.
          On the simulator I get no GUI updates (Checked, text changes) when I interact via mouse with gui.

          It seem only a gui update problem. When I open a simple QMessagebox via a QButton the gui indates instantly before the messagebox opens.

          On real hardware all work as expected.

          What can be the problem ?

          Andy314A Offline
          Andy314A Offline
          Andy314
          wrote on last edited by
          #4

          I found a global solution for it (resp. ChatGPT :-) and will share it here.

          class AndroidApplication : public QApplication
          {
          public:
              AndroidApplication(int &argc, char **argv)
                  : QApplication(argc, argv)
              {}
          
              bool notify(QObject *receiver, QEvent *e) override
              {
                  // Erstmal normal weiterleiten
                  bool ok = QApplication::notify(receiver, e);
          
                  // Bei jedem UpdateRequest-Event erzwingen wir einen Frame-Swap
                  if (e->type() == QEvent::UpdateRequest) {
                      // Prüfen, ob das Ziel ein QWidget ist
                      if (auto w = qobject_cast<QWidget*>(receiver)) {
                          if (auto wh = w->window()->windowHandle()) {
                              wh->requestUpdate();  // sofortigen Flush anstoßen
                          }
                      }
                  }
                  return ok;
              }
          };
          

          It works ! Is this ok in general and for performance issues ?

          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