Unsolved How to access qwindow while debugging
-
Hello, I was trying to debug on my program. But I couldn't focus on the windows qt created. When I clicked that window, it just flashed and minimized in less than 1 sec. I also noticed that the window wasn't updating, still in its original form.
I tried to use show(); instead of exec(); but it wouldn't help.
What should I do?
-
@MasterBlade Can you provide more information? Do you use break points? I mean, does your app stop at a break point? Does your app work properly if you don't debug it?
-
@jsulm said in How to access qwindow while debugging:
@MasterBlade Can you provide more information? Do you use break points? I mean, does your app stop at a break point? Does your app work properly if you don't debug it?
Yes, I used break points and the program stops at a break point. The program worked all right if I don't debug it.
My problem is that, when the program stops at a break point, I can't access the program or see what's going on in it. Whenever I click the app from Windows Task Bar, it just flashed in a second and then disappeared. From Windows Preview I can see it's still in its original form (my code changed a text on a label, but the preview shows an unchanged label).
-
@MasterBlade This is normal: if your program is waiting at a breakpoint then you can't interact with it (because it is paused). To be able to interact with it (and to see the changes in the UI) you need to continue the execution (F5).
-
@jsulm said in How to access qwindow while debugging:
@MasterBlade This is normal: if your program is waiting at a breakpoint then you can't interact with it (because it is paused). To be able to interact with it (and to see the changes in the UI) you need to continue the execution (F5).
OK Got it.
Is there a function to pause the program in the middle of something to leave me some time to watch what's going on?
-
@MasterBlade sleep(10); - sleep for 10 seconds, see https://linux.die.net/man/3/sleep
-
@jsulm said in How to access qwindow while debugging:
@MasterBlade sleep(10); - sleep for 10 seconds, see https://linux.die.net/man/3/sleep
No way. I used sleep(10); but still can't open the window while it's sleeping.
-
@MasterBlade As I said: you can't expect your UI to work if you block your app. How could it work?
You can try to call http://doc.qt.io/qt-5/qcoreapplication.html#processEvents just before you call sleep(), but this is only a work around.