<?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>render fast &#187; Qt</title>
	<atom:link href="http://renderfast.com/category/qt/feed/" rel="self" type="application/rss+xml" />
	<link>http://renderfast.com</link>
	<description>A blog about developing software by trial and error by Doug Letterman</description>
	<lastBuildDate>Mon, 24 Jan 2011 17:24:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Getting PyQt4 to work on Snow Leopard</title>
		<link>http://renderfast.com/2009/11/07/getting-pyqt4-to-work-on-snow-leopard/</link>
		<comments>http://renderfast.com/2009/11/07/getting-pyqt4-to-work-on-snow-leopard/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 23:45:20 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[PyQt]]></category>

		<guid isPermaLink="false">http://renderfast.com/?p=160</guid>
		<description><![CDATA[I recently upgraded my Mac to OS 10.6 and I had to rebuild Qt and PyQt to get them working again. I installed Qt 4.5.3 from source and then installed sip 4.9.1 and PyQt4.6.1. Immediately it failed to work with the following error: >>> from PyQt4 import QtCore Traceback (most recent call last): File "", [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my Mac to OS 10.6 and I had to rebuild Qt and PyQt to get them working again. I installed Qt 4.5.3 from source and then installed sip 4.9.1 and PyQt4.6.1. Immediately it failed to work with the following error:</p>
<pre>
>>> from PyQt4 import QtCore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtCore.so, 2): Symbol not found: _sipQtConnect
  Referenced from: /Library/Python/2.6/site-packages/PyQt4/QtCore.so
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/PyQt4/QtCore.so
</pre>
<p>Some quick searching led me to <a href="http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg18971.html">this post</a>, which implied that hacking PyQt&#8217;s configure.py file to force the architecture to be 64-bit would do the trick.<br />
So where it says:</p>
<pre class="brush: python;">
for a in sipcfg.arch.split():
    if a == 'i386':
        qmake_archs.append('x86_64')
    elif a == 'x86_64':
        qmake_archs.append('x86_64')
    elif a == 'ppc':
qmake_archs.append('ppc')
</pre>
<p>Replace <tt>qmake_archs.append('x86')</tt> with <tt>qmake_archs.append('x86_64')</tt>.<br />
Now PyQt works again.</p>
]]></content:encoded>
			<wfw:commentRss>http://renderfast.com/2009/11/07/getting-pyqt4-to-work-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2D Transforms and QGraphicsScene</title>
		<link>http://renderfast.com/2008/08/18/xforms/</link>
		<comments>http://renderfast.com/2008/08/18/xforms/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 14:00:59 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[matrix]]></category>
		<category><![CDATA[PyQt]]></category>
		<category><![CDATA[QGraphicsScene]]></category>
		<category><![CDATA[transformation]]></category>
		<category><![CDATA[Xformer]]></category>

		<guid isPermaLink="false">http://renderfast.com/?p=18</guid>
		<description><![CDATA[QGraphicsScene and QGraphicsItems use the QTransform class to move, scale, shear, and rotate objects in the view. For the most part, this works great. Things get a little tricky when you want to keep track of an item&#8217;s rotation in terms of a simple angular value. QGraphicsItem doesn&#8217;t have a method to get the “rotation,” [...]]]></description>
			<content:encoded><![CDATA[<p>QGraphicsScene and QGraphicsItems use the QTransform class to move, scale, shear, and rotate objects in the view. For the most part, this works great. Things get a little tricky when you want to keep track of an item&#8217;s rotation in terms of a simple angular value. QGraphicsItem doesn&#8217;t have a method to get the “rotation,” and neither does QTransform. Instead we have to recover it from the transformation matrix.</p>
<p>The <a title="Trolltech - QTransform" href="http://doc.trolltech.com/4.3/qtransform.html#details">QTransform docs</a> tell us that a rotation is measured in the clockwise direction. Rotation by an angle ? is computed for a given point using the matrix:</p>
<p><img class="alignnone size-full wp-image-19" title="rotation_matrix" src="http://renderfast.com/wp-content/uploads/2008/07/rotation_matrix.png" alt="" width="215" height="44" /></p>
<p>How to recover the angular rotation from this matrix? One way is to apply the same matrix to a point at x=0, y=1 and use some simple trig to figure out the angle between its original and new positions.</p>
<p>Enter the excellent <a title="Wikipedia - Atan2" href="http://en.wikipedia.org/wiki/Atan2">atan2</a> function. Written in python, the math looks like this:</p>
<p><tt>rotation = 180./math.pi * math.atan2(-xform.m21(), xform.m11())</tt></p>
<p>Where <tt>xform</tt> is our QTransform object (the transformation matrix).</p>
<p><a rel="lightbox" href="http://renderfast.com/wp-content/uploads/2008/08/xformer_screenshot.png"><img class="alignleft size-medium wp-image-24" title="Xformer screenshot" src="http://renderfast.com/wp-content/uploads/2008/08/xformer_screenshot-300x223.png" alt="" width="300" height="223" /></a>I wrote a little program, “Xformer,” in PyQt that demonstrates the relationship between an object’s QTransform matrix and its corresponding transformation, rotation, scale, and shear values.</p>
<p><a href="http://renderfast.com/wp-content/uploads/2008/08/xformer.py.txt">Download Xformer</a> and try it out. It requires a working copy of PyQt4.</p>
]]></content:encoded>
			<wfw:commentRss>http://renderfast.com/2008/08/18/xforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using dynamic libraries in Mac OS X</title>
		<link>http://renderfast.com/2008/06/27/using-dynamic-libraries-in-mac-os-x/</link>
		<comments>http://renderfast.com/2008/06/27/using-dynamic-libraries-in-mac-os-x/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 15:47:36 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[dyld]]></category>
		<category><![CDATA[Qwt]]></category>

		<guid isPermaLink="false">http://renderfast.com/?p=15</guid>
		<description><![CDATA[I downloaded and built the excellent Qwt widget collection on my Mac. When I built the examples I had trouble getting them to find the libqwt dynamic library. They built and linked just fine, but unless I added the path to the qwt install dir to my DYLD_LIBRARY_PATH environment variable launching the application fails with [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-16" style="float: left;" title="A dynamic library in Xcode 3" src="http://renderfast.com/wp-content/uploads/2008/06/dylib-300x200.png" alt="" width="300" height="200" />I downloaded and built the excellent <a title="Qwt" href="http://qwt.sourceforge.net/">Qwt</a> widget collection on my Mac. When I built the examples I had trouble getting them to find the libqwt dynamic library. They built and linked just fine, but unless I added the path to the qwt install dir to my DYLD_LIBRARY_PATH environment variable launching the application fails with a <tt>dyld: Library not loaded: libqwt.5.dylib</tt> error.</p>
<p>On Linux the solution would be to add a -Wl -rpath /usr/local/qwt-5.0.2/lib to my LIBS directive in my projects&#8217;s .pro file (in this case the relevant line is in the examples/examples.pri config file). This should add the path to qwt&#8217;s dylib to my application&#8217;s runtime search path. Unfortunately this doesn&#8217;t work in Mac OS X. As it turns out, the <a title="Apple Developer docs" href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-SW13">library itself has to know its full install path</a>.</p>
<p><span id="more-15"></span></p>
<p>So far, the best webpage on this problem I&#8217;ve found so far is <a title="Dylib linking" href="http://qin.laya.com/tech_coding_help/dylib_linking.html">here</a>. It seems that Mac OS X even comes with its own utility, <a title="install_name_tool man page" href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/install_name_tool.1.html">install_name_tool</a>, to manage libraries&#8217; names if one needs to move them around.</p>
<p>I skipped install_name_tool and opted to simply rebuild Qwt&#8217;s dylib so that it knows its install_name. My solution was to modify the LDFLAGS directive in qwt&#8217;s src/Makefile so that</p>
<pre>-install_name libqwt.5.dylib</pre>
<p>Looks like this instead:</p>
<pre>-install_name /usr/local/qwt-5.0.2/lib/libqwt.5.dylib</pre>
<p>This is not the best solution as I had to modify my Makefile directly instead of the Qt .pro file. After another make and sudo make install to reinstall the dynamic library, oTool -L libqwt.5.dylib confirms that the library&#8217;s name contains its own full path:</p>
<pre>&gt; otool -L libqwt.5.dylib
libqwt.5.dylib:
/usr/local/qwt-5.0.2/lib/libqwt.5.dylib . . .</pre>
<p>More importantly, the Qwt examples all run now and I didn&#8217;t have to modify my DYLD_LIBRARY_PATH!</p>
<p>The next step is to modify the .pro file or my qmake.conf so it handles all this install_name magic automatically at compile/install time, but this worked well for now&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://renderfast.com/2008/06/27/using-dynamic-libraries-in-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordRecorder 1.0 released</title>
		<link>http://renderfast.com/2008/04/21/wordrecorder-10-released/</link>
		<comments>http://renderfast.com/2008/04/21/wordrecorder-10-released/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 05:20:11 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Audio]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[WordRecorder]]></category>

		<guid isPermaLink="false">http://dev.renderfast.com/?p=9</guid>
		<description><![CDATA[WordRecorder was a program I wrote for my friend Matt to help him record hundreds of spoken names for his video e-card site. It&#8217;s a pretty specialized program and I doubt more than a handful of people out there will actually have a need for it, but the source code may be of use to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://renderfast.com/wordrecorder/"><img class="alignleft alignnone size-medium wp-image-5" style="float: left;" title="WordRecorder" src="http://renderfast.com/wp-content/uploads/2008/04/wordrecorder_web.jpg" alt="" width="152" height="213" /></a><a title="WordRecorder" href="http://renderfast.com/wordrecorder/">WordRecorder</a> was a program I wrote for my friend <a title="Matt" href="http://mattsemel.com">Matt</a> to help him record hundreds of spoken names for his <a title="Carded" href="http://carded.tv/">video e-card site</a>. It&#8217;s a pretty specialized program and I doubt more than a handful of people out there will actually have a need for it, but the source code may be of use to people trying to figure out how to use Apple&#8217;s CoreAudio Frameworks and the Qt Interface Toolkit.</p>
<p>I&#8217;ll try to post more details about its design and how it works in the coming days. For now, visit the main <a title="WordRecorder" href="http://renderfast.com/wordrecorder/">WordRecorder page here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://renderfast.com/2008/04/21/wordrecorder-10-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode 3 doesn&#8217;t like projects generated by qmake</title>
		<link>http://renderfast.com/2008/04/20/xcode-3-doesnt-like-projects-generated-by-qmake/</link>
		<comments>http://renderfast.com/2008/04/20/xcode-3-doesnt-like-projects-generated-by-qmake/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 02:31:44 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[qmake]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://dev.renderfast.com/?p=7</guid>
		<description><![CDATA[When trying to build a Universal version of my WordRecorder app I discovered that I could not view the properties window for my executable target, the project itself, or the project&#8217;s SCM options. Xcode gave me the following lovely error: I don&#8217;t know what this is about, but through some hacking and tinkering with the [...]]]></description>
			<content:encoded><![CDATA[<p>When trying to build a Universal version of my WordRecorder app I discovered that I could not view the properties window for my executable target, the project itself, or the project&#8217;s SCM options. Xcode gave me the following lovely error:</p>
<p style="text-align: center;"><img class="alignnone size-medium wp-image-8" title="xcode_error" src="http://renderfast.com/wp-content/uploads/2008/04/xcode_error-300x218.png" alt="XCode: Internal Error" width="300" height="218" /></p>
<p>I don&#8217;t know what this is about, but through some hacking and tinkering with the Xcode file I came up with the following messy workaround:</p>
<ol>
<li>Make your Xcode project using <tt>qmake -spec macx-xcode</tt> if you haven&#8217;t already.</li>
<li>Open/reload the resulting project in XCode 3. Trying to edit the project properties will yield the above error.</li>
<li>Save the Project. This step is necessary as it makes Xcode totally reformat the file making the edit we&#8217;re about to do much easier.</li>
<li>Open the project&#8217;s “project.pbxproj” file in your text editor. It lives inside the &#8220;.xcodeproject&#8221; folder so you&#8217;ll have to do a &#8220;Show Package Contents&#8221; to see it in the Finder.</li>
<li>Find the following comment (&#8220;hello_world&#8221; will be the name of your own target)
<pre>/* Build configuration list for PBXNativeTarget "hello_world" */</pre>
</li>
<li>Beneath this comment you&#8217;ll see the following list of build configurations (the actual IDs will be different):
<pre>isa = XCConfigurationList;
buildConfigurations = (
2F9BD7250DBC2F9500BBEE4F /* Debug */,
2F9BD7260DBC2F9500BBEE4F /* Release */,
2F9BD7270DBC2F9500BBEE4F /* Default */,
);</pre>
</li>
<li>Remove the <em>entire line</em> containing the identifier with the name &#8216;Default&#8217; and save the file. The result will look like this:
<pre>isa = XCConfigurationList;
buildConfigurations = (
2F9BD7250DBC2F9500BBEE4F /* Debug */,
2F9BD7260DBC2F9500BBEE4F /* Release */,
);</pre>
</li>
<li>Go back to Xcode. It should prompt you to reload the project from disk. Reload it. You should now be able to edit your project&#8217;s properties again. Unfortunately you will have to repeat this step whenever you rebuild your project using qmake.</li>
</ol>
<p>I don&#8217;t know why this fix works, but it beats having to recreate our Xcode project by hand, and everything still seems to build without incident after the fix.</p>
<p>I&#8217;m not sure if this is Apple or Trolltech&#8217;s problem as I can&#8217;t remember if this worked in Qt 4.3.3 / Xcode 2. Xcode 3 probably isn&#8217;t officially supported by qmake yet, anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://renderfast.com/2008/04/20/xcode-3-doesnt-like-projects-generated-by-qmake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

