﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; qthread</title>
	<atom:link href="https://www.softwareace.cn/?feed=rss2&#038;tag=qthread" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>qthread  slot</title>
		<link>https://www.softwareace.cn/?p=50</link>
		<comments>https://www.softwareace.cn/?p=50#comments</comments>
		<pubDate>Tue, 15 Jan 2013 07:42:17 +0000</pubDate>
		<dc:creator><![CDATA[littlesu]]></dc:creator>
				<category><![CDATA[开发经验]]></category>
		<category><![CDATA[qthread]]></category>

		<guid isPermaLink="false">http://192.168.0.106/?p=50</guid>
		<description><![CDATA[[crayon-69e43e302239f382018137/]]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">#include &amp;lt;QtCore/QCoreApplication&amp;gt;  
#include &amp;lt;QtCore/QObject&amp;gt;  
#include &amp;lt;QtCore/QThread&amp;gt;  
#include &amp;lt;QtCore/QDebug&amp;gt;   
class Dummy :public QObject
{      
         Q_OBJECT  
public:     Dummy (QObject* parent=0):QObject (parent)     {}  
public slots :    
         void emitsig ()    
        {       
                 emit sig ();      
        }
signals :    
         void sig ();
};  

class Object :public QObject
{      
         Q_OBJECT  
public:
         Object(){}
public slots :
         void slot ()
        {   
                 qDebug()&amp;lt;&amp;lt;&amp;quot;from thread slot:&amp;quot; &amp;lt;&amp;lt;QThread:: currentThreadId();      
        }  
};   
#include &amp;quot;main.moc&amp;quot;
int main (int argc, char *argv[])
{     
         QCoreApplication a (argc, argv);      
         qDebug()&amp;lt;&amp;lt;&amp;quot;main thread:&amp;quot;&amp;lt;&amp;lt;QThread:: currentThreadId();     
         QThread thread ;      
         Object obj ;      
         Dummy dummy ;      
         obj.moveToThread (&amp;amp;thread);     
         QObject::connect (&amp;amp;dummy, SIGNAL(sig ()), &amp;amp;obj, SLOT(slot ()));     
         thread.start ();      
         dummy.emitsig ();      
         return a .exec();
}</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=50</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
