<?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[Help on C++ GUI programming]]></title><description><![CDATA[<p dir="auto">Hi All,</p>
<p dir="auto">Am new to this QT Creator. Trying to write the programs. Where can i get Basic Example programs.. Am stuck in Pushbutton program i don't know how to proceed..<br />
Kindly help on this...</p>
<p dir="auto">Program is when you press the button then it should display(LED ON)<br />
if you press the button again then it should display(LED OFF)</p>
<p dir="auto">Program is here:<br />
@<br />
void MainWindow::PushButtonHandler1()<br />
{<br />
ui-&gt;label1-&gt;setText("LED1 ON");<br />
}<br />
@<br />
when i click the button LED1 ON text is displayed.<br />
If i click the button second time i want the output LED1 OFF to be displayed.<br />
How to use if condition, what all parameters i should set ??</p>
<p dir="auto">[edit, code tags added, koahnig]</p>
]]></description><link>https://forum.qt.io/topic/18875/help-on-c-gui-programming</link><generator>RSS for Node</generator><lastBuildDate>Wed, 20 May 2026 08:22:52 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/18875.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Aug 2012 10:13:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help on C++ GUI programming on Mon, 06 Aug 2012 12:13:06 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Nirmala" date="1344252487"]Hello Andre,</p>
<p dir="auto">Thank you for the suggestions...i will try to adopt these methods..<br />
[/quote]<br />
You're welcome.</p>
<p dir="auto">[quote]If i want to communicate with the hardware how can i Transmit and/or Receive data(Ex. establishing Bluetooth communication) [/quote]<br />
Please ask new questions in new topics. However, have a look at "Qt Mobility Connectivity":<a href="http://doc.qt.nokia.com/qtmobility/connectivity-api.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/qtmobility/connectivity-api.html</a> for starters.</p>
]]></description><link>https://forum.qt.io/post/146683</link><guid isPermaLink="true">https://forum.qt.io/post/146683</guid><dc:creator><![CDATA[andre]]></dc:creator><pubDate>Mon, 06 Aug 2012 12:13:06 GMT</pubDate></item><item><title><![CDATA[Reply to Help on C++ GUI programming on Mon, 06 Aug 2012 11:28:07 GMT]]></title><description><![CDATA[<p dir="auto">Hello Andre,</p>
<p dir="auto">Thank you for the suggestions...i will try to adopt these methods..</p>
<p dir="auto">If i want to communicate with the hardware how can i Transmit and/or Receive data(Ex. establishing Bluetooth communication)</p>
]]></description><link>https://forum.qt.io/post/146675</link><guid isPermaLink="true">https://forum.qt.io/post/146675</guid><dc:creator><![CDATA[Nirmala]]></dc:creator><pubDate>Mon, 06 Aug 2012 11:28:07 GMT</pubDate></item><item><title><![CDATA[Reply to Help on C++ GUI programming on Mon, 06 Aug 2012 10:58:08 GMT]]></title><description><![CDATA[<p dir="auto">While it works, I would recommend that you <em>don't</em> get into the habbit of using GUI elements like labels to store application state. Instead, store the state elsewhere, like in a member variable. Yes, it will look a bit more complicated now, but it is a good habbit to get into. Also, it would be good to as much as makes sense give methods names that refer to what they <em>do</em>, instead of to what <em>triggers</em> them. You might want to add a second trigger later for the same action, and then you're stuck with a method name that doesn't fit anymore.</p>
<p dir="auto">So, I would suggest:<br />
@<br />
//in header:<br />
private:<br />
bool m_led1On;</p>
<p dir="auto">//in source:<br />
void MainWindow::toggleButton() {<br />
m_led1On = !m_led1On; //toggle led</p>
<p dir="auto">if (m_led1On) {<br />
ui-&gt;label1-&gt;setText("LED1 ON");<br />
} else {<br />
ui-&gt;label1-&gt;setText("LED1 OFF");<br />
}</p>
<p dir="auto">//this would do the same:<br />
// ui-&gt;label1-&gt;setText(m_led1On ? "LED1 ON" : "LED1 OFF");<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/146667</link><guid isPermaLink="true">https://forum.qt.io/post/146667</guid><dc:creator><![CDATA[andre]]></dc:creator><pubDate>Mon, 06 Aug 2012 10:58:08 GMT</pubDate></item><item><title><![CDATA[Reply to Help on C++ GUI programming on Mon, 06 Aug 2012 10:44:41 GMT]]></title><description><![CDATA[<p dir="auto">Hi AcerExtensa,</p>
<p dir="auto">Thank you so much for the code its working as requied..</p>
<p dir="auto">Where can i get Example codes..</p>
]]></description><link>https://forum.qt.io/post/146666</link><guid isPermaLink="true">https://forum.qt.io/post/146666</guid><dc:creator><![CDATA[Nirmala]]></dc:creator><pubDate>Mon, 06 Aug 2012 10:44:41 GMT</pubDate></item><item><title><![CDATA[Reply to Help on C++ GUI programming on Mon, 06 Aug 2012 10:15:49 GMT]]></title><description><![CDATA[<p dir="auto">simply check the text of the button:<br />
@<br />
void MainWindow::PushButtonHandler1()<br />
{<br />
if(ui-&gt;label1-&gt;text() == “LED1 ON”)<br />
{<br />
ui-&gt;label1-&gt;setText(“LED1 OFF”);<br />
return;<br />
}<br />
ui-&gt;label1-&gt;setText(“LED1 ON”);<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/146661</link><guid isPermaLink="true">https://forum.qt.io/post/146661</guid><dc:creator><![CDATA[AcerExtensa]]></dc:creator><pubDate>Mon, 06 Aug 2012 10:15:49 GMT</pubDate></item></channel></rss>