<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>qt &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/qt/</link>
	<description>Feed of posts on WordPress.com tagged "qt"</description>
	<pubDate>Mon, 13 Oct 2008 02:31:54 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Programming]]></title>
<link>http://khotchkiss.wordpress.com/?p=160</link>
<pubDate>Sat, 11 Oct 2008 18:29:46 +0000</pubDate>
<dc:creator>Kyle Hotchkiss</dc:creator>
<guid>http://khotchkiss.pl.wordpress.com/2008/10/11/programming/</guid>
<description><![CDATA[I am just trying to figure out what language, gui, and ide I really want to use. So far I see python]]></description>
<content:encoded><![CDATA[<p>I am just trying to figure out what language, gui, and ide I really want to use. So far I see python, komodo edit, and QT in range. I have yet to make something, but I want to!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[QLineEdit and Clipping]]></title>
<link>http://lseek.wordpress.com/?p=49</link>
<pubDate>Fri, 10 Oct 2008 14:13:34 +0000</pubDate>
<dc:creator>lseek</dc:creator>
<guid>http://lseek.pl.wordpress.com/2008/10/10/qlineedit-and-clipping/</guid>
<description><![CDATA[Here&#8217;s a simple program to display the command line argument in a QLineEdit widget (along with]]></description>
<content:encoded><![CDATA[<p>Here's a simple program to display the command line argument in a QLineEdit widget (along with the result):</p>
<table border="0" cellspacing="10" cellpadding="1" width="100%" bgcolor="#dfdfdf">
<tr valign="top">
<td style="line-height:normal;">
<pre><font color="#c000c0">#include </font><font color="#c00000">&#60;QLineEdit&#62;</font>
<font color="#c000c0">#include </font><font color="#c00000">&#60;QApplication&#62;</font>

<font color="#008000">int</font>&#160;<font color="#008080">main</font>(<font color="#008000">int</font>&#160;argc, <font color="#008000">char</font>&#160;**argv)
{
&#160;&#160;&#160;&#160;<font color="#008000">QApplication</font>&#160;app(argc, argv);

&#160;&#160;&#160;&#160;<font color="#008000">QLineEdit</font>&#160;*le = <font color="#af5f00">new</font>&#160;<font color="#008000">QLineEdit</font>(argv[<font color="#c00000">1</font>]);
&#160;&#160;&#160;&#160;le-&#62;show();

&#160;&#160;&#160;&#160;app.exec();
}</pre>
</td>
<td style="line-height:normal;">
<p>./a.out /var/cache/apt/archives/stardict-common_3.0.1-4_all.deb</p>
<p><img src="http://lseek.wordpress.com/files/2008/10/le-clipped.png" alt="" title="Clipped QLineEdit Entry" width="200" height="26" class="alignnone size-full wp-image-55" />
    </td>
</tr>
</table>
<p>Of course, all this led to some very frustrating searching - in the QT Assistant as well as the web but there were no answers ... why on earth is my QLineEdit not resizing to show the entire string and how do I make it do so? There is no member function to do so directly.</p>
<p>As always, out of desparation, I fired up QT Designer and drew a QLineEdit widget and dragged it to be longer than its default length. When I saw the generated code, my heart sank ... the length of the widget was hard-wired in the code and so I couldn't use it as a generic solution. Back to digging in the documentation.</p>
<p>To cut off the rest of the drama and frustration, I finally got it working with the following code:</p>
<pre style="background:#dfdfdf;"><font color="#c000c0">#include </font><font color="#c00000">&#60;QLineEdit&#62;</font>
<font color="#c000c0">#include </font><font color="#c00000">&#60;QFontMetrics&#62;</font>
<font color="#c000c0">#include </font><font color="#c00000">&#60;QApplication&#62;</font>

<font color="#008000">int</font>&#160;<font color="#008080">main</font>(<font color="#008000">int</font>&#160;argc, <font color="#008000">char</font>&#160;**argv)
{
&#160;&#160;&#160;&#160;<font color="#008000">QApplication</font>&#160;app(argc, argv);

&#160;&#160;&#160;&#160;<font color="#008000">QLineEdit</font>&#160;*le = <font color="#af5f00">new</font>&#160;<font color="#008000">QLineEdit</font>(argv[<font color="#c00000">1</font>]);
&#160;&#160;&#160;&#160;<font color="#008000">QFontMetrics</font>&#160;fm = le-&#62;fontMetrics();
&#160;&#160;&#160;&#160;le-&#62;setMinimumWidth(fm.width(argv[<font color="#c00000">1</font>]) + <font color="#c00000">20</font>);
&#160;&#160;&#160;&#160;le-&#62;show();

&#160;&#160;&#160;&#160;app.exec();
}
<hr size="1" noshade width="50%" align="left">
./a.out /var/cache/apt/archives/stardict-common_3.0.1-4_all.deb
<img src="http://lseek.wordpress.com/files/2008/10/le-full.png" alt="" title="Full QLineEdit Entry" width="380" height="26" class="alignnone size-full wp-image-56" />
</pre>
<p>Took me about 3 hours to figure it out! This is so frustrating. I wish QT assistant had some "QT recipes" section for such small, "trivial" stuff that beginners might struggle with.</p>
<p>... Or perhaps I'm the only one dumb enough to not see how its done!</p>
<p>Anyhow, if you were also wondering how to make a QLineEdit widget display its entire contents, you know how its done now.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Some aMSN2 updates]]></title>
<link>http://drfav.wordpress.com/?p=61</link>
<pubDate>Thu, 09 Oct 2008 18:37:17 +0000</pubDate>
<dc:creator>drfav</dc:creator>
<guid>http://drfav.pl.wordpress.com/2008/10/09/some-amsn2-updates/</guid>
<description><![CDATA[Hello guys!
Ok, today I&#8217;m talking about a topic you probably don&#8217;t know (yet): aMSN2.
Le]]></description>
<content:encoded><![CDATA[<p>Hello guys!</p>
<p>Ok, today I'm talking about a topic you probably don't know (yet): aMSN2.</p>
<p>Let's go straight to the point: aMSN2 is the next generation MSN clone. Multiplatform, multifrontend (yeah, I meant multifrontend) and written in Python.</p>
<p>I've been working on the core and on the Qt4 frontend. I wanted to show you a screencast, but somehow something went nuts on my PC and everything I can get is a crappy video full of redrawing bugs. But nevermind, I took some photos :)</p>
<p><!--more--></p>
[caption id="attachment_62" align="aligncenter" width="273" caption="Hey, this is not WLM? What the fuck?"]<a href="http://drfav.wordpress.com/files/2008/10/amsn1.png"><img src="http://drfav.wordpress.com/files/2008/10/amsn1.png" alt="Hey, this is not WLM? What the fuck?" title="Amsn login window" width="273" height="580" class="size-full wp-image-62" /></a>[/caption]
<p>Oh, yeah, the Qt4 login window, powered by QSS super powers, copyright by Profox. Already working with all the goodness. But let me show you something more interesting...</p>
[caption id="attachment_63" align="aligncenter" width="497" caption="Gee... they're friends!"]<a href="http://drfav.wordpress.com/files/2008/10/amsn2.png"><img src="http://drfav.wordpress.com/files/2008/10/amsn2.png?w=497" alt="Gee... they&#39;re friends!" title="Getting to talk" width="497" height="258" class="size-large wp-image-63" /></a>[/caption]
<p>aMSN2 is the widget on the left, with my test account logged in. I made some chatting with my real account logged into emesene (on the right) to demonstrate chatting works.</p>
<p>Ok, chatting GUI still sucks, but what matters the most is that aMSN2 can already chat, send/receive typing notifications, send/receive nudges &#38; status updates, and receive custom emoticons (even if they're not correctly handled yet). In short, it's taking shape :)</p>
<p>Please don't forget this is still work in progress, unstable, it might kill random members of your family or pets. And, quoting Kakaroto, every time the "When will it be released?" question get asked, we delay release of a month. So keep quiet!</p>
<p>But, for developers' sake, we have a git repository where we keep the code. It is here: http://github.com/drf/amsn2/tree/master .<br />
If you're interested in helping (we need EFL, GTK, Cocoa [Mac frontend], Qt, and general python developers), just fork the repository, work on some patches, and send a pull request. One of the reason we are using git in this stage it's that it makes external contribution easier. Not to mention the #amsn channel on freenode, our base.</p>
<p>So stay excited, and see you on next aMSN post!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[QT Widgets And Memory]]></title>
<link>http://lseek.wordpress.com/?p=30</link>
<pubDate>Thu, 09 Oct 2008 18:10:56 +0000</pubDate>
<dc:creator>lseek</dc:creator>
<guid>http://lseek.pl.wordpress.com/2008/10/09/qt-widgets-and-memory/</guid>
<description><![CDATA[Today, while continuing on my journey to learn QT, I stumbled upon a wierd problem &#8230;
I wrote a]]></description>
<content:encoded><![CDATA[<p>Today, while continuing on my journey to learn QT, I stumbled upon a wierd problem ...</p>
<p>I wrote a simple program to display the properties of a file in a window - full path, UID, GID, etc. In keeping with OO styles, I went and defined a new class for this kind of dialog window:</p>
<table border="0" cellspacing="5" cellpadding="0" width="100%" bgcolor="#e0e0e0">
<tbody>
<tr valign="top">
<td width="50%">
<pre><span style="color:#0000c0;">// Class declaration </span>
<span style="color:#00aa00;">class</span> statDlg : <span style="color:#aaaa00;">public</span> <span style="color:#00aa00;">QWidget</span> {
    <span style="color:#00aa00;">Q_OBJECT</span>
<span style="color:#aaaa00;">private</span>:
    <span style="color:#00aa00;">QString</span>   fsize;
    <span style="color:#00aa00;">QFileInfo</span> finfo;
    <span style="color:#00aa00;">QLabel</span> *path_val;
    <span style="color:#00aa00;">QLabel</span> *ftype_val;
    <span style="color:#00aa00;">QLabel</span> *owner_val;
    <span style="color:#00aa00;">QLabel</span> *grp_val;
    <span style="color:#00aa00;">QLabel</span> *size_val;
    <span style="color:#00aa00;">QLabel</span> *atime_val;
    <span style="color:#00aa00;">QLabel</span> *mtime_val;
    <span style="color:#00aa00;">QLabel</span> *ctime_val;
    <span style="color:#00aa00;">QFormLayout</span>      *form;
    <span style="color:#00aa00;">QDialogButtonBox</span> *okBtn;
    <span style="color:#00aa00;">QVBoxLayout</span>      *dlg_grid;
    <span style="color:#00aa00;">void</span> getFileType(<span style="color:#00aa00;">void</span>);
<span style="color:#aaaa00;">public</span>:
    statDlg(<span style="color:#00aa00;">QString</span> fpath);
    <span style="color:#00aa00;">void</span> showinfo(<span style="color:#00aa00;">void</span>);
};</pre>
</td>
<td width="50%">
<pre><span style="color:#0000c0;">// In the constructor </span>
    ...
    owner_val = <span style="color:#aaaa00;">new</span> <span style="color:#00aa00;">QLabel</span>(finfo.owner());
    form-&#62;addRow(tr(<span style="color:#ff6060;">"Owner:"</span>), owner_val);
    grp_val = <span style="color:#aaaa00;">new</span> <span style="color:#00aa00;">QLabel</span>(finfo.<span style="color:#ff6060;">group</span>());
    form-&#62;addRow(tr(<span style="color:#ff6060;">"Group:"</span>), grp_val);
    ...</pre>
</td>
</tr>
</tbody>
</table>
<p>When I ran it, it did what was expected. Great!</p>
<p>The next step, of course, was to see if I could do any code cleanups. Since I come from an "embedded C" background, I view having to dynamically allocate so many child widgets as rather wasteful - after all they're part of the entire dialog box - they get used only by the dialog box and get destroyed when the dialog box is destroyed. Why needlessly dynamically allocate memory for these objects - the memory used wheter these members are statically allocated as part of the class or dynamically allocated is the same?</p>
<p>So I proceeded to change the pointers to ordinary <em>non-pointer</em> member variables ...</p>
<table border="0" cellspacing="5" cellpadding="0" width="100%" bgcolor="#e0e0e0">
<tbody>
<tr valign="top">
<td width="50%">
<pre><span style="color:#00aa00;">class</span> statDlg : <span style="color:#aaaa00;">public</span> <span style="color:#00aa00;">QWidget</span> {
    <span style="color:#00aa00;">Q_OBJECT</span>
<span style="color:#aaaa00;">private</span>:
    <span style="color:#00aa00;">QString</span>   fsize;
    <span style="color:#00aa00;">QFileInfo</span> finfo;
    <span style="color:#00aa00;">QLabel</span> path_val;
    <span style="color:#00aa00;">QLabel</span> ftype_val;
    <span style="color:#00aa00;">QLabel</span> owner_val;
    <span style="color:#00aa00;">QLabel</span> grp_val;
    <span style="color:#00aa00;">QLabel</span> size_val;
    <span style="color:#00aa00;">QLabel</span> atime_val;
    <span style="color:#00aa00;">QLabel</span> mtime_val;
    <span style="color:#00aa00;">QLabel</span> ctime_val;
    <span style="color:#00aa00;">QFormLayout</span>      form;
    <span style="color:#00aa00;">QDialogButtonBox</span> okBtn;
    <span style="color:#00aa00;">QVBoxLayout</span>      dlg_grid;
    <span style="color:#00aa00;">void</span> getFileType(<span style="color:#00aa00;">void</span>);
<span style="color:#aaaa00;">public</span>:
    statDlg(<span style="color:#00aa00;">QString</span> fpath);
    <span style="color:#00aa00;">void</span> showinfo(<span style="color:#00aa00;">void</span>);
};</pre>
</td>
<td width="50%">
<pre><span style="color:#0000c0;">// Needless dynamic allocations removed </span>
    ...
    owner_val.setText(finfo.owner());
    form.addRow(tr(<span style="color:#ff6060;">"Owner:"</span>), &#38;owner_val);
    grp_val.setText(finfo.<span style="color:#ff6060;">group</span>());
    form.addRow(tr(<span style="color:#ff6060;">"Group:"</span>), &#38;grp_val);
    ...</pre>
</td>
</tr>
</tbody>
</table>
<p>The compilation went fine and so did the execution ... until I quit the application, upon which I got a big "oops":</p>
<pre style="background:#dddddd;">*** glibc detected *** ./qstat: free(): invalid pointer: 0x00007fff328fa588 ***
======= Backtrace: =========
/lib/libc.so.6[0x7fe828abd968]
/lib/libc.so.6(cfree+0x76)[0x7fe828abfa76]
/usr/lib/libQtGui.so.4(_ZN10QBoxLayoutD2Ev+0xf3)[0x7fe829d70c83]
./qstat[0x40617a]
./qstat[0x405037]
/lib/libc.so.6(__libc_start_main+0xe6)[0x7fe828a681a6]
./qstat(_ZNK7QWidget6metricEN12QPaintDevice17PaintDeviceMetricE+0x89)[0x403709]
======= Memory map: ========
...</pre>
<p>Ouch!! What did I do wrong? I scoured my code all over, to see if I had forgotten to pass the address of a widget (and passed the widget itself by mistake) ... nope, no problem. A backtrace obtained by running it in GDB showed:</p>
<pre style="background:#dddddd;">#0  0x00007f44e5cc5ef5 in raise () from /lib/libc.so.6
#1  0x00007f44e5cc7413 in abort () from /lib/libc.so.6
#2  0x00007f44e5d023e8 in ?? () from /lib/libc.so.6
#3  0x00007f44e5d07968 in ?? () from /lib/libc.so.6
#4  0x00007f44e5d09a76 in free () from /lib/libc.so.6
#5  0x00007f44e6fbac83 in QBoxLayout::~QBoxLayout () from /usr/lib/libQtGui.so.4
#6  0x000000000040617a in ~statDlg (this=0x7fffefb46600) at qstat.h:13
#7  0x0000000000405037 in main (argc=2, argv=0x7fffefb468e8) at qstat.cc:84</pre>
<p>Aha, so the problem is in a call to the QBoxLayout destructor. But my class does not define any destructor function - it relies on the parent destructor to do the cleanup required. So where's the problem?</p>
<p>After battling around for an hour I scoured the net for clues ... didn't get any helpful results. I got <a href="http://lists.trolltech.com/qt-interest/2006-11/thread00056-0.html">an old post</a> where the poster encountered the same problem as me but there were no replies to the post.</p>
<p>Out of desperation, I just took a wild guess and googled for "qt widgets must be dynamically allocated".</p>
<p>Bingo! A <a href="http://lists.trolltech.com/qt-interest/1997-10/msg00288.html">thread way back in 1997</a> mentioned that:</p>
<blockquote><p>You can't really do this - Qt expects every widget to be allocated<br />
on the heap with new, if they aren't then you'll get a segmentation fault in<br />
your destructor.</p></blockquote>
<p>Aha, thats exactly what was happening. However, as noted by the original poster of that thread, there is no mention of this in the QT documentation and, even now, more than 10 years later, I can't seem to find any mention of this behavior in the QT documentation (as provided by "QT Assistant")!</p>
<p>So, if you're another QT newbie, pulling out your hair and wondering why your QT application is crashing when your widgets are not dynamically allocated, its because thats a design restriction imposed by QT.</p>
<p>Ugh! The more I use QT the more I seem to dislike it :(. Of course, I haven't used other toolkits (other than Tk which I find elegant in design, but thats at another level so its not fair to compare it with QT) so I won't (outright) say that QT is bad, ... just that I'm not liking it :(.</p>
<p>BTW, since I was stuck with dynamically allocating the widgets, I ended up with the following code:</p>
<table border="0" cellspacing="5" cellpadding="0" width="100%" bgcolor="#e0e0e0">
<tbody>
<tr valign="top">
<td width="50%">
<pre><span style="color:#0000c0;">// Class declaration</span>
<span style="color:#008000;">class</span> statDlg : <span style="color:#af5f00;">public</span> <span style="color:#008000;">QWidget</span> {
  <span style="color:#008000;">Q_OBJECT</span>
<span style="color:#af5f00;">private</span>:
  <span style="color:#008000;">QString</span>   fsize;
  <span style="color:#008000;">QFileInfo</span> finfo;

  <span style="color:#008000;">QFormLayout</span>      *form;
  <span style="color:#008000;">QDialogButtonBox</span> *okBtn;
  <span style="color:#008000;">QVBoxLayout</span>      *dlg_grid;

  <span style="color:#008000;">void</span> getFileType(<span style="color:#008000;">void</span>);
<span style="color:#af5f00;">public</span>:
    statDlg(<span style="color:#008000;">QString</span> fpath);
    <span style="color:#008000;">void</span> showinfo(<span style="color:#008000;">void</span>);
};</pre>
</td>
<td width="50%">
<pre><span style="color:#0000c0;">// Code </span>
    ...
    form-&#62;addRow(tr(<span style="color:#c00000;">"Owner:"</span>), <span style="color:#af5f00;">new</span> <span style="color:#008000;">QLabel</span>(finfo.owner()));
    form-&#62;addRow(tr(<span style="color:#c00000;">"Group:"</span>), <span style="color:#af5f00;">new</span> <span style="color:#008000;">QLabel</span>(finfo.<span style="color:#c00000;">group</span>()));
    ...</pre>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Widget Clipping in QT]]></title>
<link>http://lseek.wordpress.com/?p=12</link>
<pubDate>Wed, 08 Oct 2008 15:56:41 +0000</pubDate>
<dc:creator>lseek</dc:creator>
<guid>http://lseek.pl.wordpress.com/2008/10/08/widget-clipping-in-qt/</guid>
<description><![CDATA[I&#8217;ve been trying to learn some QT programming in the last few days and have been writing small]]></description>
<content:encoded><![CDATA[<p>I've been trying to learn some QT programming in the last few days and have been writing small programs that show different widgets, just so that I get a feel of how to program the widgets. Most of the common widgets were quite simple to program but one particular case stumped me for quite a few hours.</p>
<p>I was trying to write a simple widget that contains a QFrame. What I wanted was something like this:</p>
[caption id="attachment_18" align="alignnone" width="339" caption="All widgets are visible on resizing the window"]<a href="http://lseek.wordpress.com/files/2008/10/unclipped.png"><img class="size-full wp-image-18" title="unclipped" src="http://lseek.wordpress.com/files/2008/10/unclipped.png" alt="All widgets are visible on resizing the window" width="339" height="140" /></a>[/caption]
<p>But I ended up with something like this:</p>
[caption id="attachment_17" align="alignnone" width="100" caption="Widgets Clipped by the window"]<a href="http://lseek.wordpress.com/files/2008/10/clipped.png"><img class="size-full wp-image-17" title="clipped" src="http://lseek.wordpress.com/files/2008/10/clipped.png" alt="Widgets Clipped by the window" width="100" height="30" /></a>[/caption]
<p>I had to resize the window to show all the widgets.</p>
<p>The code itself was simple enough:</p>
<pre style="background:#dddddd;">    this-&#62;setWindowTitle("Show/Hide Widgets");

    container = new QFrame(this);
    container-&#62;setFrameStyle(QFrame::StyledPanel &#124; QFrame::Plain);
    container-&#62;setContentsMargins(10, 10, 10, 10);

    vlayout = new QVBoxLayout(container);

    label1  = new ToggleText("Label 1");
    label2  = new ToggleText("Label 2");
    hlayout = new QHBoxLayout;
    vlayout-&#62;addWidget(label1);
    vlayout-&#62;addWidget(label2);
    vlayout-&#62;addStretch();
    vlayout-&#62;addLayout(hlayout);

    toggleBtn   = new QPushButton("&#38;Show/Hide");
    dellabelBtn = new QPushButton("&#38;Delete");
    quitBtn     = new QPushButton("&#38;Quit");
    hlayout-&#62;addWidget(toggleBtn);
    hlayout-&#62;addWidget(dellabelBtn);
    hlayout-&#62;addWidget(quitBtn);</pre>
<p>I searched the net and got nothing. I skimmed through the QFrame reference documentation in QT Assistant N number of times but didn't get anything. Finally, in sheer desperation, I decided to go through the list of <em>all</em> member functions of the QFrame widget (including those inherited by QFrame). I should've done this earlier ... an <span style="color:#008800;">adjustSize()</span> member function caught my eye. When I added the following lines to the function:</p>
<pre style="background:#dddddd;">    ...
    hlayout-&#62;addWidget(toggleBtn);
    hlayout-&#62;addWidget(dellabelBtn);
    hlayout-&#62;addWidget(quitBtn);

    <span style="color:#008800;">container-&#62;adjustSize();
    this-&#62;adjustSize();</span></pre>
<p>I got the following result:</p>
[caption id="attachment_15" align="alignnone" width="286" caption="The final (proper) version"]<a href="http://lseek.wordpress.com/files/2008/10/proper.png"><img class="size-full wp-image-15" title="proper" src="http://lseek.wordpress.com/files/2008/10/proper.png" alt="The final (proper) version" width="286" height="122" /></a>[/caption]
<p>Perfect :).</p>
<p>So, just in case somebody out there is struggling with the same problem and wondering why their windows aren't getting created with the correct size, ... try the <span style="color:#008800;">adjustSize()</span> method :).</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Như Một Lời Chia Tay - Trịnh Công Sơn]]></title>
<link>http://phdieuli.wordpress.com/2008/10/07/nh%c6%b0-m%e1%bb%99t-l%e1%bb%9di-chia-tay-tr%e1%bb%8bnh-cong-s%c6%a1n/</link>
<pubDate>Tue, 07 Oct 2008 04:18:30 +0000</pubDate>
<dc:creator>phdieuli</dc:creator>
<guid>http://phdieuli.pl.wordpress.com/2008/10/07/nh%c6%b0-m%e1%bb%99t-l%e1%bb%9di-chia-tay-tr%e1%bb%8bnh-cong-s%c6%a1n/</guid>
<description><![CDATA[Như Một Lời Chia TayTrịnh C&ocirc;ng SơnNhững hẹn h&ograve; từ nay kh&eacute;p lạith]]></description>
<content:encoded><![CDATA[<p style="text-align:center;"><span style="font-family:Arial;font-size:7px;"><span style="color:#0000ff;font-size:medium;"><strong><span style="color:#000000;font-size:x-big;">Như Một Lời Chia Tay</span><br /></strong></span><em><span class="active">Trịnh C&#244;ng Sơn</span><br /></em><br />Những hẹn h&#242; từ nay kh&#233;p lại<br />th&#226;n nhẹ nh&#224;ng như m&#226;y<br />ch&#250;t nắng v&#224;ng chiều nay cũng vội<br />kh&#233;p lại từng đ&#234;m vui</p>
<p>&#208;ường quen lối từng sớm chiều mong<br />b&#224;n ch&#226;n xưa qua đ&#226;y ngại ngần<br />l&#224;m sao Biết Từng Nỗi &#208;ời Ri&#234;ng<br />để Y&#234;u Th&#234;m Y&#234;u Cho Nồng N&#224;n</p>
<p>C&#243; nụ hồng ng&#224;y xưa rớt lại<br />b&#234;n cạnh đời t&#244;i đ&#226;y<br />c&#243; ch&#250;t t&#236;nh thoảng như gi&#243; vội<br />t&#244;i chợt nh&#236;n ra t&#244;i.</p>
<p>Muốn một lần tạ ơn với đời<br />ch&#250;t mặn nồng cho t&#244;i<br />c&#243; những lần nằm nghe tiếng cười</p>
<p>nhưng chỉ l&#224; mơ th&#244;i</p>
<p>T&#236;nh như nắng vội tắt chiều h&#244;m<br />t&#236;nh kh&#244;ng xa nhưng kh&#244;ng thật gần<br />t&#236;nh như đ&#225; ho&#224;i nỗi chờ mong<br />t&#236;nh vu vơ cho ta muộn phiền</p>
<p>Tiếng th&#236; thầm nhiều khi nhớ lại<br />tưởng chỉ l&#224; cơn say<br />đ&#243;a hoa v&#224;ng mỏng manh cuối trời<br />như một lời chia tay.</span></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Desktop minimale in QT4: un sogno?]]></title>
<link>http://adrinux.wordpress.com/?p=378</link>
<pubDate>Mon, 06 Oct 2008 20:12:29 +0000</pubDate>
<dc:creator>adriano</dc:creator>
<guid>http://adrinux.pl.wordpress.com/2008/10/06/desktop-minimale-in-qt4-un-sogno/</guid>
<description><![CDATA[Il recente rilascio di VLC basato su QT4, il progetto di mozilla-qt, skype, licq, mi hanno spinto a ]]></description>
<content:encoded><![CDATA[<p>Il recente rilascio di VLC basato su QT4, il progetto di mozilla-qt, skype, licq, mi hanno spinto a pensare ad un <strong>desktop basato su applicazioni QT4 standalone, ovvero senza il mattone di KDE4</strong>.<br />
Effettuando delle ricerche mi sono accorto che questa mia attrazione per le librerie grafiche di Trolltech e nel contempo "non-voglia" di utilizzare KDE4 è una cosa alquanto singolare e quei pochi che ci hanno provato si sono subito arresi. Mi sono così subito messo a cercare/provare applicazioni nuove indipendenti da KDE che sostituissero le mie attuali applicazioni in gtk, usando un semplice wm come pekwm o awesome. Ho praticamente trovato tutte le alternative impacchettando io stesso dei nuovi programmi qt4 su AUR.<br />
Bene quello che sembrava un sogno si stava realizzando! Ho aperto due topic, nel forum nazionale e in quello internazionale di archlinux, con la lista delle applicazioni alternative che aggionerò man mano.</p>
<p>IT <a href="http://www.archlinux.it/forum/viewtopic.php?pid=20192">http://www.archlinux.it/forum/viewtopic.php?pid=20192</a><br />
INT <a href="http://bbs.archlinux.org/viewtopic.php?pid=429971">http://bbs.archlinux.org/viewtopic.php?pid=429971</a></p>
<p style="text-align:left;">Avevo praticamente trovato tutto, cosa mancava? <strong>Un programma per l'editing grafico che sostituisse gimp</strong>, pare infatti che l'unico al momento sia Krita, completamente dipendente da KDE, in alternativa c'è pixel a pagamento. Ci sono andato vicino ma aimè ho dovuto abbandonare il mio desktop qt-based per tornare a gtk2+...spero di trovare presto un programma grafico qt che sostituisca gimp!</p>
[caption id="" align="aligncenter" width="283" caption="QT"]<a href="http://toastedtech.files.wordpress.com/2008/02/qt.gif"><img title="QT" src="http://toastedtech.files.wordpress.com/2008/02/qt.gif" alt="QT" width="283" height="283" /></a>[/caption]
]]></content:encoded>
</item>
<item>
<title><![CDATA[Using Qt Resource Files]]></title>
<link>http://mprnotes.wordpress.com/?p=10</link>
<pubDate>Sun, 05 Oct 2008 10:32:01 +0000</pubDate>
<dc:creator>mprnotes</dc:creator>
<guid>http://mprnotes.pl.wordpress.com/2008/10/05/using-qt-resource-files/</guid>
<description><![CDATA[Sometimes when you write an application you might have some problems with your icons if you put all ]]></description>
<content:encoded><![CDATA[<p>Sometimes when you write an application you might have some problems with your icons if you put all your images in a directory called "images" inside your application's directory and then try to call the application from the command line somewhere else outside your application's directory. The problem is that your icons will not appear, because the directory "images" is relative to your application's directory.</p>
<p>To avoid this problem one could use the Qt Resource files to produce a .py module and then access all the icons from this module. First, you must create a .qrc file with the details of the resources you want to include. The .qrc file is a simple XML text file like the example below:</p>
<p>[sourcecode language='html']<br />
<!DOCTYPE RCC><RCC version="1.0"><br />
<qresource><br />
<file alias="appicon.png">images/appicon.png</file><br />
<file alias="exit.png">images/exit.png</file><br />
<file alias="fileexport.png">images/fileexport.png</file><br />
<file alias="fileimport.png">images/fileimport.png</file><br />
<file alias="fileopen.png">images/fileopen.png</file><br />
<file alias="help.png">images/help.png</file><br />
</qresource><br />
</RCC><br />
[/sourcecode]</p>
<p> Then you must run pyrcc4 with the following command to produce a resource module from this resource file</p>
<p><code>pyrcc4 -o resources_rc.py resources.qrc</code></p>
<p>Finally, you import your resources_rc.py module into your main application and you can use images with the following syntax: QIcon(":/help.png"), where the leading :/ informs PyQt that you are using a resource file.</p>
<p>You can also use resource files with Qt Designer as the following image suggests. </p>
<p><a href="http://mprnotes.wordpress.com/files/2008/10/resourceqtdesigner.png"><img src="http://mprnotes.wordpress.com/files/2008/10/resourceqtdesigner.png" alt="" title="resourceqtdesigner" width="436" height="297" class="aligncenter size-full wp-image-11" /></a></p>
<p>After the creation of your resources you can simple drag and drop an icon, for example, from the Resource Editor into the icon property of the object you want to add a icon in your Property Editor.</p>
<p>Have fun!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[QT? No Gtk? Bleah!]]></title>
<link>http://thegaiden.wordpress.com/?p=18</link>
<pubDate>Sat, 04 Oct 2008 12:52:30 +0000</pubDate>
<dc:creator>Gaiden</dc:creator>
<guid>http://thegaiden.pl.wordpress.com/2008/10/04/18/</guid>
<description><![CDATA[Le applicazioni gtk (firefox, X-chat, emesene, ecc) avviate con KDE (che usa le QT) esteticamente fa]]></description>
<content:encoded><![CDATA[<p>Le applicazioni gtk (firefox, X-chat, emesene, ecc) avviate con KDE (che usa le QT) esteticamente fanno davvero schifo...</p>
<p>per sistemare la situazione installate il pacchetto gtk-qt-engine</p>
<p><span style="color:#008000;"><code>pacman -S gtk-qt-engine</code></span></p>
<p>riavviate kde e poi mi dite la differenza!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Creating MacOSX Qt project with qmake]]></title>
<link>http://karoliinasalminen.wordpress.com/?p=119</link>
<pubDate>Sat, 04 Oct 2008 11:43:42 +0000</pubDate>
<dc:creator>karoliinasalminen</dc:creator>
<guid>http://karoliinasalminen.pl.wordpress.com/2008/10/04/creating-macosx-qt-project-with-qmake/</guid>
<description><![CDATA[It is not obvious and not clearly described in the qmake help, therefore I am typing what you need t]]></description>
<content:encoded><![CDATA[<p>It is not obvious and not clearly described in the qmake help, therefore I am typing what you need to do to here:</p>
<p>qmake -project<br />
qmake -spec macx-g++ yourprojectname.pro</p>
<p>after that you can run:</p>
<p>qmake<br />
make</p>
<p>(And your program is compiled)</p>
<p>You can now edit the pro -file as suits you best. To make it effect again, run qmake without parameters. If you encounter weird errors after changing the .pro -file, it might be because you have not run make clean. So after doing this, always run make clean before attempting to compile, otherwise you may get some headaches about issues that actually do not exist.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Suchtreffer auf G33KY^2]]></title>
<link>http://drazraeltod.wordpress.com/?p=848</link>
<pubDate>Sat, 04 Oct 2008 11:36:50 +0000</pubDate>
<dc:creator>Dr. Azrael Tod</dc:creator>
<guid>http://drazraeltod.pl.wordpress.com/2008/10/04/suchtreffer-auf-g33ky2/</guid>
<description><![CDATA[Viele Leute kommen auf der Suche nach seltsamen Dingen von Google, Yahoo oder ähnlichen Seiten zu u]]></description>
<content:encoded><![CDATA[<p>Viele Leute kommen auf der Suche nach seltsamen Dingen von Google, Yahoo oder ähnlichen Seiten zu uns. Dies soll mal ein Versuch sein ihnen die richtige Adresse zu nennen oder zumindest einen bösartigen Kommentar dazu abzugeben. (Man tut ja alles um zu helfen.)<!--more--></p>
<table border="1">
<tbody>
<tr>
<td>ascii-zeichen-figuren</td>
<td>Dieser Suchtreffer bezieht sich wohl auf meinen <a href="/2008/08/26/ascii-art/" target="_self">Artikel über ASCII-Art</a>. Um es mal kurz auf einen Link zu reduzieren: versuch mal <a href="http://www.jave.de" target="_blank">JavE</a></td>
</tr>
<tr>
<td>jabber client qt</td>
<td>Das ist einfach, da könnte ich z.B. <a title="Psi-IM" href="http://psi-im.org" target="_blank">Psi</a> empfehlen. Alternativ gäbe es da aber auch noch andere.</td>
</tr>
<tr>
<td>battletech atlas ii</td>
<td>Ein wirklich schöner Mech... ich hätte <a href="/2006/07/13/atlas-battletech/" target="_self">ein Gedicht dazu</a> im Angebot.</td>
</tr>
<tr>
<td>rachermaad</td>
<td>Das ist <a href="http://de.wikipedia.org/wiki/Rauchemaad" target="_blank">sone Art Klitscher</a>... *g*<br />
ein sehr einfaches, erzgebirgisches Kartoffelgericht</td>
</tr>
<tr>
<td>jornada skype</td>
<td>Das wird etwas schwierig, <a href="http://www.skype.com/download/skype/windowsmobile/" target="_blank">Skype</a> gibt es zwar für PocketPC, aber leider nicht für Hitachi-SH3-CPUs compiliert. Das könnte daran liegen dass SH3 schon seit etlichen Jahren nicht mehr für PPCs unterstützt wird.</td>
</tr>
<tr>
<td>politische webcomics</td>
<td>Wirklich rein-politisch gibt es wohl nichts, aber z.B. bei <a href="http://www.phdcomics.com" target="_blank">PHD</a> gehts oft um Bildungspolitik, bei <a href="http://www.dabeavercomics.com" target="_blank">DaBeaver</a> gehts oft um Umweltpolitik, <a href="http://geekandpoke.typepad.com/" target="_blank">Geek And Poke</a>, <a href="http://www.joyoftech.com">Joy of Tech</a>,<a href="http://www.xkcd.com" target="_blank">XKCD</a>, <a href="http://www.leasticoulddo.com" target="_blank">LICD</a>, <a href="http://www.der-flix.de">Flix</a> und selbst <a href="blog.beetlebum.de" target="_blank">Jojo</a> können auch manchmal politisch werden (grob absteigend geordnet)<br />
Wem das nicht reicht, dem empfehle ich meinen <a href="http://feeds.feedburner.com/webcomix">Webcomic-Newsfeed</a> in dem ich diese und viele andere sortiere/sammel.</td>
</tr>
<tr>
<td>python schneller als java</td>
<td>Das ist ne blöde Frage/Aussage/wasauchimmer... Man kann das wirklich nur sehr schlecht vergleichen und sollte es auch nicht tun. Aber mal von den Einsatzgebieten der Sprachen her betrachtet, vermute ich mal dass Python bei vielen kleinen Anwendungen die sich nicht oft wiederholen evtl. die Nase vorn haben könnte. Aber wie gesagt.. bitte keine Äpfel und Orangen vergleichen.</td>
</tr>
<tr>
<td>rox-filer</td>
<td><a href="http://roscidus.com/desktop/" target="_blank">Rox</a> ist ein sehr schöner, schneller Filemanager/Desktop. Ich selbst <a href="http://drazraeltod.wordpress.com/2008/04/23/show-me-your-linux-desktop/">verwende ihn auf meinem Notebook</a> mit FVWM-Chrystal und erhalte so ein durchaus verwendbares System das selbst auf meinem Uraltgerät noch schön schnell läuft.</td>
</tr>
<tr>
<td>mcabber jingle</td>
<td>MUHAHAHAHA! Der Witz war gut! <a href="www.lilotux.net/~mikael/mcabber/" target="_blank">mcabber</a> mag für einen Jabber-Client auf Konsolenbasis besser sein als die meisten vergleichbaren Projekte, aber ich wüsste nicht dass auch nur geplant wäre <a href="googletalk.blogspot.com/2005/12/what-is-libjingle.htm" target="_blank">libjingle</a> für IRGENDEINE Funktion zu unterstützen. Wenn man also via Jabber einen Audiochat aufbauen will muss man wohl auch die nächsten paar Monate noch auf einen grafischen Client zurückgreifen. (Und selbst dafür muss man erstmal einen finden der das kann.)</td>
</tr>
<tr>
<td>der immense usus exterritorialer vokabeln</td>
<td>Vollständig lautet der Text: "Der immense Usus exterritorialer Vokabeln in der germanistischen Linguistik ist mit dezidiertem Fanatismus auf das maximale Minimum zu reduzieren!" Jetzt fragt mich bloß nicht woher der im Original mal stammt!</td>
</tr>
<tr>
<td>cinemizer laptop arbeiten</td>
<td>Schön wärs ja.. aber erstens ist die Auflösung beim <a href="/2008/07/10/test-zeiss-cinemizer/">Cinemizer</a> mit 640x480 nicht wirklich zum Arbeiten geeignet und zweitens kann man das seltsame Ding nur unter sehr großen Schmerzen mit etwas anderem verwenden als einem IPod.</td>
</tr>
</tbody>
</table>
<p>Das soll dann auch erstmal für heute reichen, evtl. setze ich das bei Gelegenheit ja mal fort.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Nokia cambia nome a Trolltech e presenta le sue novità]]></title>
<link>http://markoblog.wordpress.com/?p=2351</link>
<pubDate>Sat, 04 Oct 2008 10:07:09 +0000</pubDate>
<dc:creator>marko</dc:creator>
<guid>http://markoblog.pl.wordpress.com/2008/10/04/nokia-cambia-nome-a-trolltech-e-presenta-le-sue-novita/</guid>
<description><![CDATA[
Evidentemente a Nokia il nome Trolltech non andava molto a genio: il colosso norvegese ha infatti r]]></description>
<content:encoded><![CDATA[<p><a href="http://markoblog.files.wordpress.com/2008/10/qt_software.png"><img class="alignnone size-full wp-image-2352" title="qt_software" src="http://markoblog.wordpress.com/files/2008/10/qt_software.png" alt="" width="432" height="128" /></a></p>
<p>Evidentemente a Nokia il nome Trolltech non andava molto a genio: il colosso norvegese ha infatti rinominato Trolltech in “Qt Software” ed il framework per dispositivi mobile/embedded Qtopia in “Qt Extended”. Nello stesso giorno del cambio di nome sono stati aperti i sorgenti della versione Linux di <a href="http://trolltech.com/about/news/qt-eclipse-integration-for-linux-x11-now-available-under-gpl">Qt Eclipse Integration</a> e rilasciati <a href="http://trolltech.com/about/news/qt-extended-4.4-released">Qt Extended (Qtopia) 4.4</a> e <a href="http://trolltech.com/about/news/qt-jambi-4.4.3-released">Qt Jambi 4.4.3</a>. Per chi fosse interessato, Ars Technica offre una <a href="http://arstechnica.com/news.ars/post/20080930-nokia-launches-linux-based-qt-extended-mobile-platform.html">panoramica delle novità incluse in Qt Extended 4.4</a>.</p>
<p>In occasione della sua adesione alla <a href="http://www.linuxfoundation.org/en/Main_Page">Linux Foundation</a> come <a href="http://www.linuxfoundation.org/en/Members">Gold Sponsor</a>, Nokia ha inoltre svelato <a href="http://www.brighthand.com/default.asp?newsID=14386">alcune delle caratteristiche della prossima versione di Maemo</a>, la sua piattaforma per Internet Tablet: tra queste sono presenti la compatibilità con il <a href="http://en.wikipedia.org/wiki/High_Speed_Packet_Access">protocollo HSPA</a>, la migrazione ai processori OMAP3 di Texas Instrument ed il supporto a sensori grafici ad alta definizione</p>
<p style="text-align:right;">[via: phoronix.com &#124;&#124; ossblog.it]</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Qt Contest 2008: che Trolltech sia con te]]></title>
<link>http://kslacky.wordpress.com/?p=121</link>
<pubDate>Fri, 03 Oct 2008 18:40:12 +0000</pubDate>
<dc:creator>kslacky</dc:creator>
<guid>http://kslacky.pl.wordpress.com/2008/10/03/qt-contest-2008-che-trolltech-sia-con-te/</guid>
<description><![CDATA[Eccomi qua di nuovo. Oggi mi va si scrivere e subito approfitto a mettere nero su bianco alcune noti]]></description>
<content:encoded><![CDATA[<p>Eccomi qua di nuovo. Oggi mi va si scrivere e subito approfitto a mettere nero su bianco alcune notizie. Siccome sono un fan sfegatato delle Qt di Trolltech mi sono messo di buona lena e ho partecipato al <a href="http://www.qtcentre.org/contest-" target="_blank">Qt Contest 2008</a>. Ah, qualcuno fa cenno di fermarmi. Non ha capito di cosa parlo. Ok, le Qt sono un toolkit, ovvero un insierme di strumenti per creare applicazioni grafiche e non. In pratica sono un insieme di librerie che mettono a disposizione nel linguaggio C++ (anche in Java se si pensa al QtJambi, ma quest'articolo non focalizza su QtJambi) una serie di classi per svolgere i più svariati compiti: operare su file XML, usare SQL, thread, creare elementi grafici vari, creare browser web, visualizzare immagini vettoriali SVG, operare con interfacce di rete, ...<!--more--></p>
<p>Sì, questa serie di classi sono molto potenti, inoltre sono multi piattaforma, ovvero funzionano per Microsoft Windows, Mac OS X, GNU/Linux, FreeBSD, OpenBSD, NetBSD e Unix vari. Ovvero si ha la comodità di scrivere il codice una volta e di ricompilarlo sulle varie piattaforme. Qt ha due licenze. Una licenza libera (GPL, LGPL, ...) e una commerciale. La prima permette di usare le Qt per una applicazione che sarà rilasciata con una licenza libera di cui si rende disponibile tutto il codice sorgente. La seconda è per coloro che non vogliono mettere a disposizione i sorgenti, ma desiderano vendere l'applicazione e rilasciare solo il file eseguibile. Qt è disponibile anche per Windows CE e permette di creare applicazioni per diversi dispositivi embedded, ovvero "computer" di piccola dimensione di limitate prestazioni (poca memoria, processore "lento"). Sul sito di Trolltech troverete tutte le informazioni: <a href="http://www.trolltech.com/" target="_blank">www.trolltech.com</a>. Trolltech, inoltre, è stata acquisita da Nokia e il che fa ben sperare. La qualità e la versatilità del codice renderà disponibili le Qt anche per dispositivi Nokia di ultima generazione che sono a metà strada tra un cellulare e un palmare dove si annotano appuntamenti, si naviga su internet, ci si può collegare a una rete wireless ecc...</p>
<h2>Il contest 2008</h2>
<p>Ritorniamo a parlare di questo famoso Contest 2008. In pratica la Trolltech/Nokia mette a disposizione dei premi per il miglior codice C++ scritto con le Qt. Una bella sfida. Ci sono varie categorie. Programmare con Qt è una cosa davvero rilassante. Si fanno tante cose con poco codice. Per esempio, mostrai come creare un browser elementare a dei ragazzi a Open Mind con tre linee di codice grazie a QtWebKit.</p>
<p>Al contest ho presentato <strong>QRunner</strong>. Ancora non scaricabile da nessuna parte. L'idea è venuta fuori a un mio collega di lavoro quando circa due anni fa ci ritrovavamo a fare dei test per un gateway/router basato su una distribuzione GNU/Linux. Eravamo costretti a fare sempre clic e clic e clic. Allora il mio collega pensò a organizzare una serie di script per testare le funzionalità Web con cui si configurava il gateway/router multifunzione e pensò anche di farmi realizzare una interfaccia grafica per gestire gli stessi script. Organizzarli in gruppi e sottogruppi. Abilitare e disabilitare alcuni di essi senza rimuoverli dal progetto. Associare delle proprietà a ogni singolo script in modo indipendente dagli altri. Proprietà come l'esecuzione ripetuta di uno script per N volte, possibilità di avere una linea di comando per lo script e un proprio ambiente di esecuzione (assegnando delle variabili d'ambiente). Mi misi con interesse perché prima di allora avevo programmato solo con Qt3, quindi era un buon motivo per mettere mano alle Qt4 e ne restai travolto. Le Qt3 mi piacevano, ma le Qt4 sono ancora meglio. Hanno rivoluzionato la programmazione C++ anche se oggi nessuno, in ambito lavorativo, le usa... Non sanno cosa si perdono ;) (Tutti si rivolgono a Java, Java e Java, anche per mettere su applicazioni che una volta si facevano con M$ Visual Studio in C++).</p>
<p>L'applicazione salva il progetto in XML, carica il progetto riassegnando tutte le proprietà agli script e durante l'esecuzione degli stessi si producono dei file di log accessibili sia all'atto dell'esecuzione dello script sia in seguito alla chiusura dello stesso. Si può decidere di non eseguire l'intero progetto ma un solo sottogruppo di script, o anche uno solo. Si possono immette parametri a tempo di esecuzione se lo script ne necessita. L'attività e l'evoluzione dei processi è resa anche in modalità grafica, ovvero uno script in esecuzione diventa arancione e diventa rosso se per qualche motivo si sono verificati errori o verde se è terminato correttamente.</p>
<p>Il contest è interessante perché mi ha dato la possibilità di imparare e giocare molto con il Drag &#38; Drop, infatti gli script vengono immessi nel progetto trascinandoli direttamente dal file system, inoltre il codice verrà valutato da un serie di esperti e finalmente potrò capire quanto sono bravo/pessimo nello scrivere in C++ :) .</p>
<p>In attesa dei risultati, se volete e se vi ho sufficientemente incuriositi, è possibile scaricare da <a title="KDE Italia" href="http://www.kde-it.org/" target="_blank">KDE Italia</a> una presentazione per imparare le basi minime per operare con Qt. Sono un semplice punto di partenza, ma sono sufficienti per cominciare con piccole applicazioni.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Debugging signals and slots in Qt]]></title>
<link>http://samdutton.wordpress.com/?p=28</link>
<pubDate>Fri, 03 Oct 2008 14:07:19 +0000</pubDate>
<dc:creator>samdutton</dc:creator>
<guid>http://samdutton.pl.wordpress.com/2008/10/03/debugging-signals-and-slots-in-qt/</guid>
<description><![CDATA[
1. Check for compiler warnings about non-existent signals and/or slots.
2. Use break points or qD]]></description>
<content:encoded><![CDATA[<div>
<p>1. <span class="838280912-03102008">Check </span>for compiler warnings <span class="838280912-03102008">about</span> non-existent signals and/or slots.</p>
<p>2. Use break points or qDebug to check that signal and slot code is  definitely reached:<br />
- the connect statement<br />
- code where the signal is  fired<br />
- the slot code.</p>
<p>3. Check that the parameter types of the signal and slot are exactly correct  and, <span class="838280912-03102008">as </span>appropriate, that they match.</p>
<p>4. Make sure you haven't added a name to the signal or slot argument: for  example, use textChanged(const QString &#38;) not textChanged(const QString  &#38;text).</p>
<p>5. Check that the connect argument types and syntax are correct. The connect  statement should look like this: SIGNAL(mySignal(...)), receiver object,  SLOT(mySlot(...)). Check brackets, check that SIGNAL and SLOT are capitalised  and that the sender and receiver are both objects, not class names.</p>
<p>6. Check that the signal is being fired as expected. You can do this with  code like the following:<br />
connect(this, SIGNAL(mySignal()), qApp,  SLOT(aboutQt()));</p>
<p>7. Check that slots are declared correctly in the public/protected/private  slots sections of your class declaration (not the public/protected/private  sections).</p>
<p>8. If you use custom signals, check that these are declared correctly, with a  void return type, in the signals section of your class declaration.</p>
<p>9. Make sure the Q_OBJECT macro is inserted at the beginning of your class  declaration.</p>
<p>10. Check that classes using signals and slots inherit QObject or a QObject  subclass.</p>
<p>11. Make sure to run qmake after adding the Q_OBJECT macro to a class.</p>
<p>12. Use break points or qDebug to check that slots are being called the  appropriate number of times: make sure the connection isn't made repeatedly.</p>
<p>13. Put all connect statements before functions calls that may fire their  signals, to ensure that the connections are made before the signals are  fired. For example:</p>
<pre><span class="838280912-03102008">   _myObj </span>= new <span class="838280912-03102008">MyClass();</span>
<span class="838280912-03102008">   </span>connect(<span class="838280912-03102008">_</span>myObj, SIGNAL(<span class="838280912-03102008">somethingHappend</span>()),<span class="838280912-03102008"> </span>SLOT(<span class="838280912-03102008">doSomething</span>()));
<span class="838280912-03102008">   _myObj</span>-&#62;<span class="838280912-03102008">init</span>();</pre>
<p><span class="838280912-03102008">not</span></p>
<pre><span class="838280912-03102008">
<pre><span class="838280912-03102008">   _myObj </span>= new <span class="838280912-03102008">MyClass();</span>
<span class="838280912-03102008">   _myObj</span>-&#62;<span class="838280912-03102008">init</span>();
   connect(<span class="838280912-03102008">_</span>myObj, SIGNAL(<span class="838280912-03102008">somethingHappend</span>()),<span class="838280912-03102008"> </span>SLOT(<span class="838280912-03102008">doSomething</span>()));</pre>
<p></span></pre>
<p>14. Check that your connections aren't affected by disconnect statements.</p>
<p>15. Don't add a semi-colon after Q_OBJECT:</p>
<pre><span class="838280912-03102008">   </span>{
<span class="838280912-03102008">   </span>Q_OBJECT
<span class="838280912-03102008">   </span>...
<span class="838280912-03102008">   </span>}</pre>
<p>not</p>
<pre><span class="838280912-03102008">   </span>{
<span class="838280912-03102008">   </span>Q_OBJECT;
<span class="838280912-03102008">   </span>... 
<span class="838280912-03102008">   </span>}</pre>
<p>16. Check the return value of the connect statement: connect returns true if it successfully connects the signal to the slot.</p>
<p>17. Follow Qt's naming conventions for signals and slots:</p>
<p>signal: somethingHappened()<br />
slot: doSomething()</p>
<p>In grammatical terms, signal names are <span class="838280912-03102008">usually</span> constructed from a past participle:  changed, pressed, etc. They describe an event or change of state that has  occurred.<span class="838280912-03102008"> </span>Slot names are imperative verbs  and describe an action to be done: clear, setDate, etc.</div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Inhibiting]]></title>
<link>http://drfav.wordpress.com/?p=53</link>
<pubDate>Wed, 01 Oct 2008 23:05:00 +0000</pubDate>
<dc:creator>drfav</dc:creator>
<guid>http://drfav.pl.wordpress.com/2008/10/02/inhibiting/</guid>
<description><![CDATA[Disclaimer: this post is mainly for Developers!!
That said, I thought a blog post would have been be]]></description>
<content:encoded><![CDATA[<p>Disclaimer: this post is mainly for Developers!!</p>
<p>That said, I thought a blog post would have been better to explain the new, cool Inhibition feature in PowerDevil/Solid. On my message to the list I've been unclear, and let me say _don't use the DBus interface_ but the provided methods. So let me show a sample of an application inhibiting suspension.</p>
<p><code>void InhibitTest::setInhibition()<br />
{<br />
    kDebug() &#60;&#60; "Setting inhibition";<br />
    m_cookie = Solid::PowerManagement::beginSuppressingSleep("We're testing inhibition, don't bother us!");<br />
}</p>
<p>void InhibitTest::releaseInhibition()<br />
{<br />
    kDebug() &#60;&#60; "Releasing inhibition";<br />
    Solid::PowerManagement::stopSuppressingSleep(m_cookie);<br />
    qApp-&#62;exit();<br />
}</p>
<p>int main(int argc, char **argv)<br />
{<br />
    KAboutData aboutData( "testinhibit", 0, ki18n("Test Inhibition"),<br />
    "1.0", ki18n(""), KAboutData::License_GPL,<br />
    ki18n(""), ki18n(""));<br />
    KCmdLineArgs::init(argc, argv, &#38;aboutData);<br />
    KApplication app(true);<br />
    app.setQuitOnLastWindowClosed(false);<br />
    InhibitTest test;<br />
    test.setInhibition();<br />
    QTimer::singleShot(15000, &#38;test, SLOT(releaseInhibition()));<br />
    app.exec();<br />
}</code></p>
<p>Seen how easy it is? You just have to call the static method Solid::PowerManagement::beginSuppressingSleep() specifying a reason for your inhibition, and store the cookie it returns. If you try to suspend after you call it, you get this:</p>
[caption id="attachment_54" align="aligncenter" width="434" caption="Inhibiting suspension, dude"]<a href="http://drfav.wordpress.com/files/2008/10/pwdnotify1.png"><img src="http://drfav.wordpress.com/files/2008/10/pwdnotify1.png" alt="Inhibiting suspension, dude" title="No way!" width="434" height="74" class="size-full wp-image-54" /></a>[/caption]
<p>Yeah, I've also improved notifications, but this will come in a future post :D The user will be notified and suspension won't happen.</p>
<p>When you want to release the lock, Solid::PowerManagement::stopSuppressingSleep() is your friend, just pass it the cookie you stored before (you did store it, right?), and that's enough.</p>
<p>This feature is really cool. I see a lot of cool usages, for example in video players, package managers, whatever else. And given the fact it's just a private member+2 lines of code, integration is really easy :)</p>
<p>P.S.: A post with all new cool stuff in Powerdevil is coming, and PowerDevil 1.3.0 for KDE4.1 is coming too :)</p>
]]></content:encoded>
</item>

</channel>
</rss>
