<?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[Indicator]]></title><description><![CDATA[<p dir="auto">hello there<br />
I want to make an indicator. Mean When i Push the button, a green indicator see on my panel and if stop it i sees a red indicator there. So how to do that .Tell me<br />
Thank you.</p>
]]></description><link>https://forum.qt.io/topic/70909/indicator</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 19:13:36 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/70909.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Sep 2016 05:02:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 06:48:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gauravsharma0190">@<bdi>gauravsharma0190</bdi></a> said in <a href="/post/346200">Indicator</a>:</p>
<p dir="auto">Hi<br />
When you do it in same function it dont really<br />
work as u think as it never get time to draw.</p>
<blockquote>
<p dir="auto">void mainwindow::on_start_button<br />
{<br />
QPixmap pix("/home/pi/Desktop/green.jpg")<br />
Qpixmap p("/home/pi/Desktop/red.jpg")<br />
ui-&gt;label-&gt;setPixmap(pix);  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; prepare to draw it<br />
Do some process....<br />
Here the other is still not drawn<br />
ui-&gt;label-&gt;setPixmap(p); &lt;&lt;&lt;&lt;&lt;&lt; prepare to draw this<br />
}</p>
</blockquote>
<p dir="auto">You can try to insert<br />
..<br />
ui-&gt;label-&gt;setPixmap(pix);<br />
qApp-&gt;processEvents();</p>
<p dir="auto">and it should change but would be better to with signals and slot as the other suggest.</p>
<p dir="auto"><a href="http://www.informit.com/articles/article.aspx?p=1405544&amp;seqNum=3" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.informit.com/articles/article.aspx?p=1405544&amp;seqNum=3</a></p>
<p dir="auto">Also , do not use path like<br />
/home/pi/Desktop/green.jpg<br />
As it will stop working.<br />
Use a resource file.<br />
<a href="http://www.bogotobogo.com/Qt/Qt5_Resource_Files.php" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.bogotobogo.com/Qt/Qt5_Resource_Files.php</a></p>
]]></description><link>https://forum.qt.io/post/346225</link><guid isPermaLink="true">https://forum.qt.io/post/346225</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 07 Sep 2016 06:48:51 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 06:09:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gauravsharma0190">@<bdi>gauravsharma0190</bdi></a><br />
Show me the exact code.</p>
]]></description><link>https://forum.qt.io/post/346210</link><guid isPermaLink="true">https://forum.qt.io/post/346210</guid><dc:creator><![CDATA[Ratzz]]></dc:creator><pubDate>Wed, 07 Sep 2016 06:09:11 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 06:03:45 GMT]]></title><description><![CDATA[<p dir="auto">This code works correctly.</p>
<pre><code>void MainWindow::on_startButton_clicked()
{
    ui-&gt;label-&gt;setPixmap(QPixmap(":/img/online.png"));
//do somthing...


}

void MainWindow::on_stopButton_clicked()
{
    ui-&gt;label-&gt;setPixmap(QPixmap(":/img/offline.png"));
//do somthing...
}

</code></pre>
]]></description><link>https://forum.qt.io/post/346209</link><guid isPermaLink="true">https://forum.qt.io/post/346209</guid><dc:creator><![CDATA[Kambiz]]></dc:creator><pubDate>Wed, 07 Sep 2016 06:03:45 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 05:54:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a><br />
How could i do that.<br />
i just do it like this<br />
void mainwindow::on_start_button<br />
{<br />
QPixmap pix("/home/pi/Desktop/green.jpg")<br />
Qpixmap p("/home/pi/Desktop/red.jpg")<br />
ui-&gt;label-&gt;setPixmap(pix);<br />
.......<br />
.......<br />
Do some process....<br />
....<br />
Now<br />
ui-&gt;label-&gt;setPixmap(p);<br />
}<br />
but when i push the button it won't change the label.</p>
]]></description><link>https://forum.qt.io/post/346206</link><guid isPermaLink="true">https://forum.qt.io/post/346206</guid><dc:creator><![CDATA[gauravsharma0190]]></dc:creator><pubDate>Wed, 07 Sep 2016 05:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 05:08:02 GMT]]></title><description><![CDATA[<p dir="auto">Yes i did  same as you do but it didn't work for me .<br />
i don't understand where is the problem.<br />
i take a label name as label and put it blank ...<br />
But it doesn't change the .jpg files.</p>
]]></description><link>https://forum.qt.io/post/346202</link><guid isPermaLink="true">https://forum.qt.io/post/346202</guid><dc:creator><![CDATA[gauravsharma0190]]></dc:creator><pubDate>Wed, 07 Sep 2016 05:08:02 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 05:00:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gauravsharma0190">@<bdi>gauravsharma0190</bdi></a><br />
I hope you use two pushbutton , one to start and one to stop?</p>
<pre><code>void mainwindow::on_start_button
{
QPixmap pix("/home/pi/Desktop/green.jpg")
ui-&gt;label-&gt;setPixmap(pix);
.......
.......
Do some process....
....
}

void mainwindow::on_stop_button
{
QPixmap  p("/home/pi/Desktop/red.jpg")
ui-&gt;label-&gt;setPixmap(p);
.......
Do some process....
....
}</code></pre>
]]></description><link>https://forum.qt.io/post/346201</link><guid isPermaLink="true">https://forum.qt.io/post/346201</guid><dc:creator><![CDATA[Ratzz]]></dc:creator><pubDate>Wed, 07 Sep 2016 05:00:18 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Wed, 07 Sep 2016 04:38:05 GMT]]></title><description><![CDATA[<p dir="auto">Hello sir<br />
i worte it like this<br />
void mainwindow::on_start_button<br />
{<br />
QPixmap pix("/home/pi/Desktop/green.jpg")<br />
Qpixmap p("/home/pi/Desktop/red.jpg")<br />
ui-&gt;label-&gt;setPixmap(pix);<br />
.......<br />
.......<br />
Do some process....<br />
....<br />
Now<br />
ui-&gt;label-&gt;setPixmap(p);<br />
}<br />
but when i push the button  it won't change the label.</p>
]]></description><link>https://forum.qt.io/post/346200</link><guid isPermaLink="true">https://forum.qt.io/post/346200</guid><dc:creator><![CDATA[gauravsharma0190]]></dc:creator><pubDate>Wed, 07 Sep 2016 04:38:05 GMT</pubDate></item><item><title><![CDATA[Reply to Indicator on Mon, 05 Sep 2016 07:56:39 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
You could use a QLabel and show image?<br />
Just have a red/green image and use the setPixmap of QLabel<br />
when you push buttons.</p>
]]></description><link>https://forum.qt.io/post/345806</link><guid isPermaLink="true">https://forum.qt.io/post/345806</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Mon, 05 Sep 2016 07:56:39 GMT</pubDate></item></channel></rss>