<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: QAwesomeness: Reflection in C++ with Qt</title>
	<atom:link href="http://timburrell.net/blog/2009-01-21/qawesomeness-reflection-in-c-with-qt/feed/" rel="self" type="application/rss+xml" />
	<link>http://timburrell.net/blog/2009-01-21/qawesomeness-reflection-in-c-with-qt/</link>
	<description>All that is Tim Burrell</description>
	<lastBuildDate>Sun, 23 Aug 2009 15:05:43 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Tim Burrell</title>
		<link>http://timburrell.net/blog/2009-01-21/qawesomeness-reflection-in-c-with-qt/comment-page-1/#comment-226</link>
		<dc:creator>Tim Burrell</dc:creator>
		<pubDate>Mon, 27 Jul 2009 11:31:35 +0000</pubDate>
		<guid isPermaLink="false">http://timburrell.net/?p=398#comment-226</guid>
		<description>You can&#039;t add functions to classes at runtime; remember this is still C++ so you must abide by the rules of static binding.  That being said, if you had no idea what class your current object was, you could still query it for its name and then read in some function names from a text file and call those functions (as strings): 
 
// get the current class&#039; meta object 
QMetaObject* meta = this-&gt;metaObject(); // emphasized &#039;this&#039; access to show this working on the current class 
QString ClassName = meta-&gt;className(); 
 
// open the file 
QFile file(ClassName + &quot;.txt&quot;); 
file.open(QIODevice::ReadOnly); 
QDataStream in(&amp;file);  // allow reading serialized data from the file 
 
QString method1, method2; 
in &gt;&gt; method1; 
in &gt;&gt; method2; 
 
// invoke the methods 
meta-&gt;invokeMethod(this, method1, Qt::DirectConnection); 
meta-&gt;invokeMethod(this, method2, Qt::DirectConnection); </description>
		<content:encoded><![CDATA[<p>You can&#039;t add functions to classes at runtime; remember this is still C++ so you must abide by the rules of static binding.  That being said, if you had no idea what class your current object was, you could still query it for its name and then read in some function names from a text file and call those functions (as strings): </p>
<p>// get the current class&#039; meta object<br />
QMetaObject* meta = this-&gt;metaObject(); // emphasized &#039;this&#039; access to show this working on the current class<br />
QString ClassName = meta-&gt;className(); </p>
<p>// open the file<br />
QFile file(ClassName + &quot;.txt&#038;quot<img src='http://timburrell.net/smilies/yahoo_wink.gif' alt='&#59;&#41;' class='wp-smiley' width='18' height='18' title='&#59;&#41;' />;<br />
file.open(QIODevice::ReadOnly);<br />
QDataStream in(&amp;file);  // allow reading serialized data from the file </p>
<p>QString method1, method2;<br />
in &gt;&gt; method1;<br />
in &gt;&gt; method2; </p>
<p>// invoke the methods<br />
meta-&gt;invokeMethod(this, method1, Qt:<img src='http://timburrell.net/smilies/yahoo_bigsmile.gif' alt='&#58;&#68;' class='wp-smiley' width='18' height='18' title='&#58;&#68;' />irectConnection);<br />
meta-&gt;invokeMethod(this, method2, Qt:<img src='http://timburrell.net/smilies/yahoo_bigsmile.gif' alt='&#58;&#68;' class='wp-smiley' width='18' height='18' title='&#58;&#68;' />irectConnection);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dat Chu</title>
		<link>http://timburrell.net/blog/2009-01-21/qawesomeness-reflection-in-c-with-qt/comment-page-1/#comment-225</link>
		<dc:creator>Dat Chu</dc:creator>
		<pubDate>Mon, 27 Jul 2009 02:45:21 +0000</pubDate>
		<guid isPermaLink="false">http://timburrell.net/?p=398#comment-225</guid>
		<description>Thanks for the article, Tim. Would you mind posting an example or two on using Qt Reflection capability to do something useful? Something as simple as: read a txt file that has the same name as the current class name, then create a method with the names given in each line of this text file. 
 
e.g. MyClass.txt contains 2 lines: &quot;getName&quot;, &quot;getTime&quot; . I want a class called MyClass with two methods getName() and getTime() now. </description>
		<content:encoded><![CDATA[<p>Thanks for the article, Tim. Would you mind posting an example or two on using Qt Reflection capability to do something useful? Something as simple as: read a txt file that has the same name as the current class name, then create a method with the names given in each line of this text file. </p>
<p>e.g. MyClass.txt contains 2 lines: &quot;getName&quot;, &quot;getTime&quot; . I want a class called MyClass with two methods getName() and getTime() now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zack</title>
		<link>http://timburrell.net/blog/2009-01-21/qawesomeness-reflection-in-c-with-qt/comment-page-1/#comment-219</link>
		<dc:creator>Zack</dc:creator>
		<pubDate>Tue, 19 May 2009 13:32:10 +0000</pubDate>
		<guid isPermaLink="false">http://timburrell.net/?p=398#comment-219</guid>
		<description>Thanks for the article Tim! 
Have been excited to start learning and working with QT and now I&#039;m even more excited :) </description>
		<content:encoded><![CDATA[<p>Thanks for the article Tim!<br />
Have been excited to start learning and working with QT and now I&#039;m even more excited <img src='http://timburrell.net/smilies/yahoo_smiley.gif' alt='&#58;&#41;' class='wp-smiley' width='18' height='18' title='&#58;&#41;' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>

