<?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[Converting QDialog objects to void&#x2F;Threading with Qt]]></title><description><![CDATA[<p dir="auto">I first tried the usual threading solutions using std::thread and CreateThread, but I ran into the same issue twice with them. I can not cast in any form I've tried my QDialog class to void or LPTHREADSTARTROUTINE to be used.</p>
<p dir="auto">What I am trying to do:</p>
<pre><code>void mydialog::function()
{
  qDebug("Thread");
  Sleep(5000);
}
void mydialog::on_go_clicked()
{
  startinnewthread(function);
}
</code></pre>
<p dir="auto">When I try to just call function() the Sleep() freezes my UI (As Expected), but my usual way around this is to run it in a new thread so the UI doesn't freeze, but I can't figure out how to do this with Qt.<br />
I tried QThreads, but the multiple things I tried did not work and seemed a bit confusing and not able to simply run a function in a separate thread.</p>
]]></description><link>https://forum.qt.io/topic/82910/converting-qdialog-objects-to-void-threading-with-qt</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 07:38:37 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/82910.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 03 Sep 2017 06:30:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Converting QDialog objects to void&#x2F;Threading with Qt on Sun, 03 Sep 2017 10:21:26 GMT]]></title><description><![CDATA[<p dir="auto">If you want a function to be run in a seperate thread you should use QtConcurrent: <a href="http://doc.qt.io/qt-5/qtconcurrentrun.html#running-a-function-in-a-separate-thread" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qtconcurrentrun.html#running-a-function-in-a-separate-thread</a></p>
<pre><code>QtConcurrent::run(this, &amp;mydialog::function, optional_arg);
</code></pre>
]]></description><link>https://forum.qt.io/post/413390</link><guid isPermaLink="true">https://forum.qt.io/post/413390</guid><dc:creator><![CDATA[bludger]]></dc:creator><pubDate>Sun, 03 Sep 2017 10:21:26 GMT</pubDate></item></channel></rss>