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. QTimer not work
QtWS25 Last Chance

QTimer not work

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
11 Posts 4 Posters 655 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.
  • F Offline
    F Offline
    Faust Faust
    wrote on 23 Aug 2024, 18:45 last edited by
    #1

    QTimer function does not work on android as it used to.
    Timeout is not called.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Aug 2024, 18:54 last edited by
      #2

      Hi,

      You might want to be more detailed.
      Which version of Qt ?
      Which version of Android ?
      And a minimal compilable example showing the issue would also help people help you.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Faust Faust
        wrote on 23 Aug 2024, 19:54 last edited by Faust Faust
        #3
        timer = new QTimer(this);
        connect(timer, &QTimer::timeout, this, &MainWindow::timeout);
        timer->setInterval(1000);
        timer->start(1000);
        

        Qt version 6 7 2 Version ndk 25

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Axel Spoerl
          Moderators
          wrote on 24 Aug 2024, 05:44 last edited by Axel Spoerl
          #4

          Try this, please:

          QTimer::singleShot(1000, this, [](){ qFatal() << “I crash, when QTimer works”; });
          

          Software Engineer
          The Qt Company, Oslo

          F 1 Reply Last reply 6 Sept 2024, 00:54
          0
          • A Axel Spoerl
            24 Aug 2024, 05:44

            Try this, please:

            QTimer::singleShot(1000, this, [](){ qFatal() << “I crash, when QTimer works”; });
            
            F Offline
            F Offline
            Faust Faust
            wrote on 6 Sept 2024, 00:54 last edited by
            #5

            @Axel-Spoerl
            F libTimer_test_armeabi-v7a.so: I crash, when QTimer works
            F libc : Fatal signal 6 (SIGABRT), code -6 in tid 14794 (qtMainLoopThrea), pid 14747 (mple.Timer_test)
            I libc : orig_dumpable: 1

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Axel Spoerl
              Moderators
              wrote on 6 Sept 2024, 11:29 last edited by Axel Spoerl 9 Jun 2024, 11:37
              #6

              Can you be more precise? Have you tried the code and then crashed?
              I have the impression that the build is actually broken.

              Software Engineer
              The Qt Company, Oslo

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Faust Faust
                wrote on 7 Sept 2024, 01:33 last edited by
                #7

                I tried the code you suggested and it actually crashes.
                This is absurd.
                Version 5 was great, 6 introduced tons of bugs and slow compilation.

                J 1 Reply Last reply 11 Sept 2024, 06:48
                0
                • A Offline
                  A Offline
                  Axel Spoerl
                  Moderators
                  wrote on 7 Sept 2024, 05:41 last edited by Axel Spoerl 9 Jul 2024, 08:18
                  #8

                  Mind your language. General negative statements aren’t welcome here, especially if they are bluntly wrong and insulting.

                  Why do you expect NDK25 to work with Qt 6.7.2?
                  Have you checked our documentation? You need NDK26.
                  Have you checked the Qt Creator Settings for Android? I have the impression that you attempt to use a Qt 5 based project in 6.7.2 without updating SDK and NDK.

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  3
                  • F Offline
                    F Offline
                    Faust Faust
                    wrote on 9 Sept 2024, 09:35 last edited by
                    #9

                    I just used NDK26, in a new simple project, but it doesn't change much. timeout is only called when the application focus changes.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Axel Spoerl
                      Moderators
                      wrote on 9 Sept 2024, 09:41 last edited by
                      #10

                      The lambda code block I posted here, crashes when QTimerworks.
                      The output you posted here confirms that.
                      => The problem is in MainWindiw::timeout(), not in QTimer or elsewhere in Qt.
                      => Since you haven't posted this method, nobody can help you.

                      Software Engineer
                      The Qt Company, Oslo

                      1 Reply Last reply
                      1
                      • F Faust Faust
                        7 Sept 2024, 01:33

                        I tried the code you suggested and it actually crashes.
                        This is absurd.
                        Version 5 was great, 6 introduced tons of bugs and slow compilation.

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 11 Sept 2024, 06:48 last edited by
                        #11

                        @Faust-Faust said in QTimer not work:

                        I tried the code you suggested and it actually crashes

                        Which proves that the timer is working. This was intended by @Axel-Spoerl , nothing absurd about it.
                        Please read https://doc.qt.io/qt-5/qtglobal.html#qFatal - qFatal will terminate your app ("If you are using the default message handler this function will abort")

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        2

                        • Login

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