Note that there are some explanatory texts on larger screens.

plurals
  1. POForcing the Qt GUI to update
    text
    copied!<p>I am coding a boardgame in Qt where, after the player makes a move, the computer AI must pause and think for some time. However, while it is thinking, it seems the screen will not be updated until every line of code has been executed. Thus, the user would click on a square, see nothing happen for a few seconds, and then suddenly see the result of both his move <em>and</em> the computer's move.</p> <p>In an attempt to fix this, I tried creating a new thread on which the AI runs its code, and then places its piece on the board. However, sometimes (and this is very inconsistent) the game crashes after the computer has made a move.</p> <p>So can you guys either:</p> <ol> <li>Tell me how force the MainWindow to update its contents</li> <li>Help me try to debug the crashing problem (I'm totally new to threads)</li> </ol> <p><strong>EDIT</strong>--I tried setting breakpoints as suszterpatt suggested, and the program seems to crash consistently in the debugger (it wasn't before I set the breakpoints).</p> <p>Anyways, as I step through the program, it seems to go through the <code>run</code> function fine, until it reaches the ending bracket, and then if I step through it jumps into line 317 on <code>qthread_win.cpp</code>, which just says</p> <pre><code>finish(arg); //line 317 return 0; </code></pre> <p>If I step through that line, the debugger freezes up and Qt alerts me after 20 seconds. If I continue, I get the "This application has requested the Runtime to terminate it in an unusual way" message that I get when the program occasionally crashes when I'm not debugging.</p> <p>What should I do now?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload