<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Before during and after...]]></title><description><![CDATA[<p dir="auto">Hi. Hope someone can help me with this.<br />
I know there are many articles out there explaining the sequence Slots and Signals are executed in, but this problem seems to be a bit different.</p>
<p dir="auto">My goal:<br />
To fully execute one set of commands before a while loop.<br />
Followed by a 10sec while loop during which I will have to repeat a second set of commands.<br />
Then execute a third set of commands.</p>
<p dir="auto">Problem:<br />
When I run the below code the delay works, but the phase1 and phase2 commands only execute after the delay.<br />
Why is this?</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/void">@<bdi>void</bdi></a> MainWindow::on_StartBtn_clicked()<br />
{<br />
ui-&gt;status_label-&gt;setText("Phase1 commands started");</p>
<pre><code>//set of commands that need to run before while loop executes.

QTime FutureTime = QTime::currentTime();
FutureTime = FutureTime.addSecs(10);

while (QTime::currentTime()&lt;= TempTime)
{
    ui-&gt;status_label-&gt;setText("Phase2 commands started");
</code></pre>
<p dir="auto">//Set of commands that need to repeat during the while loop<br />
}</p>
<pre><code>ui-&gt;status_label-&gt;setText("Phase3 commands started");

//set of things that need to execute after while loop is done
</code></pre>
<p dir="auto">}@</p>
]]></description><link>https://forum.qt.io/topic/46709/before-during-and-after</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Apr 2026 11:52:33 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/46709.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Oct 2014 13:36:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Before during and after... on Mon, 06 Oct 2014 14:22:56 GMT]]></title><description><![CDATA[<p dir="auto">Thanks... You are on the ball. It was just the UI not updating. ;)</p>
]]></description><link>https://forum.qt.io/post/246397</link><guid isPermaLink="true">https://forum.qt.io/post/246397</guid><dc:creator><![CDATA[achmed]]></dc:creator><pubDate>Mon, 06 Oct 2014 14:22:56 GMT</pubDate></item><item><title><![CDATA[Reply to Before during and after... on Mon, 06 Oct 2014 13:40:51 GMT]]></title><description><![CDATA[<p dir="auto">are you sure that the co0mmands are executed late and not just the ui is not updated?<br />
Changing the text  of a label does not directly repaint, it only triggers an update which is done in one of the next repaints. If you want to see imediate results, call ui-&gt;status_label-&gt;repaint().</p>
]]></description><link>https://forum.qt.io/post/246394</link><guid isPermaLink="true">https://forum.qt.io/post/246394</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Mon, 06 Oct 2014 13:40:51 GMT</pubDate></item></channel></rss>