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. QPushButton not loading next screen
Forum Updated to NodeBB v4.3 + New Features

QPushButton not loading next screen

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
15 Posts 4 Posters 418 Views 2 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.
  • V Vidya H

    I am using a Qt5.15 C++ based application on ARM target. I have a QPushButton on my home screen which is gray in color. When clicked, the button color changes to blue. However, the button has to load the menu screen which is not happening.

    • Background: I have ported the application from Qt5.3 to Qt5.15 and seeing same behavior on both versions.

    Since this is a very intermittent issue, I am not able to replicate it.
    I am requesting for support to debug this further to understand if this error can occur due to RAM issue on the target platform? Can this issue occur to due Qt framework? Anything specific that I can check on my application code?

    Let me know if further details are required.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote last edited by
    #2

    @Vidya-H Without seeing relevant code nobody can tell you why it is not working.
    I doubt it is related to RAM - your application would be killed by the OS if there would be not enough RAM.
    Also, before thinking about an issue in Qt you need to make sure it is not your code. So, please post the code, or even better a small reproducer.

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

    V 1 Reply Last reply
    1
    • jsulmJ jsulm

      @Vidya-H Without seeing relevant code nobody can tell you why it is not working.
      I doubt it is related to RAM - your application would be killed by the OS if there would be not enough RAM.
      Also, before thinking about an issue in Qt you need to make sure it is not your code. So, please post the code, or even better a small reproducer.

      V Offline
      V Offline
      Vidya H
      wrote last edited by Vidya H
      #3

      @jsulm code snippet is below. I added prints to debug further. However, issue has not replicated on the hardware after adding these debug prints. Is there any way to confirm that this issue is due to RAM?

      void myWidget::on_pbmyButton_clicked()
      {
          if(FALSE == MainWindow::m_bmyButtonDisable)
          {
              MainWindow::m_bmyButtonButtonDisable = TRUE;
      
              printf("\n******************* myWidget: myButton Pressed. ");
      
              //do something - my business logic is here
          }
      
          else
          {
              printf("\n******************* myWidget: Multiple Times myButton Pressed");
          }
      }
      
      JonBJ 1 Reply Last reply
      0
      • V Vidya H

        @jsulm code snippet is below. I added prints to debug further. However, issue has not replicated on the hardware after adding these debug prints. Is there any way to confirm that this issue is due to RAM?

        void myWidget::on_pbmyButton_clicked()
        {
            if(FALSE == MainWindow::m_bmyButtonDisable)
            {
                MainWindow::m_bmyButtonButtonDisable = TRUE;
        
                printf("\n******************* myWidget: myButton Pressed. ");
        
                //do something - my business logic is here
            }
        
            else
            {
                printf("\n******************* myWidget: Multiple Times myButton Pressed");
            }
        }
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote last edited by
        #4

        @Vidya-H
        All this code shows is an if in a function (probably a slot called on signal). It does not show anything at all about "the button has to load the menu screen which is not happening.". It uses a highly inadvisable reference to a variable in the MainWindow class, which is a bad idea. It also uses a static variable, which is odd and quite possibly incorrect.

        The issue is likely to be in your code, certainly not "RAM". Is is hard to comment on "intermittent" --- possibly because your code is incorrect and so has "odd" behaviour.

        Make a small reproducer if you want help. There should be no need for multiple classes or source files.

        V 1 Reply Last reply
        1
        • JonBJ JonB

          @Vidya-H
          All this code shows is an if in a function (probably a slot called on signal). It does not show anything at all about "the button has to load the menu screen which is not happening.". It uses a highly inadvisable reference to a variable in the MainWindow class, which is a bad idea. It also uses a static variable, which is odd and quite possibly incorrect.

          The issue is likely to be in your code, certainly not "RAM". Is is hard to comment on "intermittent" --- possibly because your code is incorrect and so has "odd" behaviour.

          Make a small reproducer if you want help. There should be no need for multiple classes or source files.

          V Offline
          V Offline
          Vidya H
          wrote last edited by
          #5

          @JonB There is a state machine in the code base that causes the button click to move to next state and load the menu screen.

          jsulmJ JonBJ 2 Replies Last reply
          0
          • V Vidya H

            @JonB There is a state machine in the code base that causes the button click to move to next state and load the menu screen.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote last edited by
            #6

            @Vidya-H Did you do any debugging to see what is happening? Maybe your state machine is wrong?

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

            V Axel SpoerlA 2 Replies Last reply
            2
            • V Vidya H

              @JonB There is a state machine in the code base that causes the button click to move to next state and load the menu screen.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote last edited by JonB
              #7

              @Vidya-H
              Do you think anyone can help you from what you have chosen to say and show?

              No matter what, having a class myWidget know about MainWindow is bad architecture, not to mention (apparently) using a static variable in that class which is surely not right. May or may not have something to do with your issue.

              As @jsulm writes, don't you think you should debug what happens in your code when the button is clicked?

              V 1 Reply Last reply
              1
              • jsulmJ jsulm

                @Vidya-H Did you do any debugging to see what is happening? Maybe your state machine is wrong?

                V Offline
                V Offline
                Vidya H
                wrote last edited by
                #8

                @jsulm Since this issue came up only twice as of today, once on Qt5.3 and another time on Qt5.15 version of the code, it was not possible to debug further.

                JonBJ 1 Reply Last reply
                0
                • V Vidya H

                  @jsulm Since this issue came up only twice as of today, once on Qt5.3 and another time on Qt5.15 version of the code, it was not possible to debug further.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote last edited by
                  #9

                  @Vidya-H
                  Maybe an uninitialized or out-of-scope variable or other programming bug which only shows up sometimes? Nobody can tell from what you have posted. But surely an issue in your code not in Qt.

                  1 Reply Last reply
                  1
                  • JonBJ JonB

                    @Vidya-H
                    Do you think anyone can help you from what you have chosen to say and show?

                    No matter what, having a class myWidget know about MainWindow is bad architecture, not to mention (apparently) using a static variable in that class which is surely not right. May or may not have something to do with your issue.

                    As @jsulm writes, don't you think you should debug what happens in your code when the button is clicked?

                    V Offline
                    V Offline
                    Vidya H
                    wrote last edited by
                    #10

                    @JonB yes. I have added debug prints and trying to replicate the issue. If the issue replicates, I will share the logs.

                    jsulmJ 1 Reply Last reply
                    0
                    • V Vidya H

                      @JonB yes. I have added debug prints and trying to replicate the issue. If the issue replicates, I will share the logs.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote last edited by
                      #11

                      @Vidya-H You could also use a debugger to step through the code and see what happens

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

                      V 1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @Vidya-H You could also use a debugger to step through the code and see what happens

                        V Offline
                        V Offline
                        Vidya H
                        wrote last edited by
                        #12

                        @jsulm I have a 512MB RAM hardware and app might crash or slow down if I try step by step debugging. For time being, I have added debug prints and trying to replicate the issue.

                        1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Vidya-H Did you do any debugging to see what is happening? Maybe your state machine is wrong?

                          Axel SpoerlA Offline
                          Axel SpoerlA Offline
                          Axel Spoerl
                          Moderators
                          wrote last edited by
                          #13

                          If you have a bug, you need to debug, as @jsulm and @JonB rightfully say.
                          There is no need to run your app on a 512MB RAM hardware.
                          Just compile and reproduce it on your PC.
                          If you show parts of a strangely designed implementation and ignore the advice you get, please don't expect this forum to be of any help.

                          Software Engineer
                          The Qt Company, Oslo

                          V 1 Reply Last reply
                          0
                          • Axel SpoerlA Axel Spoerl

                            If you have a bug, you need to debug, as @jsulm and @JonB rightfully say.
                            There is no need to run your app on a 512MB RAM hardware.
                            Just compile and reproduce it on your PC.
                            If you show parts of a strangely designed implementation and ignore the advice you get, please don't expect this forum to be of any help.

                            V Offline
                            V Offline
                            Vidya H
                            wrote last edited by
                            #14

                            @Axel-Spoerl Sure. However, I cannot run the application on the PC as there are several dependencies on the OS layers and several system calls. The issue is reproducing only on the target platform and it has happened only two times almost 3 weeks ago. Hence, I am awaiting and trying to replicate it with additional loggers added. Once I have the logs, I will share the details.

                            1 Reply Last reply
                            0
                            • Axel SpoerlA Offline
                              Axel SpoerlA Offline
                              Axel Spoerl
                              Moderators
                              wrote last edited by
                              #15

                              Just to manage expectations: The loggers will tell you what happened, not why it happened. If the application uses a static variable, the initialisation of which you won’t show, if it uses system calls and can’t be compiled on a desktop, there’s a severe architecture problem. Don’t expect more help here. Better fix the application.

                              Software Engineer
                              The Qt Company, Oslo

                              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