<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Who Says Penguins Can&#039;t Fly? &#187; The Road to KDE Devland</title>
	<atom:link href="http://hanschen.org/category/the-road-to-kde-devland/feed/" rel="self" type="application/rss+xml" />
	<link>http://hanschen.org</link>
	<description></description>
	<lastBuildDate>Mon, 17 May 2010 20:42:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hanschen.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/3c5596b91b62a09f9977c99bf4a6a40b?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Who Says Penguins Can&#039;t Fly? &#187; The Road to KDE Devland</title>
		<link>http://hanschen.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hanschen.org/osd.xml" title="Who Says Penguins Can&#039;t Fly?" />
	<atom:link rel='hub' href='http://hanschen.org/?pushpress=hub'/>
		<item>
		<title>The Road to KDE Devland &#8211; step 5</title>
		<link>http://hanschen.org/2010/01/01/the-road-to-kde-devland-step-5/</link>
		<comments>http://hanschen.org/2010/01/01/the-road-to-kde-devland-step-5/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 15:00:23 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[PlanetKDE]]></category>
		<category><![CDATA[The Road to KDE Devland]]></category>

		<guid isPermaLink="false">http://hanswchen.wordpress.com/?p=1143</guid>
		<description><![CDATA[Are you still with me? I&#8217;ve taken a long break from The Road for some time, but fear not, I haven&#8217;t forgotten about my initial goal. But since it&#8217;s been so long, maybe you have? Let&#8217;s start this step with a short recap: Step 0 &#8211; At the beginning of the summer 2009, I started [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=1143&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/"><img class="size-full wp-image-364 alignleft" title="The Road to KDE Devland" src="http://hanswchen.files.wordpress.com/2009/07/logo.png?w=138" alt="logo" width="138" /></a></p>
<p style="text-align:center;">
<h1>Are you still with me?</h1>
<p>I&#8217;ve taken a long break from <a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/">The Road</a> for some time, but fear not, I haven&#8217;t forgotten about my initial goal. But since it&#8217;s been so long, maybe you have? Let&#8217;s start this step with a short recap:</p>
<ul>
<li><a href="http://hanswchen.wordpress.com/2009/07/13/road-to-kde-devland-step-0/">Step 0</a> &#8211; At the beginning of the summer 2009, I started my journey to &#8220;KDE Devland&#8221; to become a KDE developer. By sharing my experiences I hoped that I could motivate others to do the same, and leave behind useful tips for those who wanted to walk the same path. The first step was mostly an introduction.</li>
<li><a href="http://hanswchen.wordpress.com/2009/07/19/the-road-to-kde-devland-step-1/">Step 1</a> &#8211; Before going on a journey, you should be prepared. In this step I shared useful links for soon-to-be developers and wrote about my plan and which books I would use.</li>
<li><a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%e2%80%93-step-2/">Step 2</a> &#8211; I started with C++. This post went through pointers, something I found hard to understand in the beginning.</li>
<li><a href="http://hanswchen.wordpress.com/2009/08/02/the-road-to-kde-devland-step-3/">Step 3</a> &#8211; Talking about my temporary workspace and which applications I use to write the code.</li>
<li><a href="http://hanswchen.wordpress.com/2009/09/14/the-road-to-kde-devland-step-4/">Step 4</a> &#8211; At this point I finally had some screenshots to show. In this step I showed my achievements after the summer and wrote a little bit about Qt programming.</li>
</ul>
<p>I feel fairly comfortable with Qt now, and try to learn some specific parts of the toolkit when I find the time and motivation. Right now I&#8217;m struggling with the <a href="http://qt.nokia.com/doc/qt4-interview.html">Interview framework</a> &#8211; I think I understand the theory behind it, but I need to get a feeling for how to actually use it.</p>
<p>In this step I&#8217;ll show you some of my own applications I&#8217;ve done to familiarize myself with Qt. If you still remember the last step you&#8217;ll recognize some of them, however they&#8217;re actually all made from scratch. First one out is the smallest application, but also the one giving me the most trouble.</p>
<p><span id="more-1143"></span></p>
<h2>TextSync</h2>
<h3>Description</h3>
<p>TextSync is an extremely simple text editor. Rather than loading and saving text files, it &#8220;syncs&#8221; to a user-defined text file (from now on referred to as the <em>original file</em>; <em>synced text</em> is the text shown in the application):</p>
<ul>
<li>Original file modified &#8211; TextSync reloads the synced text</li>
<li>Synced text modified &#8211; TextSync saves the new text to the original file</li>
</ul>
<div id="attachment_1163" class="wp-caption aligncenter" style="width: 296px"><a href="http://hanswchen.files.wordpress.com/2009/12/textsync.png"><img class="size-full wp-image-1163" title="TextSync" src="http://hanswchen.files.wordpress.com/2009/12/textsync.png?w=286&#038;h=274" alt="" width="286" height="274" /></a><p class="wp-caption-text">TextSync in all its glory</p></div>
<p>The idea is to make a plasmoid version of TextSync. It would behave pretty much like the Notes widget in the sense that you don&#8217;t have to think about saving and loading the text, but with additional benefits:</p>
<ul>
<li>You know where the text is saved and can easily make backups, for example</li>
<li>TextSync can be used to display logs by pointing it to a log file and set it to read-only</li>
<li>You can easily sync text across computers with services like <a title="Dropbox" href="https://www.dropbox.com/">Dropbox</a>. This combination will let you use TextSync as a synced Notes widget, or you can turn it into a basic chat widget by sharing the synced file with a friend</li>
</ul>
<p>I want to stress, however, that TextSync is not meant to be used as a collaborative tool.</p>
<p>By the way, TextSync is just a semi-temporary name, like the names of the other applications &#8211; I might rename it sometime in the future if I find a better name. Maybe &#8220;TextView&#8221;, similar to the FolderView widget?</p>
<h3>What&#8217;s next</h3>
<p>There are still some things I need to iron out before porting it to Plasma. For example I currently use <a href="http://doc.trolltech.com/qfilesystemwatcher.html"><code>QFileSystemWatcher</code></a> to monitor the source file, but I don&#8217;t know if it&#8217;s a good idea performance-wise.</p>
<p>Also, TextSync only saves the text every <em>n</em> second (currently set to 5) when the synced text is modified to avoid excessive write to disc, so I have to decide how to handle the following two situations:</p>
<ul>
<li>Synced text modified (unsaved), original file modified &#8211; At the moment TextSync simply reloads the source file, discarding any changes you&#8217;ve made during the last 5 seconds</li>
<li>Original file modified (not loaded), synced text modified &#8211; This is less likely due to the use of <code>QFileSystemWatcher</code>, but can still happen</li>
</ul>
<p>I want to avoid using dialogs &#8211; the user shouldn&#8217;t be aware of the whole loading/saving mechanism. I&#8217;ve been thinking about using something like <a href="http://en.wikipedia.org/wiki/Diff">diff</a> to merge the two texts, but I&#8217;m not sure about this approach yet; even if I was, I don&#8217;t know how to implement it.</p>
<p>The easiest solution would be to do what TextSync currently does &#8211; discard any changes made in one of the texts, preferable the synced text.</p>
<h3>What I learned</h3>
<p>TextSync proved to be good lecture on how to structure your classes. In the beginning I had everything in two classes, <code>TextSync</code> for the main application and <code>SettingsDialog</code> for the settings.</p>
<p>Soon I found that <code>QFileSystemWatcher</code> wasn&#8217;t flawless. When I modified the source file with vim, it would stop monitoring the file &#8211; the next time the original file was modified, TextSync wouldn&#8217;t reload it. To workaround this, I had to readd the path whenever <code>QFileSystemWatcher</code> noticed that the file had been changed. This was not as easy as it may sound, as it didn&#8217;t work to simply add it immediately.</p>
<p>This extra code didn&#8217;t really belong to the main application, so I moved it to its own class, <code>FileWatcher</code>. Now TextSync can use the new class in a very similar way to <code>QFileSystemWatcher</code>, and it doesn&#8217;t have to know that <code>FileWatcher</code> attempts to readd the path.</p>
<p>I&#8217;m in the progress of doing a similar thing with the loading/saving functions &#8211; move everything to a separate class. Since these functions are tightly connected to the <code>QTextEdit</code> widget (the text box), it makes sense to derive the new class from <code>QTextEdit</code> and add the extra loading/saving functionality to it.</p>
<h2>GridView</h2>
<h3>Description</h3>
<p>GridView is a reimplementation of the spreadsheet application I did in the <a href="http://hanswchen.wordpress.com/2009/09/14/the-road-to-kde-devland-step-4/">previous step</a>. As I wrote back then, I found the spreadsheet example far from easy &#8211; by making a similar application myself, I hoped I would understand some parts I didn&#8217;t before.</p>
<p>As the name implies, GridView is meant to view grid files (<code>*.grd</code>). In a previous summer job I worked a lot with these files, so I thought it would be nice to make an application to view and edit grid files.</p>
<div id="attachment_1169" class="wp-caption aligncenter" style="width: 310px"><a href="http://hanswchen.files.wordpress.com/2009/12/gridview.png"><img class="size-medium wp-image-1169" title="GridView" src="http://hanswchen.files.wordpress.com/2009/12/gridview.png?w=300&#038;h=234" alt="" width="300" height="234" /></a><p class="wp-caption-text">GridView displaying a small 4x4 grid</p></div>
<p>The files themselves are very easy to read, the grid above looks like this:</p>
<blockquote>
<pre>DSAA
4 4
0 4
0 4
1.8 9.9
7.5 6.3 2.0 0.7
9.9 5.8 1.8 3.0
8.2 5.7 8.6 7.4
7.6 4.4 4.2 2.3</pre>
</blockquote>
<h3>What&#8217;s next</h3>
<p>For now, GridView is mostly an empty shell &#8211; most functionalities need to be implemented. The UI was made with Qt Designer in contrast to the spreadsheet application, which was mostly made in a text editor.</p>
<p>This is mostly a test application, something I won&#8217;t spend time to improve and polish. Once I&#8217;ve added the features I want, I&#8217;ll leave it at that. But I&#8217;m sure it&#8217;ll be useful as reference for future applications.</p>
<h3>What I learned</h3>
<p>Not much yet. Since the application isn&#8217;t really needed, I don&#8217;t feel much motivation to work on GridView. When I&#8217;m back home again I&#8217;ll look at the source code of the spreadsheet application again and add some basic features to GridView.</p>
<h2>Quiz!</h2>
<h3>Description</h3>
<p>So I only planned to do two applications for this step. But one day when I was generating random dates &#8220;manually&#8221; (with a random number generator) I realized, &#8220;Hey I can make an application to do the hard work instead&#8221;. And thus Quiz! (I couldn&#8217;t find a good name &#8211; the current one is inspired by <a href="http://qalculate.sourceforge.net/">Qalculate!</a>) was born.</p>
<div id="attachment_1174" class="wp-caption aligncenter" style="width: 229px"><a href="http://hanswchen.files.wordpress.com/2009/12/quiz.png"><img class="size-medium wp-image-1174" title="Quiz!" src="http://hanswchen.files.wordpress.com/2009/12/quiz.png?w=219&#038;h=300" alt="" width="219" height="300" /></a><p class="wp-caption-text">Quiz? No, Quiz!</p></div>
<p>Now I don&#8217;t have to check if my answers are correct in a calendar either, since Quiz! does it for me. Quite a handy little application.</p>
<p>Quiz! can be used for other questions as well &#8211; you just have to derive from <code>AbstractQuestionGenerator</code> and implement the <code>generate()</code> function. I&#8217;ve only made two question generators so far, the one shown above and one for a math quiz:</p>
<div id="attachment_1175" class="wp-caption aligncenter" style="width: 220px"><a href="http://hanswchen.files.wordpress.com/2009/12/mathquiz.png"><img class="size-medium wp-image-1175" title="Math quiz" src="http://hanswchen.files.wordpress.com/2009/12/mathquiz.png?w=210&#038;h=300" alt="" width="210" height="300" /></a><p class="wp-caption-text">A different question generator</p></div>
<p>As you can see, I also played around with HTML in <code>QTextBrowser</code>.</p>
<h3>What&#8217;s next</h3>
<p>The application works fine for me now, and since I don&#8217;t plan to release it, I don&#8217;t think I&#8217;ll work on it much more. For now you have to change a line in the source code and recompile to switch question generator. It should be very easy to add a feature to change it at run time, however.</p>
<p>Right now the date quiz only asks for dates in 2009, but I have to change it to 2010 now. When I&#8217;ve become better I&#8217;ll make it generate a random year in the 21th century.</p>
<h3>What I learned</h3>
<p>Quiz! was very fun to code. It&#8217;s small, yet something I know I would find useful.</p>
<p>When working on this application, I came to appreciate object-oriented programming more and more. One good example is the use of <a href="http://doc.trolltech.com/qdate.html"><code>QDate</code></a> to handle dates. Writing a function to generate a random date isn&#8217;t hard, but it&#8217;s not a one-liner either &#8211; you have to take into account that the lengths of the months are different, and with random years you need to remember leap years as well.</p>
<p>With <code>QDate</code> I generate a random month (1-12) and day (1-31) and use the <code>bool QDate::setDate(int <em>year</em>, int <em>month</em>, int <em>day</em>)</code> function in a <code>do while</code> loop. If the date is invalid it returns <code>false</code> and a new date is generated, otherwise it returns <code>true</code> and exits the loop.</p>
<p>As a bonus, <code>QDate</code> offers a <code>dayOfWeek()</code> function to easily check the weekday for a specific date. Thanks to this class, the source code for my date quiz generator is very short and straightforward.</p>
<h2>Next stop: The land of yellow cashews</h2>
<p>For now I&#8217;ve only worked with C++ and Qt, but hopefully I can write a little bit about working with the KDE Platform in the next step. The plan is to first port TextSync to Plasma. There is another plasmoid I want to do &#8211; I&#8217;ll write more about it the next time if my first step into Plasma land is successful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hanswchen.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hanswchen.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hanswchen.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hanswchen.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hanswchen.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hanswchen.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hanswchen.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hanswchen.wordpress.com/1143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=1143&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hanschen.org/2010/01/01/the-road-to-kde-devland-step-5/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/904ae90dc9256407d682127b41e66278?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">Mogger</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/logo.png" medium="image">
			<media:title type="html">The Road to KDE Devland</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/12/textsync.png" medium="image">
			<media:title type="html">TextSync</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/12/gridview.png?w=300" medium="image">
			<media:title type="html">GridView</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/12/quiz.png?w=219" medium="image">
			<media:title type="html">Quiz!</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/12/mathquiz.png?w=210" medium="image">
			<media:title type="html">Math quiz</media:title>
		</media:content>
	</item>
		<item>
		<title>The Road to KDE Devland &#8211; step 4</title>
		<link>http://hanschen.org/2009/09/14/the-road-to-kde-devland-step-4/</link>
		<comments>http://hanschen.org/2009/09/14/the-road-to-kde-devland-step-4/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 19:55:53 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[PlanetKDE]]></category>
		<category><![CDATA[The Road to KDE Devland]]></category>

		<guid isPermaLink="false">http://hanswchen.wordpress.com/?p=675</guid>
		<description><![CDATA[The end of summer Whew, long time no see! After the summer vacation I&#8217;ve had my hands full, so I never found the motivation to sit down and write this. Sorry about the delay. This step marks the end of summer and will show you what I&#8217;ve achieved in these two months. But first something [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=675&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/"><img class="size-full wp-image-364 alignleft" title="The Road to KDE Devland" src="http://hanswchen.files.wordpress.com/2009/07/logo.png?w=138" alt="logo" width="138" /></a></p>
<p style="text-align:center;">
<h1>The end of summer</h1>
<p>Whew, long time no see! After the summer vacation I&#8217;ve had my hands full, so I never found the motivation to sit down and write this. Sorry about the delay.</p>
<p>This step marks the end of summer and will show you what I&#8217;ve achieved in these two months. But first something about Qt.</p>
<p><span id="more-675"></span></p>
<h2>The start of Qt programming</h2>
<p>To start off, I need to say this:</p>
<p style="text-align:center;">Qt is easy.</p>
<p>When I was a child, I made some GUI applications in Visual Basic. It was very easy to get started with &#8211; you place some widgets on a form, double click on one (e.g. a pushbutton) and write some code to be run (e.g. when the pushbutton is pressed). Simple.</p>
<p>Even with my limited knowledge of Visual Basic, I could do pretty much. The code was usually awful &#8211; I preferred to store values in (invisible) textboxes instead of using variables, just to mention one thing &#8211; but they actually worked.</p>
<p>Now, I would argue that Qt is harder to get started with, probably because it uses C++ (yes I know that Qt has a lot of <a href="http://en.wikipedia.org/wiki/Qt_(toolkit)#Bindings">bindings for other languages</a>). It&#8217;s easy to lay out widgets in <a href="http://doc.trolltech.com/designer-manual.html">Qt Designer</a>, but it&#8217;s far from obvious what to do afterwards. The workflow is probably clearer if you use <a href="http://qt.nokia.com/products/developer-tools">Qt Creator</a>, but I haven&#8217;t tried it yet.</p>
<p>To my aid I had my books, and I soon found that I was able to do a lot in Qt that I didn&#8217;t know how to implement in Visual Basic. The <a href="http://qt.nokia.com/doc/layout.html">Qt layout system</a> makes it easy to lay out widgets and takes care of the position and size of widgets when you resize the window. To make an application with menubar and toolbars, you derive from <code>QMainWindow</code> and add a few objects and functions.</p>
<p><em>Derive</em>. That&#8217;s something you&#8217;ll do a lot in Qt. An excellent example of object-oriented programming.</p>
<p>If you want an object A that have the same properties (talking about general properties, not Qt specific) as object B, but further specialized, you can derive A from B. For example, I want a cat that can play <a href="http://en.wikipedia.org/wiki/Go_(game)">Go</a>. Most cats can&#8217;t do that, right? A normal <code>Cat</code> is not enough. But I don&#8217;t need to create a new <code>Cat</code> from scratch, I can make the new class inherit from <code>Cat</code> (i.e., it is derived from <code>Cat</code>):</p>
<blockquote>
<pre>class  GoCat : public Cat
{
    Q_OBJECT

public:
    GoCat(QWidget *parent = 0);

private slots:
    void playGo();
};</pre>
</blockquote>
<p>This is just standard C++. <code>Q_OBJECT</code> is included because we want to make use of Qt&#8217;s meta-object system, including signals and slots (<a href="http://doc.trolltech.com/qobject.html#Q_OBJECT">read more here</a>).</p>
<p>In a similar fashion, we can build GUI applications by using the classes Qt provides. A Main Window with menubar, toolbar and system tray? No problem, <code>QMainWindow</code> takes care of it. If we want to make a custom widget that consist of two Qt widgets, for example a <code>QSlider</code> that&#8217;s connected to <code>QLCDNumber</code> like in <a href="http://doc.trolltech.com/4.4/tutorials-tutorial-t5.html">this tutorial</a>, we simply derive from <code>QWidget</code>.</p>
<p><code>MyWidget(QWidget *parent = 0);</code> is a typical constructor declaration for derived classes. We then pass the parent pointer to the base class (the one we derive from) in the constructor:</p>
<blockquote>
<pre>MyWidget::MyWidget(QWidget *parent)
     : QWidget(parent)
[...]</pre>
</blockquote>
<p>In this example  (taken from <a href="http://doc.trolltech.com/4.4/tutorials-tutorial-t5.html">tutorial</a>) <code>MyWidget</code> is derived from <code>QWidget</code>, as you can see.</p>
<p>(Qt&#8217;s parent-child mechanism is out of scope for this article. I touched upon the subject in <a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%e2%80%93-step-2/">step 2</a>, when I wrote about pointers in Qt).</p>
<h2>Result</h2>
<p>As promised I&#8217;ll show you the two Main Windows (derived from <code>QMainWindow</code>, of course) that I&#8217;ve done by following my two Qt books.</p>
<p>In <a href="http://www.amazon.com/Book-Qt-Art-Building-Applications/dp/1593271476/ref=sr_1_3?ie=UTF8&amp;s=books&amp;qid=1248024255&amp;sr=1-3" target="_blank">The Book of Qt 4: The Art of Building Qt Applications</a> you create a simple text editor in chapter 4. The GUI is done in Qt Designer and the final application looks like this:</p>
<div id="attachment_700" class="wp-caption aligncenter" style="width: 310px"><a href="http://hanswchen.files.wordpress.com/2009/09/cuteedit.png"><img class="size-medium wp-image-700" title="Cute Editor" src="http://hanswchen.files.wordpress.com/2009/09/cuteedit.png?w=300&#038;h=263" alt="Cute Editor" width="300" height="263" /></a><p class="wp-caption-text">CuteEditor</p></div>
<p style="text-align:left;">I liked this application. It&#8217;s simple &#8211; most of the functionality is already in <code>QTextEdit</code>. You need to setup the actions in the toolbar and menubar and implement a few functions functions, such as loading and saving files. Oh, and don&#8217;t forget the status bar. That&#8217;s pretty much it.</p>
<p style="text-align:left;">This chapter gave me a good understanding of how to create similar small applications. However, I found the part about the dock window (&#8220;Templates&#8221; in screenshot) somewhat vague and incomplete. The code wouldn&#8217;t compile for me at first &#8211; I need to look into it and see if it&#8217;s a mistake from my part.</p>
<p style="text-align:left;">The application in <a href="http://www.amazon.com/Programming-Prentice-Source-Software-Development/dp/0132354160/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1248024255&amp;sr=1-1" target="_blank">C++ GUI Programming with Qt 4</a> is more complex. You build a spreadsheet, completely from a text editor (chapter 3 and 4). Well, for most parts at least.</p>
<p style="text-align:left;">
<div id="attachment_702" class="wp-caption aligncenter" style="width: 310px"><a href="http://hanswchen.files.wordpress.com/2009/09/spreadsheet.png"><img class="size-medium wp-image-702" title="Spreadsheet" src="http://hanswchen.files.wordpress.com/2009/09/spreadsheet.png?w=300&#038;h=249" alt="Spreadsheet" width="300" height="249" /></a><p class="wp-caption-text">Spreadsheet</p></div>
<p style="text-align:left;">The reason I said &#8220;for most parts&#8221; is because you create some of the dialogs in Qt Designer in an earlier chapter. It&#8217;s very nice that you get to reuse them to create your Spreadsheet application and learn how dialogs work. Completing the application was also a big motivation booster &#8211; &#8220;woah, I could actually make this application&#8221;.</p>
<p style="text-align:left;">That&#8217;s unfortunately also the bad thing about this example &#8211; to me, it was a bit too complex and it was easy to get lost in details. Yet it&#8217;s listed under &#8220;Basic Qt&#8221;, which I find somewhat amusing.</p>
<p style="text-align:left;">Another thing I didn&#8217;t like was that I couldn&#8217;t compile it until I was finished. I prefer to take it in smaller steps, to be able to see what I&#8217;ve accomplished after a while. In hindsight, I should have copied example files from chapter 4 (included on CD) to test the application.</p>
<p style="text-align:left;">Overall I get the feeling that <em>C++ GUI Programming with Qt 4</em> assumes the reader has more prior knowledge in C++ than <em>The Book of Qt 4: The Art of Building Qt Applications</em>. In my opinion Daniel Molkentin, the author of the latter book, gives a more expanded explanation on some topics, such as memory management (stack vs heap) and how to use Ui files created in Qt Designer. On the other hand, I also appreciate the insight Jasmin Blanchette and Mark Summerfield (authors of C++ GUI Programming with Qt 4) provides and their elegant code.</p>
<p style="text-align:left;">To summarize, I don&#8217;t regret getting both books &#8211; so far, I think they work pretty well as complements.</p>
<p style="text-align:left;"><a href="http://www.thelins.se/johan/blog.html">Johan Thelin</a> has been kind enough to send me a review copy of his book, <a href="http://www.amazon.com/Foundations-Development-Experts-Voice-Source/dp/1590598318/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1252943129&amp;sr=1-1">Foundations of Qt Development</a> -<strong> thanks Johan!</strong> It&#8217;s still at my parents&#8217; place but I&#8217;ll pick it up the next time I visit them. I&#8217;m looking forward to seeing what this book has to offer.</p>
<h2 style="text-align:left;">Final words</h2>
<p style="text-align:left;">Everything above (mainly referring to &#8220;The start of Qt programming&#8221;) is my interpretation. If you find any errors in the text, please don&#8217;t hesitate to correct me.</p>
<p style="text-align:left;">Next time I&#8217;ll show you the applications I recently started working on. Simple small applications, very similar to the ones I showed above (but rewritten from scratch). I do, however, have plans to eventually turn one into a plasmoid later.</p>
<p style="text-align:left;">My lectures have started again, so I&#8217;ll have even less time to learn about KDE Development. That also means less frequent steps, which in unfortunate. I&#8217;ll try to keep you updated as often as my time (and motivation) allows.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hanswchen.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hanswchen.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hanswchen.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hanswchen.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hanswchen.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hanswchen.wordpress.com/675/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hanswchen.wordpress.com/675/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hanswchen.wordpress.com/675/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=675&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hanschen.org/2009/09/14/the-road-to-kde-devland-step-4/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/904ae90dc9256407d682127b41e66278?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">Mogger</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/logo.png" medium="image">
			<media:title type="html">The Road to KDE Devland</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/09/cuteedit.png?w=300" medium="image">
			<media:title type="html">Cute Editor</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/09/spreadsheet.png?w=300" medium="image">
			<media:title type="html">Spreadsheet</media:title>
		</media:content>
	</item>
		<item>
		<title>The Road to KDE Devland – step 3</title>
		<link>http://hanschen.org/2009/08/02/the-road-to-kde-devland-step-3/</link>
		<comments>http://hanschen.org/2009/08/02/the-road-to-kde-devland-step-3/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 22:39:53 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[PlanetKDE]]></category>
		<category><![CDATA[The Road to KDE Devland]]></category>

		<guid isPermaLink="false">http://hanswchen.wordpress.com/?p=469</guid>
		<description><![CDATA[Project Setup This time I&#8217;ll just tell you about my project setup. You already know which books I read, but what other tools do I use to reach my goal? First, however, I want to give attention to the following blog posts: thinkMoult -  The Road to KDE Devland (Moult Edition) #0 veracity &#8211; The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=469&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/"><img class="size-full wp-image-364 alignleft" title="The Road to KDE Devland" src="http://hanswchen.files.wordpress.com/2009/07/logo.png?w=138" alt="logo" width="138" /></a></p>
<p style="text-align:center;">
<h1>Project Setup</h1>
<p>This time I&#8217;ll just tell you about my project setup. You already know which books I read, but what other tools do I use to reach my goal?<br />
First, however, I want to give attention to the following blog posts:</p>
<ul>
<li><a href="http://thinkmoult.com/2009/07/26/the-road-to-kde-devland-moult-edition-0/" target="_blank">thinkMoult -  The Road to KDE Devland (Moult Edition) #0</a></li>
<li><a href="http://lahsiv.net/blog/?p=42" target="_blank">veracity &#8211; The Road to KDE and Qt Development</a></li>
</ul>
<p>It&#8217;s nice to hear about other people who walk towards the same goal, but not necessary the same road. Looking forward to hearing more from them, and I also hope to see more &#8220;The Road to &#8230;&#8221; series emerging.</p>
<p><span id="more-469"></span></p>
<h2>Where do you hack?</h2>
<p>To start off, here&#8217;s my temporary working environment:</p>
<p><a href="http://hanswchen.files.wordpress.com/2009/08/hackplace.png"><img class="aligncenter size-medium wp-image-470" title="Where I hack" src="http://hanswchen.files.wordpress.com/2009/08/hackplace.png?w=300&#038;h=211" alt="Where I hack" width="300" height="211" /></a></p>
<p>Yes, that&#8217;s a Microsoft mouse. I don&#8217;t consider a mouse important enough to bring my own, so I just use an unused one I found lying around.</p>
<p>The netbook is a Samsung NC10, which I&#8217;m very happy with. I can&#8217;t get compositing to work when using the external monitor, but I guess that&#8217;s a limitation in the hardware. Otherwise most things work out of box with <a href="http://www.archlinux.org/" target="_blank">Arch Linux</a>, the distro of my choice.</p>
<p>As you can see, Tux is currently on vacation. I&#8217;ve borrow Micaiah from my little brother as a temporary hacker mascot.</p>
<h2>The tools</h2>
<p>Let&#8217;s take a closer look at my screenshot:</p>
<p><a href="http://hanswchen.files.wordpress.com/2009/08/screenshot1.png"><img class="aligncenter size-medium wp-image-472" title="Screenshot" src="http://hanswchen.files.wordpress.com/2009/08/screenshot1.png?w=300&#038;h=133" alt="Screenshot" width="300" height="133" /></a></p>
<p>In my experience, IDEs are more troublesome than helpful when it comes to small projects. In an introduction to C++ course in high school, the teacher recommended us to use CodeWarrior (we were writing applications like &#8220;Hello World&#8221;). What a mess. Most problems my classmates had seemed to be IDE-related rather than related to code. I used a trial version of TextMate and compiled from the command line instead. When the trial was over, I switched to gVim (and made a friend who was tired of CodeWarrior switch too).</p>
<p>On my own computer, I preferred to use <a href="http://kate-editor.org/" target="_blank">Kate</a>. I tried <a href="http://www.kdevelop.org/" target="_blank">KDevelop</a> briefly, but I didn&#8217;t think that all the extra features it offered was needed. <a href="http://en.wikipedia.org/wiki/KISS_principle" target="_blank">KISS</a>, right?</p>
<p>As you can see, I now use <a href="http://www.vim.org/" target="_blank">Vim</a> as my text editor. I&#8217;ve used Vi/Vim for a pretty long time (<code>vim foo</code>; <code>a</code>; &lt;navigate around with arrow keys and enter text&gt;; <code>escape</code>; <code>:wq</code>), but I haven&#8217;t really learned how to <em>use</em> Vim until now. If you want to start with Vim, I highly recommend <code>vimtutor</code> (enter it in the command line).</p>
<p>I&#8217;m still far from a Vim master, but I find it very nice to work with. Here are some scripts that make my life easier:</p>
<ul>
<li><a href="http://www.vim.org/scripts/script.php?script_id=1643" target="_blank">SuperTab</a> &#8211; allows you to use the tab key to do all your insert completion</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=23" target="_blank">EnhancedCommentify</a> &#8211; switch lines between commented and uncommented</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=2590" target="_blank">FSwitch</a> &#8211; switch between source and header file</li>
<li><a href="http://www.vim.org/scripts/script.php?script_id=2540" target="_blank">snipMate</a> &#8211; TextMate-style snippets for Vim</li>
</ul>
<p>To fix syntax highlighting for Qt, I followed <a href="http://nikolavp.blogspot.com/2008/07/highlight-for-qt-classes-in-vim.html" target="_blank">this blogpost</a>.</p>
<p>The other application you see in the screenshot is Qt Assistant &#8211; a very helpful assistant, indeed.</p>
<p>Despite everything I&#8217;ve said about IDEs, I recommend you to check out <a href="http://www.qtsoftware.com/products/appdev/developer-tools/developer-tools#qt-tools-at-a" target="_self">Qt Creator</a> if you like these kind of tools. Personally I think I&#8217;ll stick to Vim for a long time, and maybe try to get <a href="http://ivan.fomentgroup.org/blog/2009/03/08/vide/" target="_blank">Vide</a> working again. Someday.</p>
<p>As seen in the screenshot, I&#8217;ve started with some Qt by now (after about 3 weeks of C++). I&#8217;ll write more about it in the next step. Now it&#8217;s time to go to my other hacker place &#8211; bed. I&#8217;ve only dreamed about code a few times, but those dreams were quite pleasant; it felt like I finally understood some things.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hanswchen.wordpress.com/469/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hanswchen.wordpress.com/469/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hanswchen.wordpress.com/469/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hanswchen.wordpress.com/469/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hanswchen.wordpress.com/469/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hanswchen.wordpress.com/469/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hanswchen.wordpress.com/469/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hanswchen.wordpress.com/469/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=469&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hanschen.org/2009/08/02/the-road-to-kde-devland-step-3/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/904ae90dc9256407d682127b41e66278?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">Mogger</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/logo.png" medium="image">
			<media:title type="html">The Road to KDE Devland</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/08/hackplace.png?w=300" medium="image">
			<media:title type="html">Where I hack</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/08/screenshot1.png?w=300" medium="image">
			<media:title type="html">Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>The Road to KDE Devland &#8211; step 2</title>
		<link>http://hanschen.org/2009/07/25/the-road-to-kde-devland-step-2/</link>
		<comments>http://hanschen.org/2009/07/25/the-road-to-kde-devland-step-2/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 22:53:16 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[PlanetKDE]]></category>
		<category><![CDATA[The Road to KDE Devland]]></category>

		<guid isPermaLink="false">http://hanswchen.wordpress.com/?p=366</guid>
		<description><![CDATA[Can anyone give me some pointers? After one week with Sams Teach Yourself C++ in 21 Days, it feels like I have the basics of C++ down: constants and variables, functions, some operators, loops, if and switch statements etc. Object oriented programming was introduced surprisingly early (Day 6), and the memory discussion at the end [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=366&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/"><img class="size-full wp-image-364 alignleft" title="The Road to KDE Devland" src="http://hanswchen.files.wordpress.com/2009/07/logo.png?w=138" alt="logo" width="138" /></a></p>
<p style="text-align:center;">
<h1>Can anyone give me some pointers?</h1>
<p>After one week with <a href="http://www.amazon.com/Sams-Teach-Yourself-One-Hour/dp/0672329417/ref=sr_1_2?ie=UTF8&amp;s=books&amp;qid=1248024167&amp;sr=1-2" target="_blank">Sams Teach Yourself C++ in 21 Days</a>, it feels like I have the basics of C++ down: constants and variables, functions, some operators, loops, <code>if</code> and <code>switch</code> statements etc. Object oriented programming was introduced surprisingly early (Day 6), and the memory discussion at the end of Day 5 took some time to digest, but other than that everything went smoothly.</p>
<p>In the second week, the book takes up a topic that I&#8217;ve found pretty hard: <em>pointers</em> and <em>references</em>. In this step, I&#8217;ll write about some of the things about pointers and references that confused me. It&#8217;s assumed that you already know the basics of pointers/references.</p>
<p><span id="more-366"></span></p>
<h2>Why pointers?</h2>
<p>Pointers are introduced with some silly examples that doesn&#8217;t make much sense &#8211; why manipulate a variable using a pointer instead of directly assigning a value to the variable? Soon, however, the book tells you why pointers exist. (In this case, I think I would&#8217;ve preferred the other way round &#8211; first present the problem, then talk about the solution(s). It&#8217;s probably the way <a href="http://www.amazon.com/Accelerated-Practical-Programming-Example-Depth/dp/020170353X/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1248023240&amp;sr=1-1" target="_blank">Accelerated C++</a> approaches the subject, although I haven&#8217;t come to pointers in that book yet).</p>
<p>If you&#8217;ve studied some C++, you have probably come across the <em>stack</em> and the <em>free store</em> (the<em> heap</em>). Local variables (and function parameters) are declared on the stack, and go out of scope when the function returns. Variables on the heap, however, remain until you free the memory manually or when the program ends.</p>
<p>In C++, you allocate space on the heap with <code>new.</code><code> new</code> returns a pointer, which is how you access data on the heap. I like the analogy in Sams Teach Yourself C++ in 21 Days: let&#8217;s think of the memory address as a telephone number, say, to the local pizza store. Since you eat pizza all the time, you program your phone to call that number when you press a special button. You don&#8217;t have to remember the phone number anymore, and you don&#8217;t need know where the pizzeria is located &#8211; you can still access it by pressing that button on your phone.</p>
<p>Now back to programming. You can think of the pizzeria as being on the heap (it&#8217;s &#8220;somewhere&#8221;). Isn&#8217;t it good that our phone has this handy button? You probably know where I&#8217;m going &#8211; that button is our pointer to the pizzeria. In a similar way, you can access variables on the heap just by using pointers!</p>
<p>Another use of pointers is to pass variables by reference to functions. A classic example is the <code>void swap(int a, int b) </code>function. If you pass two variables to the function, you&#8217;ll notice that they aren&#8217;t swapped at all! This is because the function receives <em>copies</em> of the values, not the actual variables. One way to solve this problem is to pass pointers to the variables instead: <code>void swap(int *a, int *b)</code>. This way the function can access the original variables and do the swap.</p>
<h2>Pointers vs References</h2>
<p>If you want to use the <code>swap</code> function from the previous section, you have to pass it the address of the variables (on the stack) using the address-of operator (<code>&amp;</code>):</p>
<blockquote><p><code>swap(&amp;first, &amp;second);</code></p></blockquote>
<p>In the <code>swap </code>function body, you have to dereference the pointers with <code>*</code>:</p>
<blockquote><p><code>int temp = *second;<br />
*second = *first;<br />
*first = temp;</code></p></blockquote>
<p>Quite troublesome, isn&#8217;t it? (Here, we&#8217;ve even skipped to check if the pointer is a <code>null</code> pointer). Fortunately, you can accomplish the same thing with references. A <em>reference</em> is an alias for an object. If we pass references to our function, <code>void swap(int &amp;a, int &amp;b)</code>, we can do everything the &#8220;normal&#8221; way since <code>a</code> and <code>b </code>in the function body are <em>aliases</em> for the variables we pass into the function (and not copies!).</p>
<p>Seeing how easy it is with references, pointers feel kind of, well, pointless. So when should I choose to use pointers instead of references?</p>
<p>The rule of thumb seems to be:</p>
<blockquote><p>Don&#8217;t use a pointer when a reference can serve the same purpose.</p></blockquote>
<p>With that said, there are a few situations when you want to use pointers according to <a href="http://www.johnnybigert.se/referenser_och_pekare.html" target="_blank">Johnny Bigert (Swedish)</a>:</p>
<ol>
<li>If it&#8217;s possible for the object to be<code> null</code>. Sams Teach Yourself C++ mentions that some compilers support <code>null</code> references, but recommends to avoid them; instead, you should use a pointer, which can be assigned to <code>null </code>(<code>0</code>).<code><br />
</code></li>
<li>If you want to change the object being pointed to. References can&#8217;t be reassigned, so you should use a pointer in this case.</li>
</ol>
<p><a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%e2%80%93-step-2/#comment-133" target="_self">klebezettel</a> posted a <a href="http://qt.gitorious.org/qt/pages/ApiDesignPrinciples" target="_blank">link</a> in the comments that explained the standpoint of Qt Software:</p>
<blockquote><p>&#8220;Most C++ books recommend references whenever possible, according to the general perception that references are “safer and nicer” than pointers. In contrast, we at Qt Software tend to prefer pointers because they make the user code more readable.&#8221;</p></blockquote>
<p>See the <a href="http://qt.gitorious.org/qt/pages/ApiDesignPrinciples#Pointers+vs.+References" target="_blank">link</a> for more details and also <a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%e2%80%93-step-2/#comment-132" target="_self">Karellen&#8217;s comment</a>.<cite></cite></p>
<h2>The use of <code>*</code> and <code>&amp;</code></h2>
<p>If you look at the<code> swap</code> example, you see a lot of <code>*</code> and <code>&amp;</code>. If the function prototype looks like <code>void swap(int &amp;a, int &amp;b);</code>, should you also prefix the arguments with <code>*</code> or <code>&amp;</code> when you call the function?</p>
<p>This is how I thought in the beginning, and obviously it was not the right approach. What I did was to confuse the address-of operator with the reference operator, and the same for <code>*</code>. The compiler can see the difference from the context, but how do you do it?</p>
<p>It&#8217;s very simple, really. You declare a pointer by writing the type followed by <code>*</code> and finally followed by the pointer name, for example</p>
<blockquote><p><code>int *pointer;</code></p></blockquote>
<p>Personally I think it makes more sense to think that <code>*</code> belongs to <code>int</code>, to declare a pointer to an <code>int</code>. The problem is that if you write it like</p>
<blockquote><p><code>int* pointer1, pointer2;</code></p></blockquote>
<p>you would expect two pointers, but what you really get is only one pointer &#8211; <code>pointer2</code> is an <code>int</code>. How the whitespace is placed varies from programmer to programmer.</p>
<p>When you use the dereference operator (<code>*</code>), you don&#8217;t have a type in front of the <code>*</code>, for example</p>
<blockquote><p><code>someFunction(*dereference);</code></p></blockquote>
<p>It&#8217;s the same for <code>&amp;</code> when declaring references (<code><em>type</em> &amp;ref</code>) and using it as  the address-of operator (<code>&amp;variable</code>).</p>
<p>Now back to functions. When looking at a function prototype, I now think: &#8220;what kind of arguments does it expect&#8221;? Let&#8217;s say it looks like this:</p>
<blockquote><p><code>void increment(int *var);</code></p></blockquote>
<p>The function takes a pointer to an <code>int</code>. I can pass it a pointer, or I can use the address-of operator (<code>&amp;</code>) to pass it  the address of an<code> int</code>:</p>
<blockquote><p><code>int i = 1;<br />
increment(&amp;i);</code></p></blockquote>
<p>If the function takes a reference,</p>
<blockquote><p><code>void increment(int &amp;var);</code></p></blockquote>
<p>I just think that the function, if properly written, will adjust my variable in some way.</p>
<p>There are times when you <em>don&#8217;t</em> want to modify the original variable, but still want to pass by reference. This has to do with performance &#8211; when passing by reference the function can access the original variables and doesn&#8217;t need to make a copy. When passing an <code>int</code>, it won&#8217;t make a big difference; but when it comes to big classes, you can gain a lot by passing function arguments by reference.</p>
<p>What you want to do is to tell the function, &#8220;OK I give you access to my variable, but don&#8217;t you dare to touch it!&#8221;. You already know how to do the first part, and the second can be accomplished with the <code>const</code> keyword. References are always &#8220;constant&#8221; (they can&#8217;t be reassigned), so <code>const</code> together with a reference is always intended to make the <em>object referred to</em> constant:</p>
<blockquote><p><code>int const &amp;a =</code><code> …</code><code>; // correct<br />
const int &amp;b = </code><code>…</code><code>; // correct<br />
</code><code>int &amp;const c = …; // not valid</code></p></blockquote>
<p>as <a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%E2%80%93-step-2/#comment-144" target="_self">litb</a> pointed out. However, this doesn&#8217;t apply to pointers:</p>
<blockquote><p><code>const int * pointer1; // pointer to constant int - the value pointer1 points to can't be changed<br />
int * const pointer2; // constant pointer to int - the object pointer2 points to can't be changed<br />
</code></p></blockquote>
<p>Of course, you can combine the two:</p>
<blockquote><p><code>const int * const pointer3; // the object pointer3 points to and the value can't be changed<br />
</code></p></blockquote>
<p>The trick taught in Sams Teach Yourself C++ is to look to the <em>right</em> of <code>const</code>. In the first example, the <code>int</code> (pointed to) is constant; in the second, <code>pointer2</code> (the pointer) is constant.</p>
<p>Finally, just a few words about the cute <code>-&gt;</code> operator. If you want to access members of an object using a pointer, we would have to dereference the pointer first:</p>
<blockquote><p><code>(*pointer).anotherFunction();</code></p></blockquote>
<p>Since this is something we&#8217;ll do quite often, C++ provides the <code>-&gt;</code> operator for indirect access. That means that we can as well write it like this:</p>
<blockquote><p><code>pointer-&gt;anotherFunction();</code></p></blockquote>
<h2>Pointers in Qt</h2>
<p>You&#8217;ll see <code>-&gt;</code> being used a lot in Qt &#8211; in fact, almost all widgets (pushbuttons, labels etc.) are created on the heap in a way similar to this:<code><br />
</code></p>
<blockquote><p><code>QPushButton *okButton = new QPushButton("OK");</code></p></blockquote>
<p>Why aren&#8217;t they created on the stack? That&#8217;s something I wondered for a long time, and <a href="http://www.amazon.com/Book-Qt-Art-Building-Applications/dp/1593271476/ref=sr_1_3?ie=UTF8&amp;s=books&amp;qid=1248024255&amp;sr=1-3" target="_blank">The Book of Qt 4: The Art of Building Qt Applications</a> by <a href="http://daniel.molkentin.de/blog/" target="_blank">Daniel Molkentin</a> finally cleared it up for me. In C++, you have to remember to <code>delete</code> objects on the heap. Qt makes memory management easier by providing a parent-child hierarchy for objects. All objects derived from the QObject class can benefit from this; when a <em>parent</em> is deleted, it also deletes all its <em>children</em>. If a child acts as a parent for some other widgets, it also deletes its children, and so it goes on until all descendants are deleted.</p>
<p>If I understand Daniel Molkentin correctly, objects have to lie on the <em>heap</em> to take advantage of Qt&#8217;s memory management. <a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%e2%80%93-step-2/#comment-129" target="_self">illissius</a> commented that &#8220;that’s sort of backwards&#8221;, make sure to read <a href="http://hanswchen.wordpress.com/2009/07/25/the-road-to-kde-devland-%e2%80%93-step-2/#comment-129" target="_self">his whole comment</a>.</p>
<p>When you create a new object, you can specify the parent:</p>
<blockquote><p><code>QWidget window;<br />
QVBoxLayout *mainLayout = new QVBoxLayout(&amp;window);</code></p></blockquote>
<p>In this case <code>window </code>lies on the stack, since it&#8217;s the top-level widget.</p>
<p>When using some functions, for example <code>mainLayout-&gt;addWidget(okButton)</code>, the widget gets automatically added to a parent-child hierarchy. Here,<code> </code><code>mainLayout</code>&#8216;s parent (<code>window</code>) assumes parentage of <code>okButton</code>. <code>mainLayout</code> is <em>not </em>a parent of <code>okButton</code>, as one might think.</p>
<p>Phew, this was one quite long step. Remember, however, that there are much more to learn about pointers and references &#8211; I&#8217;ve only picked a few areas that I&#8217;ve found hard. For example, I skipped the topic of dangerous pointers entirely  &#8211; something you shouldn&#8217;t do if you&#8217;re studying C++.</p>
<p>I hope to keep the next steps shorter, to only report my progress. I&#8217;ll blog again when I&#8217;ve finished my Sams Teach Yourself C++ book and started with some basic Qt (yay, screenshots?). Now, I&#8217;m waiting for the <a href="http://xkcd.com/138/" target="_blank">obligatory comment</a>&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hanswchen.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hanswchen.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hanswchen.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hanswchen.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hanswchen.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hanswchen.wordpress.com/366/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hanswchen.wordpress.com/366/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hanswchen.wordpress.com/366/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=366&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hanschen.org/2009/07/25/the-road-to-kde-devland-step-2/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/904ae90dc9256407d682127b41e66278?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">Mogger</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/logo.png" medium="image">
			<media:title type="html">The Road to KDE Devland</media:title>
		</media:content>
	</item>
		<item>
		<title>The Road to KDE Devland &#8211; step 1</title>
		<link>http://hanschen.org/2009/07/19/the-road-to-kde-devland-step-1/</link>
		<comments>http://hanschen.org/2009/07/19/the-road-to-kde-devland-step-1/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 18:24:01 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[PlanetKDE]]></category>
		<category><![CDATA[The Road to KDE Devland]]></category>

		<guid isPermaLink="false">http://hanswchen.wordpress.com/?p=342</guid>
		<description><![CDATA[In case you&#8217;ve missed it, the series starts with step 0. Preparations When I became interested in KDE development some years ago, it wasn&#8217;t very easy to find out how to start. I found a KDevelop tutorial and learned a little about C++, but that&#8217;s pretty much it. Soon other things in life took over, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=342&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/"><img class="size-full wp-image-364 alignleft" title="The Road to KDE Devland" src="http://hanswchen.files.wordpress.com/2009/07/logo.png?w=138" alt="logo" width="138" /></a></p>
<p style="text-align:center;">
<p>In case you&#8217;ve missed it, the series starts with <a href="http://hanswchen.wordpress.com/2009/07/13/road-to-kde-devland-step-0/">step 0</a>.</p>
<h1>Preparations</h1>
<p>When I became interested in KDE development some years ago, it wasn&#8217;t very easy to find out how to start. I found a <a href="http://women.kde.org/articles/tutorials/kdevelop3/" target="_blank">KDevelop tutorial</a> and learned a little about C++, but that&#8217;s pretty much it. Soon other things in life took over, and I returned to just watch KDE&#8217;s progress through <a href="http://dot.kde.org/" target="_blank">the Dot</a> and <a href="http://planetkde.org/" target="_blank">Planet KDE</a>.</p>
<p>This summer, when I finally have a lot of free time, I want to start over. This means that &#8220;The Road to KDE Devland&#8221; series should suit you even if you don&#8217;t have any prior knowledge about C++ or programming in general.</p>
<p><span id="more-342"></span></p>
<h2>Starting point</h2>
<p>Nowadays there&#8217;s a natural starting point for soon-to-be developers:</p>
<p style="text-align:center;"><a title="KDE TechBase" href="http://techbase.kde.org" target="_blank"><img class="aligncenter size-full wp-image-343" title="techbase" src="http://hanswchen.files.wordpress.com/2009/07/techbase.png?w=194&#038;h=60" alt="techbase" width="194" height="60" /></a><a title="KDE TechBase" href="http://techbase.kde.org" target="_blank">techbase.kde.org</a></p>
<p style="text-align:left;">Here are two articles to get you started:</p>
<ul>
<li><a title="Contribute" href="http://techbase.kde.org/Contribute" target="_blank">Contribute</a></li>
<li><a title="Becoming a KDE Developer" href="http://www.kde.org/getinvolved/development/" target="_blank">Becoming a KDE Developer</a></li>
</ul>
<h2>Planning</h2>
<p>From the first link, you can read &#8220;KDE is mostly written in C++. If you are not familiar with C++, you should do at least some work on it&#8221; and &#8220;To become proficient with KDE coding, you should understand the Qt toolkit&#8221;. Although <a href="http://techbase.kde.org/Development/Languages" target="_blank">other languages</a> are supported, I&#8217;ll only focus on C++/Qt.</p>
<p>So the plan is simple: first I&#8217;ll learn C++, then Qt and ultimately get familiar with KDE coding. When you come to Qt, make sure it&#8217;s Qt4 and not Qt3 as there are some major differences. I think most people would highly recommend to skip Qt3 and start directly with Qt4.</p>
<h2>Online Resources</h2>
<p>There are a lot of useful links in the two TechBase articles I linked to earlier. Here are some additional links that you might find useful:</p>
<h3>C++</h3>
<ul>
<li><a href="http://www.cplusplus.com/doc/tutorial/" target="_blank">C++ Language Tutorial</a></li>
<li><a href="http://www.cprogramming.com/tutorial.html#c++tutorial" target="_blank">C++ Made Easy</a></li>
<li><a href="http://en.wikibooks.org/wiki/C%2B%2B" target="_blank">C++ Programming Language on Wikibooks</a></li>
</ul>
<h3>Qt</h3>
<ul>
<li><a href="http://doc.trolltech.com/4.4/tutorials-tutorial.html" target="_blank">Qt Tutorial</a> &#8211; For unknown reasons, this tutorial isn&#8217;t listed anymore. I think it gives you a good introduction to Qt, and the final application (a game) is pretty cute. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><a href="http://cartan.cas.suffolk.edu/oopdocbook/opensource/" target="_blank">An Introduction to Design Patterns in C++ and Qt 4</a> &#8211; Free online version</li>
<li><a href="http://thelins.se/learnqt/" target="_blank">Learn Qt</a> &#8211; Relative new site with tips and tricks, tutorials etc.</li>
<li><a href="http://sector.ynet.sk/qt4-tutorial/" target="_blank">Qt4 tutorial for absolute beginners</a> &#8211; I haven&#8217;t used it myself. If you aren&#8217;t afraid of screenshots from Windows, maybe it&#8217;s worth a try</li>
</ul>
<p>Personally I prefer real books, even if there are free e-books available. Which brings me to the next section&#8230;</p>
<h2>Books</h2>
<p>There are a lot of good C++ books, so I won&#8217;t list them all &#8211; a<a href="http://www.google.com/search?q=good+c%2B%2B+books" target="_blank"> Google search</a> should get you on track. As for books on Qt, you can find a list <a href="http://www.qtsoftware.com/developer/books/" target="_blank">here</a>.</p>
<p>Below are the books I use. They are by no means the &#8220;best&#8221;, they just happen to be the ones <em>I</em> choose.</p>
<ul>
<li><a href="http://www.amazon.com/Sams-Teach-Yourself-One-Hour/dp/0672329417/ref=sr_1_2?ie=UTF8&amp;s=books&amp;qid=1248024167&amp;sr=1-2" target="_blank">Sams Teach Yourself C++ in 21 Days</a> &#8211; Seems like a good introduction to C++</li>
<li><a href="http://www.amazon.com/Accelerated-Practical-Programming-Example-Depth/dp/020170353X/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1248023240&amp;sr=1-1" target="_blank">Accelerated C++: Practical Programming by Example</a> &#8211; Takes a different approach to teach C++, which I thought sounded interesting. Instead of introducing language features with examples, it presents problems and doesn&#8217;t hesitate to use the Standard Library to solve them</li>
<li><a href="http://www.amazon.com/Programming-Prentice-Source-Software-Development/dp/0132354160/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1248024255&amp;sr=1-1" target="_blank">C++ GUI Programming with Qt 4</a> &#8211; The official Qt book</li>
<li><a href="http://www.amazon.com/Book-Qt-Art-Building-Applications/dp/1593271476/ref=sr_1_3?ie=UTF8&amp;s=books&amp;qid=1248024255&amp;sr=1-3" target="_blank">The Book of Qt 4: The Art of Building Qt Applications</a> &#8211; Hopefully a good complement to the first Qt book; more about it below</li>
</ul>
<p>(Note: I own the 5th edition of Sams Teach Yourself C++ in 21 Days and 1st edition of the other books).</p>
<p>When skimming through C++ GUI Programming with Qt 4, I found that it picked up pace and soon left me in the dust with the spreadsheet example. For that reason, I wanted another Qt book as a complement. I also considered getting <a href="http://www.amazon.com/Foundations-Development-Experts-Voice-Source/dp/1590598318/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1248025075&amp;sr=1-1" target="_blank">Foundations of Qt Development</a>, but bought the other book instead because of some good reviews.</p>
<p>If you have your own tips (online resources, books etc.), please share them in the comments section.</p>
<p>Now, the journey has truly begun &#8211; in the next step, I&#8217;ve hopefully started with the actual programming. See you then!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hanswchen.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hanswchen.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hanswchen.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hanswchen.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hanswchen.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hanswchen.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hanswchen.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hanswchen.wordpress.com/342/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=342&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hanschen.org/2009/07/19/the-road-to-kde-devland-step-1/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/904ae90dc9256407d682127b41e66278?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">Mogger</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/logo.png" medium="image">
			<media:title type="html">The Road to KDE Devland</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/techbase.png" medium="image">
			<media:title type="html">techbase</media:title>
		</media:content>
	</item>
		<item>
		<title>The Road to KDE Devland &#8211; step 0</title>
		<link>http://hanschen.org/2009/07/13/road-to-kde-devland-step-0/</link>
		<comments>http://hanschen.org/2009/07/13/road-to-kde-devland-step-0/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 14:03:51 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[KDE]]></category>
		<category><![CDATA[PlanetKDE]]></category>
		<category><![CDATA[The Road to KDE Devland]]></category>

		<guid isPermaLink="false">http://hanswchen.wordpress.com/?p=328</guid>
		<description><![CDATA[Introduction Want to start to develop for KDE? Sure do. But how, and where do I start? Is it even possible for me to do something this complicated? The question are many, but it&#8217;s not always easy to find the answers. I&#8217;m just another person who wants to walk the path to &#8220;KDE Devland&#8221; &#8211; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=328&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://hanswchen.wordpress.com/category/the-road-to-kde-devland/"><img class="size-full wp-image-364 alignleft" title="The Road to KDE Devland" src="http://hanswchen.files.wordpress.com/2009/07/logo.png?w=138" alt="logo" width="138" /></a></p>
<p style="text-align:center;">
<h1>Introduction</h1>
<p>Want to start to develop for KDE? Sure do. But how, and where do I start? Is it even possible for me to do something this complicated? The question are many, but it&#8217;s not always easy to find the answers.</p>
<p>I&#8217;m just another person who wants to walk the path to &#8220;KDE Devland&#8221; &#8211; but I also want to leave something behind. Footsteps. Footsteps that other hikers can follow if they want, footsteps to show that anyone who&#8217;s motivated enough can walk this road.</p>
<p><span id="more-328"></span></p>
<h2>Summer of <em>C</em>ode</h2>
<p>There are mainly two purposes of the &#8220;Road to KDE Devland&#8221; series:</p>
<ol>
<li>To see how much I can learn about KDE development during one summer</li>
<li>Document my progress as a motivation for others who want to develop for KDE</li>
</ol>
<p>To avoid getting off route, I&#8217;ve set up a goal to reach within a time frame. I think I&#8217;m much more effective this way, and it&#8217;s also a great motivation to get you started. Do you know about the &#8220;100 pushups in 6 weeks&#8221; site? I&#8217;ve never liked to &#8220;train for the sake of training&#8221;, but I gladly accepted this challenge &#8211; just because it sounded like fun. 100 is a nice number, and while you know it&#8217;s likely to take more than 6 weeks, it still gives a rough idea of how much time you have to put into it.</p>
<p>My goal is to write a KDE application &#8211; probably a plasmoid &#8211; by the end of summer. It&#8217;s going to something very simple, but you have to start somewhere, right?</p>
<p>I&#8217;ve already mentioned the time frame: a summer holiday, which is about 2 months. That&#8217;s also why I&#8217;ve decided to call this &#8220;my&#8221; Summer of <em>C</em>ode project, an obvious rip-off of <a href="http://code.google.com/soc/" target="_blank">Google Summer of Code</a> (which I hope to participate in sometime in the future).</p>
<p><img class="aligncenter size-full wp-image-332" title="Summer of Code" src="http://hanswchen.files.wordpress.com/2009/07/soc1.png?w=392&#038;h=261" alt="Summer of Code" width="392" height="261" /></p>
<p style="text-align:left;">Kudos to the Oxygen artists for the icons. And sorry about the pixelate sun, but the svgz file was about to kill my netbook.</p>
<h2 style="text-align:left;">Some last words</h2>
<p style="text-align:left;">This isn&#8217;t going to be a guide about how to become a KDE developer. There are many roads leading there, and I&#8217;m just going to write about the path <em>I</em> walked.</p>
<p style="text-align:left;">In the same way that you don&#8217;t do pushups 24/7 in order to reach the goal of 100 consective pushups, I won&#8217;t sit in front of the computer the whole summer. On avarege, I plan to spend a couple of hours a day on this.</p>
<p style="text-align:left;">Due to some circumstances, I wasn&#8217;t able to blog about this until now in the middle of summer. Just remember that the posting dates aren&#8217;t in sync with my actual progress.</p>
<p style="text-align:left;">And lastly, if you&#8217;re not interested in programming this isn&#8217;t for you. Fortunately, there are <a href="http://kde.org/getinvolved/" target="_blank">a lot of other ways</a> to contribute to KDE! Since I didn&#8217;t see BugSquad on that page it gets a <a href="http://techbase.kde.org/Contribute/Bugsquad" target="_blank">special mention</a>.</p>
<p>Next time I&#8217;m going to write about which books I&#8217;ve equipped myself with, and some online resources I found useful as a starting point.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hanswchen.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hanswchen.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hanswchen.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hanswchen.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hanswchen.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hanswchen.wordpress.com/328/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hanswchen.wordpress.com/328/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hanswchen.wordpress.com/328/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hanschen.org&amp;blog=1435266&amp;post=328&amp;subd=hanswchen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hanschen.org/2009/07/13/road-to-kde-devland-step-0/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/904ae90dc9256407d682127b41e66278?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">Mogger</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/logo.png" medium="image">
			<media:title type="html">The Road to KDE Devland</media:title>
		</media:content>

		<media:content url="http://hanswchen.files.wordpress.com/2009/07/soc1.png" medium="image">
			<media:title type="html">Summer of Code</media:title>
		</media:content>
	</item>
	</channel>
</rss>