<?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[how to make the progress bar run smoothly]]></title><description><![CDATA[<p dir="auto">how do you make the progress bar run smoothly, I mean smooth is if the initial value is 0 then the process value jumps to 50 the progress bar runs from 0 to 50 smoothly instead of jumping directly from 0 to 50, I hope you understand, this is an example of code from C# that makes the progress bar smooth, this is not a thread problem but how to make the progress bar run smoothly</p>
<pre><code>private void SetProgressBarPosition(ProgressBar progressBar, int position)
{
	bool invokeRequired = progressBar.InvokeRequired;
	if (invokeRequired)
	{
		FormMain.SetProgressBarPositionCallBack method = new FormMain.SetProgressBarPositionCallBack(this.SetProgressBarPosition);
		progressBar.Invoke(method, new object[]
	{
		progressBar,
		position
	});
	}
	else
	{
		progressBar.Value = position;
	}
}
</code></pre>
]]></description><link>https://forum.qt.io/topic/157200/how-to-make-the-progress-bar-run-smoothly</link><generator>RSS for Node</generator><lastBuildDate>Fri, 08 May 2026 19:36:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/157200.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Jun 2024 12:10:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 13:36:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a> said in <a href="/post/802477">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">Tidak ada yang tahu apa yang ada dalam pikiran Anda ketika Anda menunjukkan kode C# dan mengatakan Anda ingin bilah kemajuan Anda "berjalan lancar" ;-)</p>
</blockquote>
<p dir="auto">I find it hard to explain because I don't know much about Qt.</p>
]]></description><link>https://forum.qt.io/post/802479</link><guid isPermaLink="true">https://forum.qt.io/post/802479</guid><dc:creator><![CDATA[Blackzero]]></dc:creator><pubDate>Wed, 12 Jun 2024 13:36:24 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 12:20:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> said in <a href="/post/802441">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">okay I have found a way, yes it uses QPropertyAnimation</p>
</blockquote>
<p dir="auto">The whole guessing could have been avoided if you have said that you are looking for an animated <code>QProgressBar</code>.<br />
Nobody knew what you had in mind when you were showing the C# code and said you want your progress bar to "run smoothly" ;-)</p>
]]></description><link>https://forum.qt.io/post/802477</link><guid isPermaLink="true">https://forum.qt.io/post/802477</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Wed, 12 Jun 2024 12:20:14 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 12:10:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a> OIC, I didn't look closely (at <code>value</code>), yes, you are right.  I won't delete but I will strike out my post.</p>
]]></description><link>https://forum.qt.io/post/802476</link><guid isPermaLink="true">https://forum.qt.io/post/802476</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 12 Jun 2024 12:10:16 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 11:57:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/802460">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">empty to full in precisely 1 second without any input/messages</p>
</blockquote>
<p dir="auto">If <a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> code works as expected, the animated bar will start from current value and end on the value which is passed to the function. So not 0 -100% every time?!</p>
]]></description><link>https://forum.qt.io/post/802474</link><guid isPermaLink="true">https://forum.qt.io/post/802474</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Wed, 12 Jun 2024 11:57:22 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 12:10:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a><br />
<s>So by using this it moves from empty to full in precisely 1 second without any input/messages about the progress of whatever it is supposed to track (such as progress in a computation or whatever).  So it isn't a "progress" bar any more, it's just an animation, didn't know that is what you really wanted.</s></p>
]]></description><link>https://forum.qt.io/post/802460</link><guid isPermaLink="true">https://forum.qt.io/post/802460</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 12 Jun 2024 12:10:33 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 04:41:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a> said in <a href="/post/802433">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">Sorry no I dont. The QProgressBar does not "run". You have to control the progress yourself. There is no animation or something like that by default, so that you see a "flow".<br />
After some progress is done, you have to update the bar (and set/increase the value).</p>
</blockquote>
<p dir="auto">okay I have found a way, yes it uses QPropertyAnimation</p>
<pre><code>void MainWindow::UpdateProgresBar(int value)
{
    QPropertyAnimation *animation = new QPropertyAnimation(ui-&gt;progressBar, "value");
    animation-&gt;setDuration(1000); 
    animation-&gt;setStartValue(ui-&gt;progressBar-&gt;value());
    animation-&gt;setEndValue(value);
    animation-&gt;setEasingCurve(QEasingCurve::Linear); 
    animation-&gt;start(QAbstractAnimation::DeleteWhenStopped);
}
</code></pre>
]]></description><link>https://forum.qt.io/post/802441</link><guid isPermaLink="true">https://forum.qt.io/post/802441</guid><dc:creator><![CDATA[Blackzero]]></dc:creator><pubDate>Wed, 12 Jun 2024 04:41:25 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Wed, 12 Jun 2024 11:54:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a></p>
<p dir="auto">You still did not mention if you are talking about <code>QProgressBar</code> and C++ code.<br />
Why the WinForms C# example?</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> said in <a href="/post/802408">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">how can I make the progressbar run like a normal process even though the value jumps from 0 to 30 or 50<br />
I hope you understand what I mean with this confusing question</p>
</blockquote>
<p dir="auto">Sorry no I dont. The <code>QProgressBar</code> does not "run". You have to control the progress yourself. There is no animation or something like that by default, so that you see a "flow".<br />
After some progress is done, you have to update the bar (and set/increase the value).</p>
]]></description><link>https://forum.qt.io/post/802433</link><guid isPermaLink="true">https://forum.qt.io/post/802433</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Wed, 12 Jun 2024 11:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 18:53:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a> said in <a href="/post/802379">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">Hubungkan sinyal dari tugas "pekerjaan" non-pemblokiran Anda ke QProgressBar::setValue(int).<br />
Jika tugas yang statusnya diwakili oleh bilah kemajuan memblokir dan membuka blokir pada 50% terlebih dahulu, Anda akan melihat lompatan tersebut.<br />
(Dan juga, jika Anda tidak mengalami kemajuan dan tiba-tiba menetapkan nilai 50... bilah kemajuan akan langsung berubah dari 0 menjadi 50)</p>
<p dir="auto">Katakanlah Anda memiliki seorang pekerja dengan tugas komputasi yang intens</p>
</blockquote>
<p dir="auto">I use multi-threading and there is no problem with threads but my process adjusts the transfer speed why the value is sometimes not arranged from 1 to 100 so how can I make the progressbar run like a normal process even though the value jumps from 0 to 30 or 50, I hope you understand what I mean with this confusing question</p>
]]></description><link>https://forum.qt.io/post/802408</link><guid isPermaLink="true">https://forum.qt.io/post/802408</guid><dc:creator><![CDATA[Blackzero]]></dc:creator><pubDate>Tue, 11 Jun 2024 18:53:28 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 15:12:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> I think this:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> said in <a href="/post/802363">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">progressBar.Value = position;</p>
</blockquote>
<p dir="auto">equals this</p>
<ul>
<li><a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.progressbar.value" target="_blank" rel="noopener noreferrer nofollow ugc">https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.progressbar.value</a></li>
</ul>
<p dir="auto">I guess... but... whatever... no idea. That's the reason why one should create understandable topics and ask clear questions...</p>
<p dir="auto">¯\_(ツ)_/¯</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/802384">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">else he wouldn't have even come across it.... I think :)</p>
</blockquote>
<p dir="auto">Port existing C# WinForms App to Qt and C++?!<br />
Found working C# snippet online, but no idea how to translate this to C++...<br />
Many reasons ;-)</p>
<p dir="auto">You see people asking "I have this Python code. What is this in C++?" on StackOverflow regularly...<br />
Understandable that so many people are annoyed there. ;-)</p>
<p dir="auto">But back to the topic :)<br />
Only <a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> can answer all this, everything else is just guesswork :)</p>
]]></description><link>https://forum.qt.io/post/802385</link><guid isPermaLink="true">https://forum.qt.io/post/802385</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Tue, 11 Jun 2024 15:12:44 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 14:55:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a><br />
Not my understanding.  The only reason for him showing <code>SetProgressBarPosition()</code> as C# code is if he is using the C# bindings for Qt, else he wouldn't have even come across it....  I think :)</p>
]]></description><link>https://forum.qt.io/post/802384</link><guid isPermaLink="true">https://forum.qt.io/post/802384</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 11 Jun 2024 14:55:34 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 14:56:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/802381">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">Yep, except all this needs writing for C#</p>
</blockquote>
<p dir="auto">I think <a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> just wanted to refer to the C# snippet he is familiar with and where everything works as expected.<br />
Now he wants to know how to do this in C++ with <code>QProgressBar</code>?!<br />
But maybe I'm wrong.<br />
The code above is WinForms C# code... no Qt involved there...</p>
]]></description><link>https://forum.qt.io/post/802382</link><guid isPermaLink="true">https://forum.qt.io/post/802382</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Tue, 11 Jun 2024 14:56:28 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 14:47:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a><br />
Yep, except all this needs writing for C#, where I don't even know if/how they have <code>emit</code>, <code>connect()</code>, threads, etc. :)</p>
]]></description><link>https://forum.qt.io/post/802381</link><guid isPermaLink="true">https://forum.qt.io/post/802381</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 11 Jun 2024 14:47:50 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 14:43:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a> said in <a href="/post/802363">how to make the progress bar run smoothly</a>:</p>
<blockquote>
<p dir="auto">how do you make the progress bar run smoothly</p>
</blockquote>
<p dir="auto">Simple:</p>
<p dir="auto">Connect a signal from your non-blocking "work" task to <code>QProgressBar::setValue(int)</code>.<br />
If the task whose status is represented by the progressbar is blocking and unblocks at 50% first, you will see that jump.<br />
( And also, if you have no progress and suddenly set a value of 50... the progress bar will go from 0 to 50 instantly )</p>
<p dir="auto">Say you have a worker with some intense computing task</p>
<pre><code>// #####################
// Worker class in different thread
for ( int i = 0; i &lt; 100; ++i ) {
   QThread::sleep(1); // simulate 1s of "work"
   int progress = i;
   emit progressDone(progress); 
}
// ####################


