Solved Change state through c ++
-
-
The error is: the program has unexpectedly finished!
-
-
@mrjj
unfortunately the mistake continues !!
It is as if the program opens but it is finished! -
@Rosimar use a debugger to step through your program to find the problematic code.
-
What is the meaning of you connect statement ? Is it signal/slot or signal/signal ? I did not find correct combination at all.also show the code which u changed to handle dangling pointer as suggested by @aha_1980
-
@Rosimar said in Change state through c ++:
ChangedState *t2 = new ChangedState;
Your issue is
ChangedState *t2 = new ChangedState;You are you creating the same object inside the constructor of same object ? This calls constructor repeatedly. Just put a debug statement inside the constructor. You will see the fun.
-
estou enviando um link do projeto pra ver o que há de errado
-
As I said your program is crashing because in the constructor you are creating the same object. It get into infinite loop & finally crashes.
Can you tell me the are you creating the same object *t2 = new ChangedState; ? This is NOT required. Remove this & rest should work fine.You have register ChangeState to QML as type. Also you create the object & share it. Any idea why are you doing both
Finally what you wanted to achieve ?
-
the idea would be when touching the screen to issue a command to the c ++ side and send a signal to change that in qml!
-
Remove the objects creation in constructor and everything shud work fine. It will do what u wanted to achieve.
-
Hi Dheerendra, I did what you suggested, but the result was not what I expected! I do not know what's wrong!
-
When you clicked on the UI, did it call back-end c++ function ? Please confirm. Based on this I will tell you next steps.
-
yes when clicking the screen it calls a function in c ++ that emits a signal !!
-
In your Tela.qml replace the following line#58. Then tell me what happens.
Connections { target:ike onChangeScren: { console.log("gfrde") root.state = "tela1" } }
-
Now it worked thank God !!
Thank you so much again!!
Thank you very much!!