<?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>ragner.org &#187; Qt</title>
	<atom:link href="http://ragner.org/qt/feed" rel="self" type="application/rss+xml" />
	<link>http://ragner.org</link>
	<description>Ragner Magalhaes</description>
	<lastBuildDate>Mon, 27 Apr 2009 21:02:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Qt/Kde coding style and SVN tree</title>
		<link>http://ragner.org/programming-languages/qt/181</link>
		<comments>http://ragner.org/programming-languages/qt/181#comments</comments>
		<pubDate>Mon, 27 Apr 2009 20:57:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://ragner.org/?p=181</guid>
		<description><![CDATA[Hi all,
today I will post  a script based on Qt/Kde coding style using astyle command in a woking svn tree to fix coding style.

This script works like the scrip from the last post but now to work in a SVN tree.
It will check the coding style just in the modified and added files to the [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>today I will post  a script based on <a href="http://techbase.kde.org/Policies/Kdelibs_Coding_Style">Qt/Kde coding style</a> using <a href="http://astyle.sourceforge.net/">astyle</a> command in a woking svn tree to fix coding style.<a href="http://git-scm.com/" target="_blank"><br />
</a></p>
<p>This script works like the scrip from the last post but now to work in a SVN tree.</p>
<p>It will check the coding style just in the modified and added files to the svn commit.</p>
<p>&#8211;</p>
<pre>#!/bin/bash

astyle --indent=spaces=4 --brackets=linux \
      --indent-labels --pad=oper --unpad=paren \
      --one-line=keep-statements --convert-tabs \
      --indent-preprocessor \
      $(svn status | awk '(/^M/ || /^A/) &amp;&amp;
            (/\.h\&gt;/ || /\.c\&gt;/ || /\.cpp\&gt;/){print $2}')</pre>
<p>&#8211;</p>
<p>You can get the source code from <a href="http://ragner-org.googlecode.com/svn/trunk/qt/scripts/astyle-svn" target="_blank">here</a>.</p>
<p><strong>References:</strong></p>
<p><a href="http://ragner.org/programming-languages/qt/174" target="_self">http://ragner.org/programming-languages/qt/174</a></p>
<p><a href="http://techbase.kde.org/Policies/Kdelibs_Coding_Style" target="_blank">http://techbase.kde.org/Policies/Kdelibs_Coding_Style</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ragner.org/programming-languages/qt/181/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Qt/Kde coding style and Git tree</title>
		<link>http://ragner.org/programming-languages/qt/174</link>
		<comments>http://ragner.org/programming-languages/qt/174#comments</comments>
		<pubDate>Fri, 17 Apr 2009 18:00:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://ragner.org/?p=174</guid>
		<description><![CDATA[Hi all,
today I will post  a script to check and fix Qt/Kde coding style using astyle command in a woking git tree.
&#8212;
#!/bin/bash

astyle --indent=spaces=4 --brackets=linux
      --indent-labels --pad=oper --unpad=paren
      --one-line=keep-statements --convert-tabs
      --indent-preprocessor
      $(git-status &#124; awk -F : [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>today I will post  a script to check and fix <a href="http://techbase.kde.org/Policies/Kdelibs_Coding_Style">Qt/Kde coding style</a> using <a href="http://astyle.sourceforge.net/">astyle</a> command in a woking <a href="http://git-scm.com/" target="_blank">git tree</a>.</p>
<p>&#8212;</p>
<pre>#!/bin/bash

astyle --indent=spaces=4 --brackets=linux
      --indent-labels --pad=oper --unpad=paren
      --one-line=keep-statements --convert-tabs
      --indent-preprocessor
      $(git-status | awk -F : '(/modified:/ ||
	/new file:/) &amp;&amp; (/.h&gt;/ || /.c&gt;/ ||
	/.cpp&gt;/) {print $2}')</pre>
<p>&#8212;</p>
<p>Download the source code <a href="http://ragner-org.googlecode.com/svn/trunk/qt/scripts/astyle-git" target="_blank">here</a>.</p>
<p>So you just need run the script in a working git tree to check and fix Qt coding style.</p>
<p>It will check and fix Qt coding style in all files modified in the git tree.</p>
<p>To force the coding style fix before each commit you can put the script as git&#8217;s hook script, putting it in the .git/hooks/pre-commit file of your project.</p>
<p>To enable the pre-commit hook script just run:</p>
<pre>$ chmod +x .git/hooks/pre-commit</pre>
<p><strong>References</strong>:</p>
<p><a href="http://astyle.sourceforge.net/" target="_blank">http://astyle.sourceforge.net/</a></p>
<p><a href="http://techbase.kde.org/Policies/Kdelibs_Coding_Style" target="_blank">http://techbase.kde.org/Policies/Kdelibs_Coding_Style</a></p>
<p><a href="http://git-scm.com/" target="_blank">http://git-scm.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ragner.org/programming-languages/qt/174/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Simple Qt State Machine</title>
		<link>http://ragner.org/programming-languages/qt/168</link>
		<comments>http://ragner.org/programming-languages/qt/168#comments</comments>
		<pubDate>Thu, 16 Apr 2009 20:19:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://ragner.org/?p=168</guid>
		<description><![CDATA[Hi,
today I will post the source code for the following satechart for a simple Qt state machine.

You can get the source code here.
&#8212;
    QPushButton button("Ok");

    /* The state machine. */
    QStateMachine machine;

    /* Three states to the state machine. */
    [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>today I will post the source code for the following satechart for a simple Qt state machine.</p>
<p style="text-align: center;"><img class="pie-img aligncenter" src="http://lh6.ggpht.com/_MI-9kS_ekSk/SeeQOH7aFNI/AAAAAAAACs4/mA0nGwsqqvA/simple-state-machine.jpg?imgmax=400" alt="simple-state-machine.jpg" width="400" height="258" /><img style="margin:10px 10px 10px 10px;" alt="" /></p>
<p>You can get the source code <a href="http://code.google.com/p/ragner-org/source/browse/trunk/qt/state-machine-framework/simple-state-machine/" target="_blank">here</a>.</p>
<p>&#8212;</p>
<pre>    QPushButton button("Ok");

    /* The state machine. */
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html" target="_blank">QStateMachine</a> machine;

    /* Three states to the state machine. */
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html" target="_blank">QState</a> s1;
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html" target="_blank">QState</a> s2;
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html" target="_blank">QState</a> s3;

    /* For each state it sets the button's text property. */
    s1.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtactionstate.html#setPropertyOnEntry" target="_blank">setPropertyOnEntry</a>(&amp;button, "text", "In state S[1]");
    s2.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtactionstate.html#setPropertyOnEntry" target="_blank">setPropertyOnEntry</a>(&amp;button, "text", "In state S[2]");
    s3.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtactionstate.html#setPropertyOnEntry" target="_blank">setPropertyOnEntry</a>(&amp;button, "text", "In state S[3]");

    /* Adds the transitions to each state */
    s1.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html#addTransition-3">addTransition</a>(&amp;button, SIGNAL(clicked()), &amp;s2);
    s2.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html#addTransition-3">addTransition</a>(&amp;button, SIGNAL(clicked()), &amp;s3);
    s3.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html#addTransition-3">addTransition</a>(&amp;button, SIGNAL(clicked()), &amp;s1);

    /* Adds the three states s1, s2 and s3 to the state machine. */
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#addState">addState</a>(&amp;s1);
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#addState">addState</a>(&amp;s2);
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#addState">addState</a>(&amp;s3);

    /* Sets the state s1 as initial state. */
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#initialState-prop" target="_blank">setInitialState</a>(&amp;s1);

    /* Starts the state machine. */
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#start" target="_blank">start</a>();

    button.show();</pre>
<p>&#8212;</p>
<p>When any of the states is entered, the button&#8217;s text will be changed accordingly.</p>
<p><strong>Reference</strong>:</p>
<p><a href="http://doc.trolltech.com/solutions/4/qtanimationframework/statemachine-api.html" target="_blank">http://doc.trolltech.com/solutions/4/qtanimationframework/statemachine-api.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ragner.org/programming-languages/qt/168/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hellow world using QStateMachine from Qt state machine framework</title>
		<link>http://ragner.org/programming-languages/qt/148</link>
		<comments>http://ragner.org/programming-languages/qt/148#comments</comments>
		<pubDate>Wed, 15 Apr 2009 23:40:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Qt]]></category>
		<category><![CDATA[QStateMachine]]></category>

		<guid isPermaLink="false">http://ragner.org/?p=148</guid>
		<description><![CDATA[Hi,
continuing the posts about Qt, today I will write how to implement a Qt application using QStateMachine from the new Qt animation framework.
The code below demonstrate the core functionality of the State Machine API.
= main.cpp =

/* Includes */
#include &#60;QtGui/QApplication&#62;
#include &#60;QtGui/QPushButton&#62;
#include &#60;QtCore/QStateMachine&#62;
#include &#60;QtCore/QFinalState&#62;
#include &#60;QtCore/QState&#62;

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
   [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>continuing the posts about Qt, today I will write how to implement a Qt application using QStateMachine from the new <a href="http://www.qtsoftware.com/products/appdev/add-on-products/catalog/4/Utilities/qtanimationframework/" target="_blank">Qt animation framework</a>.</p>
<p>The code below demonstrate the core functionality of the State Machine API.</p>
<p>= main.cpp =</p>
<pre>
<pre><!--StartFragment-->/* Includes */
#include &lt;QtGui/QApplication&gt;
#include &lt;QtGui/QPushButton&gt;
#include &lt;QtCore/QStateMachine&gt;
#include &lt;QtCore/QFinalState&gt;
#include &lt;QtCore/QState&gt;

int main(int argc, char *argv[])
{
    <a href="http://doc.trolltech.com/4.5/qapplication.html" target="_blank">QApplication</a> app(argc, argv);
    <a href="http://doc.trolltech.com/4.5/qpushbutton.html" target="_blank">QPushButton</a> button("Exit");

    /* State machine that will finish when a button is clicked. */
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html" target="_blank">QStateMachine</a> machine;

    /* The initial state. */
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html" target="_blank">QState</a> *s1 = new <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html#QtState">QState</a>();

    /* The final state. */
    <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtfinalstate.html" target="_blank">QFinalState</a> *s2 = new <a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtfinalstate.html#QtFinalState" target="_blank">QFinalState</a>();

    /* Instructs state s1 to set the property <em>"text"</em> of the <em>button</em> to the given
       text <em>"Click me"</em> when the state is entered. */
    s1-&gt;<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtactionstate.html#setPropertyOnEntry" target="_blank">setPropertyOnEntry</a>(&amp;button, "text", "Click me");

    /* Instructs state s1 to execute a transition to state s2 when the button
       will be clicked. */
    s1-&gt;<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstate.html#addTransition-3">addTransition</a>(&amp;button, SIGNAL(clicked()), s2);

    /* Adds the states s1 and s2 to the state machine. */
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#addState" target="_blank">addState</a>(s1);
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#addState" target="_blank">addState</a>(s2);

    /* Connects the signal <em>finished()</em> from the state machine to the <em>quit()</em> slot
       from the QApplication. So the application is going to quit when the state
       machine will be finished. */
    QObject::connect(&amp;machine, SIGNAL(<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#finished">finished</a>()), QApplication::instance(),
        SLOT(<a href="http://doc.trolltech.com/4.5/qcoreapplication.html#quit" target="_blank">quit</a>()));

    /* Sets the state machine's initial state; this state is entered when the
       state machine is started. */
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#initialState-prop" target="_blank">setInitialState</a>(s1);

    /* Starts the sate machine. */
    machine.<a href="http://doc.trolltech.com/solutions/4/qtanimationframework/qtstatemachine.html#start">start</a>();

    button.<a href="http://doc.trolltech.com/4.5/qwidget.html#show">show</a>();
    return app.<a href="http://doc.trolltech.com/4.5/qapplication.html#exec">exec</a>();
}</pre>
</pre>
<p>=</p>
<p><img class="pie-img aligncenter" src="http://lh6.ggpht.com/_MI-9kS_ekSk/SeZ6wMdrc_I/AAAAAAAAClY/t5Ze4syHZUc/state01.png?imgmax=400" alt="state01.png" width="400" height="139" /></p>
<p>The code above implements a state machine with two states s1 as initial state and s2 as final state.</p>
<p>When the state machine is started it starts into state s1 that sets the button&#8217;s text property to &#8220;Click me&#8221;.</p>
<p>The transition from s1 to s2 is controlled by the single QPushButton. When the button is clicked the machine executes a transition from state s1 to state s2.</p>
<p>When the state machine enter into the state s2, the final state, it emits the <em>finished()</em> signal that is connected to the <em>quit()</em> slot from QApplication, so it calls the quit() function and the application is finished.</p>
<p><strong>References:</strong></p>
<p><a href="http://www.qtsoftware.com/products/appdev/add-on-products/catalog/4/Utilities/qtanimationframework/">http://www.qtsoftware.com/products/appdev/add-on-products/catalog/4/Utilities/qtanimationframework/</a></p>
<p><a href="http://doc.trolltech.com/solutions/4/qtanimationframework/statemachine-api.html" target="_blank">http://doc.trolltech.com/solutions/4/qtanimationframework/statemachine-api.html</a></p>
<p><a href="http://ragner.org/programming-languages/qt/142" target="_self">http://ragner.org/programming-languages/qt/142</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ragner.org/programming-languages/qt/148/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Qt hello world and qmake</title>
		<link>http://ragner.org/programming-languages/qt/142</link>
		<comments>http://ragner.org/programming-languages/qt/142#comments</comments>
		<pubDate>Wed, 08 Apr 2009 19:03:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://ragner.org/?p=142</guid>
		<description><![CDATA[Hi all,
I am studying Qt and I want to do some posts about.
So I will start with a simple hello world and talking how to compile its source code.
= main.cpp =
#include &#60;QtGui/QApplication&#62;
#include &#60;QtGui/QLabel&#62;

int main(int argc, char *argv[])
{

    /* All Qt application need implements a QApplication */
    QApplication app(argc, argv); [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>I am studying Qt and I want to do some posts about.</p>
<p>So I will start with a simple hello world and talking how to compile its source code.</p>
<p>= main.cpp =</p>
<pre>#include &lt;QtGui/QApplication&gt;
#include &lt;QtGui/QLabel&gt;

int main(int argc, char *argv[])
{

    /* All Qt application need implements a QApplication */
    <a href="http://doc.trolltech.com/4.5/qapplication.html" target="_blank">QApplication</a> app(argc, argv); 

    /* Here QLabel is the main window! */
    <a href="http://doc.trolltech.com/4.5/qlabel.html" target="_blank">QLabel</a> label("Hello, world!");

    /* Shows the QLabel */
    label.<a href="http://doc.trolltech.com/4.5/qwidget.html#show" target="_blank">show()</a>;

    /* Enters the main event loop and waits until <a href="http://doc.trolltech.com/4.5/qcoreapplication.html#exit" target="_blank">exit()</a> is called. */
    return app.<a href="http://doc.trolltech.com/4.5/qapplication.html#exec" target="_blank">exec()</a>;
}</pre>
<p>=</p>
<p>Now you need to create the .pro file with the project&#8217;s configurations and dependencies.</p>
<p>To create the .pro file you can just run:</p>
<p><strong>$  qmake -project</strong></p>
<p>The command above will create a .pro file with the same name of the directory where is the source code.</p>
<p>To create the Makefile run:</p>
<p><strong>$ qmake</strong></p>
<p>So to complie the source code run:</p>
<p><strong>$ make</strong></p>
<p>You will see a binary file with the same name of the .pro file.</p>
<p><strong>References:</strong></p>
<p><a href="http://doc.trolltech.com/4.5/classes.html" target="_blank">http://doc.trolltech.com/4.5/classes.html</a></p>
<p><a href="http://doc.trolltech.com/4.5/widgets-tutorial.html" target="_blank">http://doc.trolltech.com/4.5/widgets-tutorial.html</a></p>
<p><a href="http://doc.trolltech.com/4.5/qmake-manual.html" target="_blank">http://doc.trolltech.com/4.5/qmake-manual.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ragner.org/programming-languages/qt/142/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
