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
12 Posts 3 Posters 152 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.
  • 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
      0
      • 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 1 Reply Last reply
          1
          • 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
            0
            • 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
                0
                • 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
                    0
                    • 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

                      • Login

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