QPushButton not loading next screen
-
@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.@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"); } }
-
@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"); } }
@Vidya-H
All this code shows is anif
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 theMainWindow
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.
-
@Vidya-H
All this code shows is anif
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 theMainWindow
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.
-
@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.
-
@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.
@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 aboutMainWindow
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?
-
@Vidya-H Did you do any debugging to see what is happening? Maybe your state machine is wrong?
-
@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.
-
@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 aboutMainWindow
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?
-
@JonB yes. I have added debug prints and trying to replicate the issue. If the issue replicates, I will share the logs.