// #######################
// MainWindow where ProgressBar is

QProgressBar *progressBar = new QProgressBar(this);
progressBar-&gt;setRange(0, 100);
Worker w;
// worker setup here
// ...
connect (&amp;w, &amp;Worker::progressDone, this, [=](int progress)
                         { progressBar-&gt;setValue(progress); });


</code></pre>
<p dir="auto">This whole thing also works without any worker thread... if you want to update your bar, just use <code>progressBar-&gt;setValue(progress)</code> to set your progress value. Then you have that "jump" again.</p>
<p dir="auto">See also the <code>QProgressDialog</code> documentation:</p>
<ul>
<li><a href="https://doc.qt.io/qt-6/qprogressdialog.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qprogressdialog.html#details</a></li>
</ul>
<p dir="auto">There is shown how to update the bar and show the actual progress of some task.</p>
]]></description><link>https://forum.qt.io/post/802379</link><guid isPermaLink="true">https://forum.qt.io/post/802379</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Tue, 11 Jun 2024 14:43:32 GMT</pubDate></item><item><title><![CDATA[Reply to how to make the progress bar run smoothly on Tue, 11 Jun 2024 12:31:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/blackzero">@<bdi>Blackzero</bdi></a><br />
We can't say anything from this code.  What range does <code>position</code> take, how often do you call it with what values, does it make any difference whether <code>invokeRequired</code> is true or false, do you run this in a different thread from the main thread, ... ?  The progressbar does "run smoothly" if you set its value correctly and over time.  Try it in C++ or Python.</p>
]]></description><link>https://forum.qt.io/post/802367</link><guid isPermaLink="true">https://forum.qt.io/post/802367</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 11 Jun 2024 12:31:41 GMT</pubDate></item></channel></rss>