<?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[Using QTimer in a Pushbutton QT C++.]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am working on a QWidget application. I want to use QTimer. I have created a timer and attached its TimeOut Signal to a slot in the constructor. Now I want to start the timer when the user clicks on Start pushbutton and stop the timer when the user clicks on stop pushbutton. But when I call the timer-&gt;start function in the pushbutton (in which I am calling a different function). qt throws an message "Timer cannot be started from another thread.", "Timer cannot be stopped in another thread."</p>
<p dir="auto">Is there any way to implement the above said functionality.</p>
<p dir="auto">Any help would be appreciated.</p>
]]></description><link>https://forum.qt.io/topic/146197/using-qtimer-in-a-pushbutton-qt-c</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 03:25:17 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/146197.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 04 Jul 2023 06:40:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using QTimer in a Pushbutton QT C++. on Thu, 06 Jul 2023 20:15:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a><br />
Hi Jon,<br />
It was wrong to address you. I meant the OP….<br />
Sorry for the confusion!<br />
Cheers<br />
Axel</p>
]]></description><link>https://forum.qt.io/post/763897</link><guid isPermaLink="true">https://forum.qt.io/post/763897</guid><dc:creator><![CDATA[Axel Spoerl]]></dc:creator><pubDate>Thu, 06 Jul 2023 20:15:38 GMT</pubDate></item><item><title><![CDATA[Reply to Using QTimer in a Pushbutton QT C++. on Thu, 06 Jul 2023 08:09:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/axel-spoerl">@<bdi>Axel-Spoerl</bdi></a><br />
Hi Axel.  Not sure why you are addressing me here?  Is there something I have not understood, or did you intend it as a suggestion to <a class="plugin-mentions-user plugin-mentions-a" href="/user/mbatra">@<bdi>mbatra</bdi></a>, the OP?</p>
]]></description><link>https://forum.qt.io/post/763803</link><guid isPermaLink="true">https://forum.qt.io/post/763803</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Thu, 06 Jul 2023 08:09:26 GMT</pubDate></item><item><title><![CDATA[Reply to Using QTimer in a Pushbutton QT C++. on Wed, 05 Jul 2023 21:59:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a><br />
You can implement a slot (or two) in an object living the the timer‘s thread, that starts/stops the timer. That slot can be invoked directly or by means of a signal connection.</p>
]]></description><link>https://forum.qt.io/post/763753</link><guid isPermaLink="true">https://forum.qt.io/post/763753</guid><dc:creator><![CDATA[Axel Spoerl]]></dc:creator><pubDate>Wed, 05 Jul 2023 21:59:51 GMT</pubDate></item><item><title><![CDATA[Reply to Using QTimer in a Pushbutton QT C++. on Wed, 05 Jul 2023 07:41:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mbatra">@<bdi>mbatra</bdi></a> said in <a href="/post/763513">Using QTimer in a Pushbutton QT C++.</a>:</p>
<blockquote>
<p dir="auto">qt throws an message "Timer cannot be started from another thread.", "Timer cannot be stopped in another thread."</p>
</blockquote>
<p dir="auto">As the message, but not your explanation, tells us, you are using multiple threads.  And you cannot start/stop a <code>QTimer</code> from a thread different from where it was created/currently lives.</p>
]]></description><link>https://forum.qt.io/post/763517</link><guid isPermaLink="true">https://forum.qt.io/post/763517</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Wed, 05 Jul 2023 07:41:37 GMT</pubDate></item></channel></rss>