﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-RTY 实践出真知-随笔分类-Qt</title><link>http://www.cppblog.com/lauer3912/category/15566.html</link><description>没有理由不学习</description><language>zh-cn</language><lastBuildDate>Sat, 19 Jul 2014 10:37:11 GMT</lastBuildDate><pubDate>Sat, 19 Jul 2014 10:37:11 GMT</pubDate><ttl>60</ttl><item><title>/Library/Frameworks/QtCore.framework/Headers/qglobal.h:68: error: algorithm: No such file or directory</title><link>http://www.cppblog.com/lauer3912/archive/2012/11/07/194823.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 06 Nov 2012 22:22:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/11/07/194823.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/194823.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/11/07/194823.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/194823.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/194823.html</trackback:ping><description><![CDATA[一般发生在使用最新的XCode。@import url(http://www.cppblog.com/cutesoft_client/cuteeditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
<div><br />
</div>
<div>怎么来解决问题呢，其实</div>
<div><a href="http://qt-project.org/forums/viewthread/11741">http://qt-project.org/forums/viewthread/11741</a>&nbsp;一文中有讲到。</div>
<div><br />
</div>
<div>直接一点，就是在指定Complier的时候，选择Clang，不要选择GCC！</div>
<div><br />
</div>
<div>你可以试试！有问题可以咨询我！</div><img src ="http://www.cppblog.com/lauer3912/aggbug/194823.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-11-07 06:22 <a href="http://www.cppblog.com/lauer3912/archive/2012/11/07/194823.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>QML 中调用本地标准的对话框如：QFileDialog  QFontDialog  Google搜索关键字qml qfiledialog (Qt5)</title><link>http://www.cppblog.com/lauer3912/archive/2012/10/06/192893.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sat, 06 Oct 2012 00:10:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/10/06/192893.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/192893.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/10/06/192893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/192893.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/192893.html</trackback:ping><description><![CDATA[其实最为重要的一点，就是App的类型：<div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;">Qt5 中包括：</div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;">QObject -&gt;&nbsp;<span style="font-size: 14px; ">QCoreApplication -&gt;&nbsp;QGuiApplication -&gt;&nbsp;QApplication</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; "><br /></span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; ">一般，QML的程序使用</span><span style="font-size: 14px;">QGuiApplication，如果使用QGuiApplication的话，那么QtWidget的相关类就不能运行正常了。</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px;">需要使用QApplication类来处理，这样，QtWidget的相关类就可以使用了。</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; ">特别是我们对标准对话框（QFileDialog\ QFontDialog \ QColorDialog）等等</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; "><br /></span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; "><br /></span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; ">下面上代码：</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; "><br /></span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; "><br /></span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; ">main.cpp</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><span style="font-size: 14px; ">=====================================================================</span></div><div style="font-family: 'Courier New'; font-size: 12px; line-height: normal;"><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="display: inline-block; color: #55ffff; background-color: silver;">//![0]</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #5555ff; ">#include</span> <span style="color: #ff55ff; ">"piechart.h"</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #5555ff; ">#include</span> <span style="color: #ff55ff; ">&lt;QtQuick/QQuickView&gt;</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #5555ff; ">#include</span> <span style="color: #ff55ff; ">&lt;QGuiApplication&gt;</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #5555ff; ">#include</span> <span style="color: #ff55ff; ">&lt;QApplication&gt;</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #ffff55; ">int</span> main<span style="color: #aaaaaa; ">(</span><span style="color: #ffff55; ">int</span> argc<span style="color: #aaaaaa; ">,</span> <span style="color: #ffff55; ">char</span> <span style="color: #aaaaaa; ">*</span>argv<span style="color: #aaaaaa; ">[])</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="display: inline-block; color: #aaaaaa; background-color: silver;">{</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> QApplication app<span style="color: #aaaaaa; ">(</span>argc<span style="color: #aaaaaa; ">,</span> argv<span style="color: #aaaaaa; ">);</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> qmlRegisterType<span style="color: #aaaaaa; ">&lt;</span><span style="color: #55ff55; ">PieChart</span><span style="color: #aaaaaa; ">&gt;(</span><span style="color: #ff55ff; ">"Charts"</span><span style="color: #aaaaaa; ">,</span> <span style="color: #ff55ff; ">1</span><span style="color: #aaaaaa; ">,</span> <span style="color: #ff55ff; ">0</span><span style="color: #aaaaaa; ">,</span> <span style="color: #ff55ff; ">"PieChart"</span><span style="color: #aaaaaa; ">);</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> QQuickView view<span style="color: #aaaaaa; ">;</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> view<span style="color: #aaaaaa; ">.</span>setResizeMode<span style="color: #aaaaaa; ">(</span>QQuickView<span style="color: #aaaaaa; ">::</span>SizeRootObjectToView<span style="color: #aaaaaa; ">);</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> view<span style="color: #aaaaaa; ">.</span>setSource<span style="color: #aaaaaa; ">(</span>QUrl<span style="color: #aaaaaa; ">::</span>fromLocalFile<span style="color: #aaaaaa; ">(</span><span style="color: #ff55ff; ">"app.qml"</span><span style="color: #aaaaaa; ">));</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> view<span style="color: #aaaaaa; ">.</span>show<span style="color: #aaaaaa; ">();</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #ffff55; ">return</span> app<span style="color: #aaaaaa; ">.</span>exec<span style="color: #aaaaaa; ">();</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="display: inline-block; color: #aaaaaa; background-color: silver;">}</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="display: inline-block; color: #55ffff; background-color: silver;">//![0]</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #55ffff;"><br /></span></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #55ffff;">=======================================================================================</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; ">PieChart.h</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">=======================================================================================</pre><pre style="margin-top: 0px; margin-bottom: 0px; "><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#ifndef</span> PIECHART_H</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#define</span> PIECHART_H</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#include</span> <span style="color: #008000; ">&lt;QtQuick/QQuickPaintedItem&gt;</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#include</span> <span style="color: #008000; ">&lt;QColor&gt;</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![0]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">class</span> <span style="color: #800080; ">PieChart</span> : <span style="color: #808000; ">public</span> QQuickPaintedItem</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![0]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">Q_OBJECT</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">Q_PROPERTY</span>(QString name READ name WRITE setName)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">Q_PROPERTY</span>(QColor color READ color WRITE setColor)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![1]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">public</span>:</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![1]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">PieChart</span>(QQuickItem *parent = <span style="color: #000080; ">0</span>);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> QString name() <span style="color: #808000; ">const</span>;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">void</span> setName(<span style="color: #808000; ">const</span> QString &amp;name);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> QColor color() <span style="color: #808000; ">const</span>;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">void</span> setColor(<span style="color: #808000; ">const</span> QColor &amp;color);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">void</span> paint(QPainter *painter);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![2]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">Q_INVOKABLE</span> <span style="color: #808000; ">void</span> clearChart();</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">signals</span>:</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">void</span> chartCleared();</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![2]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">private</span>:</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> QString <span style="color: #800000; ">m_name</span>;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> QColor <span style="color: #800000; ">m_color</span>;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![3]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">};</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![3]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#endif</span></pre></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; ">========================================================================================</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">PieChart.cpp</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">========================================================================================</pre><pre style="margin-top: 0px; margin-bottom: 0px; "><pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#include</span> <span style="color: #008000; ">"piechart.h"</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#include</span> <span style="color: #008000; ">&lt;QPainter&gt;</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #000080; ">#include</span> <span style="color: #008000; ">&lt;QFileDialog&gt;</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #800080; ">PieChart</span>::<span style="color: #800080; ">PieChart</span>(QQuickItem *parent)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> : QQuickPaintedItem(parent)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">QString <span style="color: #800080; ">PieChart</span>::name() <span style="color: #808000; ">const</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">return</span> <span style="color: #800000; ">m_name</span>;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">void</span> <span style="color: #800080; ">PieChart</span>::setName(<span style="color: #808000; ">const</span> QString &amp;name)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">m_name</span> = name;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">QColor <span style="color: #800080; ">PieChart</span>::color() <span style="color: #808000; ">const</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">return</span> <span style="color: #800000; ">m_color</span>;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">void</span> <span style="color: #800080; ">PieChart</span>::setColor(<span style="color: #808000; ">const</span> QColor &amp;color)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">m_color</span> = color;</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">void</span> <span style="color: #800080; ">PieChart</span>::paint(QPainter *painter)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> QPen pen(<span style="color: #800000; ">m_color</span>, <span style="color: #000080; ">2</span>);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> painter-&gt;setPen(pen);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> painter-&gt;setRenderHints(QPainter::HighQualityAntialiasing, <span style="color: #808000; ">true</span>);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> painter-&gt;drawPie(boundingRect(), <span style="color: #000080; ">90</span> * <span style="color: #000080; ">16</span>, <span style="color: #000080; ">290</span> * <span style="color: #000080; ">16</span>);</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![0]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">void</span> <span style="color: #800080; ">PieChart</span>::clearChart()</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> QString fileName = QFileDialog::getOpenFileName(<span style="color: #000080; ">0</span>,</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> tr(<span style="color: #008000; ">"Open Image"</span>), <span style="color: #008000; ">""</span>, tr(<span style="color: #008000; ">"Image Files (*.png *.jpg *.bmp)"</span>));</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> setColor(QColor(Qt::transparent));</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> update();</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #808000; ">emit</span> chartCleared();</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![0]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre><pre style="margin-top: 0px; margin-bottom: 0px; ">========================================================================================</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">app.qml</pre><pre style="margin-top: 0px; margin-bottom: 0px; ">========================================================================================</pre><pre style="margin-top: 0px; margin-bottom: 0px; "> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![0]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">import</span> Charts 1.0</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #808000; ">import</span> QtQuick 2.0</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #800080; ">Item</span> {</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">width</span>: 300; <span style="color: #800000; ">height</span>: 200</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">PieChart</span> {</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">id</span>: <span style="font-style: italic; ">aPieChart</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">anchors.centerIn</span>: <span style="font-style: italic; ">parent</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">width</span>: 100; <span style="color: #800000; ">height</span>: 100</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">color</span>: <span style="color: #008000; ">"red"</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">onChartCleared</span>: <span style="font-style: italic; color: #0055af; ">console</span>.log(<span style="color: #008000; ">"The</span> <span style="color: #008000; ">chart</span> <span style="color: #008000; ">has</span> <span style="color: #008000; ">been</span> <span style="color: #008000; ">cleared"</span>)</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> }</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">MouseArea</span> {</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">anchors.fill</span>: <span style="font-style: italic; ">parent</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">onClicked</span>: <span style="font-style: italic; ">aPieChart</span>.clearChart()</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> }</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800080; ">Text</span> {</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">anchors</span> { <span style="color: #800000; ">bottom</span>: <span style="font-style: italic; ">parent</span>.bottom; <span style="color: #800000; ">horizontalCenter</span>: <span style="font-style: italic; ">parent</span>.horizontalCenter; <span style="color: #800000; ">bottomMargin</span>: 20 }</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> <span style="color: #800000; ">text</span>: <span style="color: #008000; ">"Click</span> <span style="color: #008000; ">anywhere</span> <span style="color: #008000; ">to</span> <span style="color: #008000; ">clear</span> <span style="color: #008000; ">the</span> <span style="color: #008000; ">chart"</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "> }</pre> <pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><span style="color: #008000; ">//![0]</span></pre> <pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre></pre><pre style="margin-top: 0px; margin-bottom: 0px; "><br /></pre></div><img src ="http://www.cppblog.com/lauer3912/aggbug/192893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-10-06 08:10 <a href="http://www.cppblog.com/lauer3912/archive/2012/10/06/192893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt4 with Xcode</title><link>http://www.cppblog.com/lauer3912/archive/2012/06/06/177794.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 06 Jun 2012 06:57:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/06/06/177794.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/177794.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/06/06/177794.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/177794.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/177794.html</trackback:ping><description><![CDATA[<div>http://qtnode.net/wiki/Qt4_with_Xcode<br /><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">Setting up the Xcode IDE for developing Qt applications for Mac OS X is relatively simple. There are three options, GNU Make, Carbon, and Xcode makespec. Using the Xcode makespec is the simplest way to get started, but it seems to have problems with certain setups.</p><table id="toc" summary="Contents" style="font-size: 12px; color: #000000; background-color: #f9f9f9; border-style: solid; border-color: #8caf30; padding: 5px; font-family: sans-serif; line-height: 19.049999237060547px; "><tbody><tr><td><div id="toctitle" style="text-align: center; "><h2>Contents</h2>&nbsp;<span style="font-size: 11px; ">[<a id="togglelink" href="" style="color: #64880d; background-image: none; ">hide</a>]</span></div><ul style="line-height: 1.5em; list-style-type: none; margin: 0.3em 0px 0px; padding: 0px; list-style-image: none; text-align: left; "><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Using_the_Xcode_makespec" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">1&nbsp;Using the Xcode makespec</a><ul style="line-height: 1.5em; list-style-type: none; margin: 0px 0px 0px 2em; padding: 0px; list-style-image: none; "><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Create_the_project_bundle" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">1.1&nbsp;Create the project bundle</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Known_Issues" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">1.2&nbsp;Known Issues</a></li></ul></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#As_a_GNU_Make_project" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2&nbsp;As a GNU Make project</a><ul style="line-height: 1.5em; list-style-type: none; margin: 0px 0px 0px 2em; padding: 0px; list-style-image: none; "><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Create_a_new_GNU_Make_project" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2.1&nbsp;Create a new GNU Make project</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Add_a_qmake_target" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2.2&nbsp;Add a qmake target</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Manage_your_.pro_file" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2.3&nbsp;Manage your .pro file</a><ul style="line-height: 1.5em; list-style-type: none; margin: 0px 0px 0px 2em; padding: 0px; list-style-image: none; "><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#If_you_want_to_maintain_your_own_.pro_file:" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2.3.1&nbsp;If you want to maintain your own .pro file:</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#If_you_want_to_use_qmake_-project_to_maintain_your_.pro_file:" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2.3.2&nbsp;If you want to use qmake -project to maintain your .pro file:</a></li></ul></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Building_your_project" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">2.4&nbsp;Building your project</a></li></ul></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#As_a_Carbon_project" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">3&nbsp;As a Carbon project</a><ul style="line-height: 1.5em; list-style-type: none; margin: 0px 0px 0px 2em; padding: 0px; list-style-image: none; "><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Create_a_new_Carbon_project" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">3.1&nbsp;Create a new Carbon project</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Add_Qt_frameworks" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">3.2&nbsp;Add Qt frameworks</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Add_a_Shell_Script_build_phase" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">3.3&nbsp;Add a Shell Script build phase</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Configure_the_compiler_and_linker" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">3.4&nbsp;Configure the compiler and linker</a></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Building_your_project_2" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">3.5&nbsp;Building your project</a></li></ul></li><li style="margin-bottom: 0.1em; "><a href="http://qtnode.net/wiki/Qt4_with_Xcode#Using_Qt_Designer" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">4&nbsp;Using Qt Designer</a></li></ul></td></tr></tbody></table><a name="Using_the_Xcode_makespec" id="Using_the_Xcode_makespec" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h1>Using the Xcode makespec</h1><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">If you don't mind using the console to set up your project, creating a new Xcode project can be done automatically by qmake.</p><a name="Create_the_project_bundle" id="Create_the_project_bundle" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Create the project bundle</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">Create a folder for your project. (You can switch the order of this step with the next.)</li><li style="margin-bottom: 0.1em; ">Open a console such as Terminal.app or an xterm using X11.app.</li><li style="margin-bottom: 0.1em; ">Change directories to the project folder using the&nbsp;<tt>cd</tt>&nbsp;command.</li><li style="margin-bottom: 0.1em; ">Create a&nbsp;<tt>.pro</tt>&nbsp;file. Calling&nbsp;<tt>qmake -project</tt>&nbsp;in an empty folder&nbsp;<strong>will not</strong>&nbsp;produce a suitable&nbsp;<tt>pro</tt>&nbsp;file, but&nbsp;<tt>touch myproject.pro</tt>&nbsp;will.</li><li style="margin-bottom: 0.1em; ">Execute the command&nbsp;<tt>qmake -spec macx-xcode</tt>.</li></ol><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">From here you can close the console and open the&nbsp;<tt>.xcode</tt>&nbsp;bundle created by qmake or you can use the&nbsp;<tt>open</tt>&nbsp;command to launch it from the command line.</p><a name="Known_Issues" id="Known_Issues" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Known Issues</h2><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">These issues are as of Qt/Mac 4.1.3, all experienced using OS X 10.3.9 and Xcode 1.5.</p><ul style="line-height: 19.049999237060547px; list-style-type: square; margin: 0.3em 0px 0px 1.5em; padding: 0px; list-style-image: url(http://qtnode.net/w/skins/qtnode/bullet.gif); font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">Adding files to the Xcode project does not automatically add them to the&nbsp;<tt>.pro</tt>&nbsp;file. The&nbsp;<tt>.pro</tt>&nbsp;file can be edited within the project.</li><li style="margin-bottom: 0.1em; ">Sometimes, adding a header file to the project will cause the build process to fail in dependency checking. There should be a workaround but I have not found it yet.</li><li style="margin-bottom: 0.1em; ">Xcode will sometimes emit spurious internal errors about the build settings. I'm not sure if this is due a bug in qmake, a bug in Xcode, or misconfiguration of my build environment. It is also possible that qmake generates valid Xcode 2.x project files that aren't completely backwards-compatible with Xcode 1.x.</li></ul><a name="As_a_GNU_Make_project" id="As_a_GNU_Make_project" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h1>As a GNU Make project</h1><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">The solution most similar to the traditional build process is to use GNU Make. This uses the traditional build tools and is quicker to set up, but ultimately is less convenient than the other methods.</p><a name="Create_a_new_GNU_Make_project" id="Create_a_new_GNU_Make_project" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Create a new GNU Make project</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">From File | New Project, select "GNU Make".</li></ol><a name="Add_a_qmake_target" id="Add_a_qmake_target" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Add a qmake target</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">From Project | New Target, select "External Target".</li><li style="margin-bottom: 0.1em; ">Name the new target "qmake".</li><li style="margin-bottom: 0.1em; ">Under the new target's settings, under Custom Build Command, specify the full path to the qmake binary in "Build Tool".</li><li style="margin-bottom: 0.1em; ">Erase the contents of the "Arguments" field.</li></ol><a name="Manage_your_.pro_file" id="Manage_your_.pro_file" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Manage your .pro file</h2><a name="If_you_want_to_maintain_your_own_.pro_file:" id="If_you_want_to_maintain_your_own_.pro_file:" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h3>If you want to maintain your own .pro file:</h3><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">From File | New File, select "Empty File in Project".</li><li style="margin-bottom: 0.1em; ">Name the file with a&nbsp;<tt>.pro</tt>&nbsp;extension.</li></ol><a name="If_you_want_to_use_qmake_-project_to_maintain_your_.pro_file:" id="If_you_want_to_use_qmake_-project_to_maintain_your_.pro_file:" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h3>If you want to use&nbsp;<tt>qmake -project</tt>&nbsp;to maintain your .pro file:</h3><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">Duplicate the "qmake" target. Name the new target "qmake -project".</li><li style="margin-bottom: 0.1em; ">Under the new target's settings, under Custom Build Command, set the "Arguments" field to "-project".</li></ol><a name="Building_your_project" id="Building_your_project" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Building your project</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">If using the&nbsp;<tt>qmake -project</tt>&nbsp;method, select "qmake -project" as your active project and click Build to update your .pro file.</li><li style="margin-bottom: 0.1em; ">Select "qmake" as your active project and click Build to run qmake to generate your Makefile.</li><li style="margin-bottom: 0.1em; ">Select your main target and click Build to run make to compile your application.</li></ol><a name="As_a_Carbon_project" id="As_a_Carbon_project" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h1>As a Carbon project</h1><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">Setting up a Qt application as a Carbon project requires more work but gives you better control over the build process and integrates qmake more comfortably into the Xcode toolchain when compared to the GNU Make method. This method produces a project similar to the one created by using the Xcode makespec, but has been deprecated in favor of the more automatic approach.</p><a name="Create_a_new_Carbon_project" id="Create_a_new_Carbon_project" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Create a new Carbon project</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">From File | New Project, select "Carbon application".</li><li style="margin-bottom: 0.1em; ">Delete the main.c and .pch file automatically generated by the template. (Feel free to replace them with a main.cpp file.)</li></ol><ul style="line-height: 19.049999237060547px; list-style-type: square; margin: 0.3em 0px 0px 1.5em; padding: 0px; list-style-image: url(http://qtnode.net/w/skins/qtnode/bullet.gif); font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">Deleting the prefix header is optional; you can use it if you want but it's not portable. If you choose to use it, take out the Carbon include provided by default.</li></ul><a name="Add_Qt_frameworks" id="Add_Qt_frameworks" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Add Qt frameworks</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">Control+click or right-click on "External Frameworks and Libraries" in your project's file tree. Select Add | Existing Frameworks.</li><li style="margin-bottom: 0.1em; ">Find and add QtCore.framework.</li><li style="margin-bottom: 0.1em; ">Repeat to add QtGui.framework and any other frameworks or libraries needed by your application.</li></ol><a name="Add_a_Shell_Script_build_phase" id="Add_a_Shell_Script_build_phase" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Add a Shell Script build phase</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">From Project | New Build Phase, select "New Shell Script Build Phase".</li><li style="margin-bottom: 0.1em; ">Set the script to:<pre style="padding: 1em; border: 1px dashed #a5c08b; background-color: #f9f9f9; line-height: 1.1em; ">/path/to/qt4/bin/qmake </pre></li></ol><span style="font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; background-color: #ffffff; ">make mocables rm MocLinkList for i in `ls moc_*.cpp | sed 's/\\.cpp/\\.o/'`; do make ${i} || exit 1 echo ${i} &gt;&gt; MocLinkList doneBe sure to replace&nbsp;</span><tt style="line-height: 19.049999237060547px; background-color: #ffffff; ">/path/to/qt4/bin/qmake</tt><span style="font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; background-color: #ffffff; ">&nbsp;with the real path to the qmake binary.</span><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">If you intend to use Qt Designer, add&nbsp;<tt>make compiler_uic_make_all</tt>&nbsp;after&nbsp;<tt>make mocables</tt>.</li><li style="margin-bottom: 0.1em; ">If you wish to allow qmake to automatically maintain your .pro file, add&nbsp;<tt>/path/to/qt4/bin/qmake -project</tt>&nbsp;as the first line.</li><li style="margin-bottom: 0.1em; ">Expand the active target in your project's file tree and drag the Shell Script Files step up to be the first step of the build sequence.</li></ol><a name="Configure_the_compiler_and_linker" id="Configure_the_compiler_and_linker" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Configure the compiler and linker</h2><ol style="line-height: 19.049999237060547px; margin: 0.3em 0px 0px 3.2em; padding: 0px; list-style-image: none; font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">From the Project menu, select "Edit Active Target".</li><li style="margin-bottom: 0.1em; ">In the Build tab, find "Other Linker Flags" and set it to "-filelist MocLinkList".</li><li style="margin-bottom: 0.1em; ">Find "Prefix Header" and clear it.</li><li style="margin-bottom: 0.1em; ">Find "Precompile Prefix Header" and uncheck it.</li></ol><ul style="line-height: 19.049999237060547px; list-style-type: square; margin: 0.3em 0px 0px 1.5em; padding: 0px; list-style-image: url(http://qtnode.net/w/skins/qtnode/bullet.gif); font-family: sans-serif; font-size: 13px; background-color: #ffffff; "><li style="margin-bottom: 0.1em; ">Of course, if you chose to use the prefix header, don't clear it. You may or may not wish to precompile it; consult Xcode's documentation.</li></ul><a name="Building_your_project_2" id="Building_your_project_2" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h2>Building your project</h2><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">At this point you can use all of the Xcode build tools directly with no special steps.</p><a name="Using_Qt_Designer" id="Using_Qt_Designer" style="color: rgb(67, 92, 8); background-image: none; background-color: rgb(255, 255, 255); font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "></a><h1>Using Qt Designer</h1><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">Unfortunately, while Xcode allows you to choose external editors for various file types, it seems to lack a way to specify new file types. If you could specify a new file type (i.e. "sourcecode.ui"), it would be a simple matter to associate it with Designer.</p><p style="margin: 0.4em 0px 0.5em; line-height: 19.049999237060547px; font-family: sans-serif; font-size: 13px; background-color: #ffffff; ">This doesn't mean you're out of luck, though. You can add .ui files to your project just like any other file, and if you control+click or right-click the file, selecting "Open with Finder" will launch Designer with the selected file.</p><div id="catlinks" style="border: 1px solid #aaaaaa; background-color: #f9f9f9; padding: 5px; margin-top: 1em; clear: both; font-family: sans-serif; font-size: 13px; line-height: 19.049999237060547px; "><div id="mw-normal-catlinks"><a href="http://qtnode.net/wiki/Special:Categories" title="Special:Categories" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">Category</a>:&nbsp;<span dir="ltr"><a href="http://qtnode.net/wiki/Category:Qt_Setup" title="Category:Qt Setup" style="text-decoration: none; color: #64880d; background-image: none; background-position: initial initial; background-repeat: initial initial; ">Qt Setup</a></span></div></div></div><img src ="http://www.cppblog.com/lauer3912/aggbug/177794.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-06-06 14:57 <a href="http://www.cppblog.com/lauer3912/archive/2012/06/06/177794.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt internal error: qt_menu.nib could not be loaded. </title><link>http://www.cppblog.com/lauer3912/archive/2012/06/06/177793.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Wed, 06 Jun 2012 06:55:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/06/06/177793.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/177793.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/06/06/177793.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/177793.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/177793.html</trackback:ping><description><![CDATA[<span style="font-family: Arial, FreeSans, Helvetica, sans-serif; font-size: 13px; line-height: 17px; background-color: #f0f0f0; ">"Qt internal error: qt_menu.nib could not be loaded. The .nib file should be placed in QtGui.framework/Versions/Current/Resources/ or in the resources directory of your applicaiton bundle."<br /></span><img src ="http://www.cppblog.com/lauer3912/aggbug/177793.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-06-06 14:55 <a href="http://www.cppblog.com/lauer3912/archive/2012/06/06/177793.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转载Qt之QtScript（一）</title><link>http://www.cppblog.com/lauer3912/archive/2012/03/29/169398.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 29 Mar 2012 05:43:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/03/29/169398.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/169398.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/03/29/169398.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/169398.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/169398.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp; &nbsp;前面学习中，很多地方都用到了C++和JavaScript相互通信。今天就学习QtScript模块吧。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; Qt 包含完全集成的 ECMA 标准脚本引擎。Qt Script 集成了 QObject，为脚本提供了 Qt 的信号与槽 (Signals &amp; Slots) 机制，可在 C++ 和脚本之间进行集成。 脚本支持可使开发事半功倍，QtScript提供脚本错误报告，用户可用自己的脚本跟踪程序缺陷.</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp; 下面是一个简单的hello程序。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><div bg_cpp"="" style="width: 687px; "><div><div><strong>[cpp]</strong>&nbsp;<a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a><a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">copy</a><div style="position: absolute; left: 557px; top: 614px; width: 18px; height: 18px; z-index: 99; border-image: initial; "><embed id="ZeroClipboardMovie_1" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_1" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&amp;width=18&amp;height=18" wmode="transparent"></div></div></div><ol start="1"><li style="border-width: initial; border-color: initial; line-height: 18px; ">//main.cpp&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">#include&nbsp;&lt;QtGui/QApplication&gt;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">#include&nbsp;&lt;QMessageBox&gt;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">#include&nbsp;&lt;QtScript/QtScript&gt;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">#include&nbsp;&lt;QPushButton&gt;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">#include&nbsp;"mainwindow.h"&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; "><span style="color: #2e8b57; font-weight: bold; ">int</span>&nbsp;main(<span style="color: #2e8b57; font-weight: bold; ">int</span>&nbsp;argc,&nbsp;<span style="color: #2e8b57; font-weight: bold; ">char</span>&nbsp;*argv[])&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">{&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;Q_INIT_RESOURCE(helloscript);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QApplication&nbsp;app(argc,&nbsp;argv);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QScriptEngine&nbsp;engine;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;//国际化&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QTranslator&nbsp;translator;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;translator.load("helloscript_la");&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;app.installTranslator(&amp;translator);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;engine.installTranslatorFunctions();&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QPushButton&nbsp;button;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QScriptValue&nbsp;scriptButton&nbsp;=&nbsp;engine.newQObject(&amp;button);//生成C++对象的代理脚本对象&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;engine.globalObject().setProperty("button",&nbsp;scriptButton);//将对象注册到javascript&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;//读取js文件&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QString&nbsp;fileName(":/helloscript.js");&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QFile&nbsp;scriptFile(fileName);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;scriptFile.open(QIODevice::ReadOnly);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QTextStream&nbsp;stream(&amp;scriptFile);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QString&nbsp;contents&nbsp;=&nbsp;stream.readAll();&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;scriptFile.close();&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;QScriptValue&nbsp;result&nbsp;=&nbsp;engine.evaluate(contents,&nbsp;fileName);//执行脚本&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;if(result.isError())&nbsp;{//解析js文件是否有错误&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QMessageBox::critical(0,&nbsp;"Hello&nbsp;Script",&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QString::fromLatin1("%0:%1:&nbsp;%2")&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.arg(fileName)//文件名&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.arg(result.property("lineNumber").toInt32())//错误行号&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.arg(result.toString()));//错误信息&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;-1;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;app.exec();&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">}&nbsp;&nbsp;</li></ol></div>&nbsp;&nbsp;<p>&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><div bg_javascript"="" style="width: 687px; "><div><div><strong>[javascript]</strong>&nbsp;<a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a><a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">copy</a><div style="position: absolute; left: 600px; top: 1585px; width: 18px; height: 18px; z-index: 99; border-image: initial; "><embed id="ZeroClipboardMovie_2" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_2" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&amp;width=18&amp;height=18" wmode="transparent"></div></div></div><ol start="1"><li style="border-width: initial; border-color: initial; line-height: 18px; ">//helloscript.js&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">button.text&nbsp;=&nbsp;qsTr('Hello&nbsp;World');//note&nbsp;that&nbsp;the&nbsp;qTr()&nbsp;function&nbsp;is&nbsp;used&nbsp;to&nbsp;allow&nbsp;for&nbsp;translation&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">button.styleSheet&nbsp;=&nbsp;'font-style:&nbsp;italic;&nbsp;color:&nbsp;#12FF12';&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">button.show();//调用show()槽函数&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">button.clicked.connect(&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;function(){&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print('Hello&nbsp;QtScript');&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">);&nbsp;&nbsp;</li></ol></div><p>&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">记住还需要在.pro文件中加入：<span style="color: #800080; ">QT</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; += script</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; 1、QScriptEngine类为程序提供一个嵌入式脚本环境。一个应用程序中可以添加多个脚本引擎；每一个引擎都是一个轻量级自包含的虚拟机。通过调用脚本引擎的evaluate()函数可以执行脚本.</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;</p><div bg_c-sharp"="" style="width: 687px; "><div><div><strong>[c-sharp]</strong>&nbsp;<a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a><a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">copy</a><div style="position: absolute; left: 584px; top: 2045px; width: 18px; height: 18px; z-index: 99; border-image: initial; "><embed id="ZeroClipboardMovie_3" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_3" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&amp;width=18&amp;height=18" wmode="transparent"></div></div></div><ol start="1"><li style="border-width: initial; border-color: initial; line-height: 18px; ">QScriptEngine&nbsp;engine;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">QScriptValue&nbsp;result&nbsp;=&nbsp;engine.evaluate("(3*2)-1");&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">qDebug()&nbsp;&lt;&lt;&nbsp;"Result:&nbsp;"&nbsp;&lt;&lt;&nbsp;result.toInt32();&nbsp;&nbsp;</li></ol></div><p>&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;</p><div bg_cpp"="" style="width: 687px; "><div><div><strong>[cpp]</strong>&nbsp;<a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a><a href="http://blog.csdn.net/liuhongwei123888/article/details/6162159#" title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">copy</a><div style="position: absolute; left: 557px; top: 2274px; width: 18px; height: 18px; z-index: 99; border-image: initial; "><embed id="ZeroClipboardMovie_4" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_4" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&amp;width=18&amp;height=18" wmode="transparent"></div></div></div><ol start="1"><li style="border-width: initial; border-color: initial; line-height: 18px; ">QScriptEngine&nbsp;engine;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">QScriptValue&nbsp;func&nbsp;=&nbsp;engine.evaluate("(function(a,&nbsp;b)&nbsp;{&nbsp;return&nbsp;a+b;})");&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">QScriptValueList&nbsp;args;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">args&nbsp;&lt;&lt;&nbsp;1&nbsp;&lt;&lt;&nbsp;2;&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">QScriptValue&nbsp;result&nbsp;=&nbsp;func.call(QScriptValue(),&nbsp;args);&nbsp;&nbsp;</li><li style="border-width: initial; border-color: initial; line-height: 18px; ">qDebug()&nbsp;&lt;&lt;&nbsp;"Result:&nbsp;"&nbsp;&lt;&lt;&nbsp;result.toInt32();&nbsp;&nbsp;</li></ol></div><p>&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp; 2、QScriptValue是一个Qt Script数据类型的容器,支持ECMA-262定义的类型，如：</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp; 原始数据类型：Undefined,Null,Boolean,Number,String,对象类型。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp; 另外Qt Script还内建支持QVariant,QObject和QMetaObject.</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;对于基对象(object-based)类型（包括Date和RegExp)，使用QScriptEngine对象的newT()函数（如QScriptEngine::newObject())创建一个你期望的QScriptValue类型。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;对于原始数据类型,直接使用QScriptValue构造函数加载。</p><p style="color: #333333; font-family: Arial; line-height: 26px; text-align: left; background-color: #ffffff; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isT()方法能够被用来测试一个值是否是你确定的数据类型。toT()方法用来将QScriptValue转换成其他类型。当然你也可以用qscriptvalue_cast()方法.</p><img src ="http://www.cppblog.com/lauer3912/aggbug/169398.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-03-29 13:43 <a href="http://www.cppblog.com/lauer3912/archive/2012/03/29/169398.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Building PySide on Microsoft Windows</title><link>http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sat, 14 Jan 2012 13:08:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/164187.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/164187.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/164187.html</trackback:ping><description><![CDATA[<div><h1>Building PySide on Microsoft Windows</h1><a name="ee68e5b99222bbc29a480fcb0d1d6ee2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(68, 165, 28); text-decoration: none; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); "></a><h2>Prerequisites</h2><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://www.microsoft.com/express/Downloads/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">MS Visual Studio Express 2008</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[microsoft.com]</em><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: inherit; font-weight: bold; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">NOTE</span></strong>: Visual Studio Express 2010 is not supported</li></ul></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://www.cmake.org/cmake/resources/software.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">CMake</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[cmake.org]</em></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://code.google.com/p/msysgit/downloads/list" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">Git</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[code.google.com]</em></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://www.python.org/download/" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">Python 2.6 or 2.7</a>&nbsp;<em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: italic; font-weight: inherit; ">[python.org]</em></li></ul><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><strong style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: inherit; font-weight: bold; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">NOTE</span></strong>: Be sure that git.exe and cmake.exe are all in your&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">PATH</span>.</p><a name="c74c1f42f141c011ca6bd8b1114fc3d0" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(68, 165, 28); text-decoration: none; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); "></a><h2>Build</h2><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">Open &#8220;Visual Studio Command Prompt&#8221;: [Start Menu]-&gt;Programs-&gt;Microsoft Visual C++ 2008 Express Edition-&gt;Visual Studio Tools</li></ul><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">Get build scripts from repository&nbsp;<a href="http://qt.gitorious.org/pyside/packaging" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">http://qt.gitorious.org/pyside/packaging</a>&nbsp;and go to folder &#8220;c:\repositories\packaging\setuptools&#8221;. The script can automatically download the sources, compile them, and create the installer, all in one step.</li></ul><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">Run the build.py script (it must be run from &#8220;Visual Studio Command Prompt&#8221;):</li></ul><span style="color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none; ">To build the latest stable binaries for Python 2.7 and Qt 4.7.3, run the script with parameters:</span><div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\repositories\packaging\setuptools<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\Python27\python.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span>&nbsp;build.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">py</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>d&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>q c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\<a href="http://developer.qt.nokia.com/doc/Qt.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; font-weight: bold; ">Qt</span></a>\4.7.3\bin\qmake.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp;</div></li></ol></div><span style="color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none; ">To build the latest development binaries:</span><div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\repositories\packaging\setuptools<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\Python27\python.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span>&nbsp;build.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">py</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>d&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>m dev&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>q c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\<a href="http://developer.qt.nokia.com/doc/Qt.html" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; font-weight: bold; ">Qt</span></a>\4.7.3\bin\qmake.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp;</div></li></ol></div><span style="color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none; ">All build.py parameters:</span><div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>p&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&lt;</span>package_version<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>&nbsp;Specify package version.&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">Default</span>&nbsp;is latest stable version&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">(</span>1.0.4<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">)</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Download latest sources from git repository</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>m&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&lt;</span>pyside_version<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>&nbsp;&nbsp;Specify what version of modules to download from git repository<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: blue; ">'dev'</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">(</span>master tag<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">)</span>&nbsp;or&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: blue; ">'stable'</span>&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">(</span>1.0.4 tag<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">)</span>.&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">Default</span>&nbsp;is&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: blue; ">'stable'</span>.</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>q&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&lt;</span>qmake_path<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">&gt;</span>&nbsp;&nbsp; &nbsp; &nbsp;Locate qmake</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>e &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check the environment</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Specify what module to build</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>o &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Create a distribution package only&nbsp;<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #d20020; font-weight: bold; ">using</span>&nbsp;existing binaries</div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; background-image: none; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; &nbsp;</div></li></ol></div><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; ">After the successful build, the final binary distribution can be found in sub-folder &#8220;dist&#8221;:<div geshi"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><ol style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #afafaf; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp; c<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">:</span>\repositories\packaging\setuptools\dist\PySide<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>1.0.4qt473.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">win32</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">-</span>py2.7.<span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #363534; ">exe</span></div></li><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 32px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #000000; ">&nbsp;</div></li></ol></div></li></ul><h3>Categories:</h3><ul id="nav_categories" style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 15px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; color: #363534; font-family: Verdana, 'DejaVu Sans', Geneva, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://developer.qt.nokia.com/wiki/Category:LanguageBindings" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">LanguageBindings</a><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 25px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; background-image: url(http://developer.qt.nokia.com/images/qtdn/sprites-combined-latest.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; background-position: 0px -367px; background-repeat: no-repeat no-repeat; "><a href="http://developer.qt.nokia.com/wiki/Category:LanguageBindings::PySide" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #44a51c; text-decoration: none; ">PySide</a></li></ul></li></ul></div><img src ="http://www.cppblog.com/lauer3912/aggbug/164187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2012-01-14 21:08 <a href="http://www.cppblog.com/lauer3912/archive/2012/01/14/164187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android平台的QT实现 Necessitas</title><link>http://www.cppblog.com/lauer3912/archive/2011/10/24/158995.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 24 Oct 2011 12:44:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/10/24/158995.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/158995.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/10/24/158995.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/158995.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/158995.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Verdana, Simsun, sans-serif; font-size: 13px; line-height: 20px; background-color: #ffffff; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">Necessitas是一个 用于<a href="http://www.oschina.net/p/android" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">Android</a>平台的<a href="http://www.oschina.net/p/qt" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">qt</a>开发的实现。众所周知，Qt是诺基亚所有（最初由奇趣科技创建后由诺基亚收购）的一个跨平台的C++图形用户界面应用程序框架。它提供给应用程序开发者建立艺术级的图形用户界面所需的所用功能。Qt是完全面向对象的，很容易扩展，并且允许真正地组件编程。qt目前已经支持windows、linux、mac os x等平台，并且在智能手机操作系统领域，支持Windows Mobile,Symbian,Meego平台。然而，目前android平台已经成为智能手机领域举足轻重的平台，而android目前只支持java开发，可惜的是，对C++开发的支持十分有限并残缺的。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">java开发的应用程序，由于运行在虚拟机上，采用同样的算法，与原生的C++代码相比，存在着一定的性能损失。后来谷歌公司意识到这一点，允许使用C++语言开发类库并被java程序调用，但并不能创建完整的GUI程序。因此，便有了将qt与android相结合的necessitas项目。</p></span><div><a href="http://sourceforge.net/p/necessitas/home/necessitas/">http://sourceforge.net/p/necessitas/home/necessitas/</a></div><img src ="http://www.cppblog.com/lauer3912/aggbug/158995.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-10-24 20:44 <a href="http://www.cppblog.com/lauer3912/archive/2011/10/24/158995.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>UGENE - Integrated Bioinformatics Tools</title><link>http://www.cppblog.com/lauer3912/archive/2011/10/21/158795.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 20 Oct 2011 23:55:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/10/21/158795.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/158795.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/10/21/158795.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/158795.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/158795.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #222222; font-family: arial, sans-serif; line-height: 15px; background-color: #ffffff; font-size: small; "><h3 class="r" style="font-size: medium; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; display: block; line-height: 1; overflow-x: hidden; overflow-y: hidden; text-overflow: ellipsis; white-space: nowrap; "><a href="http://www.google.com.hk/url?sa=t&amp;rct=j&amp;q=ugene&amp;source=web&amp;cd=1&amp;ved=0CC0QFjAA&amp;url=http%3A%2F%2Fugene.unipro.ru%2F&amp;ei=gq2gTpDnCaahiAeFvqDEBg&amp;usg=AFQjCNHA3i-gr6ylZyrWUhFrq8XTeGzHkQ" target="_blank" class="l" style="font-family: arial, sans-serif; color: #1122cc; cursor: pointer; "><em style="color: #d14836; font-style: normal; text-decoration: underline; ">UGENE</em>&nbsp;- Integrated Bioinformatics Tools</a></h3></span><br /><br /><span class="Apple-style-span" style="font-family: Simsun; line-height: normal; font-size: medium; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; height: 100%; background-color: white; color: black; font-family: sans-serif, verdana, arial, helvetica; "><div class="main_wrapper" style="min-height: 100%; position: relative; "><div class="header_line" style="background-image: url(http://ugene.unipro.ru/images/head_line.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 1349px; background-position: initial initial; background-repeat: initial initial; ">&nbsp;</div><div class="logo_line" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-left: 40px; margin-right: 30px; "><a href="http://ugene.unipro.ru/index.html"><img border="0" src="http://ugene.unipro.ru/images/ugene_logo.png" alt="UGENE home page" title="UGENE home page" style="float: left; " /></a><img src="http://ugene.unipro.ru/images/flowers.png" title="Flowers? Yeah!" style="float: right; "  alt="" /></div><div style="clear: both; "></div><table class="menu_line" border="0" cellspacing="0" cellpadding="0" style="border-top-style: solid; border-top-color: #999999; border-bottom-style: solid; border-bottom-color: #999999; width: 1349px; min-width: 800px; margin-top: 2px; font-size: 14px; font-family: Arial; "><tbody><tr><td><div class="top_menu_item" style="border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999; color: #333333; "><ul class="menu" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 32px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; height: 30px; background-image: url(http://ugene.unipro.ru/images/menu_line.jpg); background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: transparent; position: relative; background-position: 0px 0px; background-repeat: no-repeat no-repeat; "><li class="top" style="display: block; float: left; position: relative; "><a class="top_menu_item top_link" href="http://ugene.unipro.ru/index.html" style="color: black; font-weight: bold; text-decoration: none; display: block; float: left; height: 30px; line-height: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1px; cursor: pointer; "><span style="float: left; display: block; padding-top: 0px; padding-right: 24px; padding-bottom: 0px; padding-left: 12px; height: 30px; ">Home</span></a></li><li class="top" style="display: block; float: left; position: relative; "><a class="top_menu_item top_link" href="http://ugene.unipro.ru/documentation.html" style="color: black; font-weight: bold; text-decoration: none; display: block; float: left; height: 30px; line-height: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1px; cursor: pointer; "><span style="float: left; display: block; padding-top: 0px; padding-right: 24px; padding-bottom: 0px; padding-left: 12px; height: 30px; ">Documentation</span></a><ul class="sub" style="position: absolute; left: -9999px; top: -9999px; width: 0px; height: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li><a class="top_menu_item" href="http://ugene.unipro.ru/manual_overview.html" style="color: black; font-weight: bold; text-decoration: none; ">UGENE Manual</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/documentation/wd_manual/index.html" style="color: black; font-weight: bold; text-decoration: none; ">Workflow Designer</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/documentation/qd_manual/index.html" style="color: black; font-weight: bold; text-decoration: none; ">Query Designer</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/podcast.html" style="color: black; font-weight: bold; text-decoration: none; ">YouTube Podcast</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/changelist.html" style="color: black; font-weight: bold; text-decoration: none; ">Version History</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/faq.html" style="color: black; font-weight: bold; text-decoration: none; ">FAQ</a></li></ul></li><li class="top" style="display: block; float: left; position: relative; "><a class="top_menu_item top_link" href="http://ugene.unipro.ru/forum" style="color: black; font-weight: bold; text-decoration: none; display: block; float: left; height: 30px; line-height: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1px; cursor: pointer; "><span style="float: left; display: block; padding-top: 0px; padding-right: 24px; padding-bottom: 0px; padding-left: 12px; height: 30px; ">Community</span></a><ul class="sub" style="position: absolute; left: -9999px; top: -9999px; width: 0px; height: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li><a class="top_menu_item" href="http://ugene.unipro.ru/forum" style="color: black; font-weight: bold; text-decoration: none; ">Forum</a></li><li><a class="top_menu_item" href="https://ugene.unipro.ru//tracker" style="color: black; font-weight: bold; text-decoration: none; ">Bug Tracker</a></li><li><a class="top_menu_item" href="https://ugene.unipro.ru/fisheye" style="color: black; font-weight: bold; text-decoration: none; ">Source Code</a></li></ul></li><li class="top" style="display: block; float: left; position: relative; "><a class="top_menu_item top_link" href="http://ugene.unipro.ru/download.html" style="color: black; font-weight: bold; text-decoration: none; display: block; float: left; height: 30px; line-height: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1px; cursor: pointer; "><span style="float: left; display: block; padding-top: 0px; padding-right: 24px; padding-bottom: 0px; padding-left: 12px; height: 30px; ">Downloads</span></a><ul class="sub" style="position: absolute; left: -9999px; top: -9999px; width: 0px; height: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li><a class="top_menu_item" href="http://ugene.unipro.ru/download.html" style="color: black; font-weight: bold; text-decoration: none; ">Latest Release</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/snapshot.html" style="color: black; font-weight: bold; text-decoration: none; ">Snapshots</a></li><li><a class="top_menu_item" href="http://ugene.unipro.ru/external.html" style="color: black; font-weight: bold; text-decoration: none; ">External Tools</a></li></ul></li><li class="top" style="display: block; float: left; position: relative; "><a class="top_menu_item top_link" href="http://ugene.unipro.ru/support.html" style="color: black; font-weight: bold; text-decoration: none; display: block; float: left; height: 30px; line-height: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1px; cursor: pointer; "><span style="float: left; display: block; padding-top: 0px; padding-right: 24px; padding-bottom: 0px; padding-left: 12px; height: 30px; ">Support</span></a></li><li class="top" style="display: block; float: left; position: relative; "><a class="top_menu_item top_link" href="http://ugene.unipro.ru/contacts.html" style="color: black; font-weight: bold; text-decoration: none; display: block; float: left; height: 30px; line-height: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1px; cursor: pointer; "><span style="float: left; display: block; padding-top: 0px; padding-right: 24px; padding-bottom: 0px; padding-left: 12px; height: 30px; ">Contacts</span></a></li></ul></div></td></tr></tbody></table><div class="bottom_offset" style="padding-bottom: 100px; "><table cellspacing="0" cellpadding="0"><tbody><tr><td valign="top"><div class="news_title" style="margin-left: 40px; "><p class="news_title" style="color: #255060; font-size: 29px; "><a href="http://twitter.com/uniprougene" title="Follow us on Twitter" target="blank"><img border="0" src="http://ugene.unipro.ru/images/twitter.png"  alt="" /></a>&nbsp;<a href="http://feeds2.feedburner.com/NewsOfUgeneProject" title="Subscribe to RSS feeds" target="blank"><img border="0" src="http://ugene.unipro.ru/images/rss.png"  alt="" /></a>&nbsp;&nbsp;News</p></div><div class="news_block" style="margin-left: 40px; width: 180px; border-right-style: dotted; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999; font-size: 14px; color: #333333; "><table height="600" cellspacing="0" cellpadding="0" style="margin-right: 10px; "><tbody><tr><td valign="top"><a class="news" href="http://ugene.unipro.ru/news.html#200911" style="color: black; "><strong>September 20, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;<strong>1.9.7</strong>&nbsp;is released</p><a class="news" href="http://ugene.unipro.ru/news.html#230811" style="color: black; "><strong>August 23, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.6 is released</p><a class="news" href="http://ugene.unipro.ru/news.html#270711" style="color: black; "><strong>July 27, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE at the BOSC-2011</p><a class="news" href="http://ugene.unipro.ru/news.html#250711" style="color: black; "><strong>July 25, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.5 and changes in the release cycle</p><a class="news" href="http://ugene.unipro.ru/news.html#120711" style="color: black; "><strong>July 12, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.4 is released</p><a class="news" href="http://ugene.unipro.ru/news.html#060711" style="color: black; "><strong>July 6, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE on the Illumina iDEA 2011 Conference</p><a class="news" href="http://ugene.unipro.ru/news.html#030611" style="color: black; "><strong>June 3, 2011</strong></a><br /><p style="font-size: 13px; ">Workshop on UGENE was held in Novisibirsk State University</p><a class="news" href="http://ugene.unipro.ru/news.html#230511" style="color: black; "><strong>May 23, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.3 is released</p><a class="news" href="http://ugene.unipro.ru/news.html#070411" style="color: black; "><strong>April 7, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE wins award in a contest devoted to GPU computations</p><a class="news" href="http://ugene.unipro.ru/news.html#240311" style="color: black; "><strong>March 24, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.2 is released</p><a class="news" href="http://ugene.unipro.ru/news.html#150311" style="color: black; "><strong>March 15, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE bug-tracker is open for public</p><a class="news" href="http://ugene.unipro.ru/news.html#070211" style="color: black; "><strong>February 7, 2011</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.1 is released</p><a class="news" href="http://ugene.unipro.ru/news.html#251210" style="color: black; "><strong>December 25, 2010</strong></a><br /><p style="font-size: 13px; ">Development snapshots are available</p><a class="news" href="http://ugene.unipro.ru/news.html#211210" style="color: black; "><strong>December 21, 2010</strong></a><br /><p style="font-size: 13px; ">UGENE wins the Best Open Source Project contest</p><a class="news" href="http://ugene.unipro.ru/news.html#171210" style="color: black; "><strong>December 17, 2010</strong></a><br /><p style="font-size: 13px; ">What's new in UGENE&nbsp;1.9 video</p><a class="news" href="http://ugene.unipro.ru/news.html#151210" style="color: black; "><strong>December 15, 2010</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;1.9.0 is released</p><a class="news" href="http://ugene.unipro.ru/news.html#031110" style="color: black; "><strong>November 3, 2010</strong></a><br /><p style="font-size: 13px; ">UGENE&nbsp;wins award at contest held by Intel and Rusnano</p></td></tr></tbody></table></div></td><td><div class="main_page_content_block" style="float: left; margin-top: 10px; margin-left: 50px; "><h2 style="font-family: sans-serif, verdana, arial, helvetica; font-size: 24px; color: #255060; ">Unipro UGENE: Integrated Bioinformatics Tools</h2><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td width="30" rowspan="5"></td><td width="640">UGENE is a free cross-platform genome analysis suite.&nbsp;<br />It works perfectly on Windows, Mac&nbsp;OS or Linux and requires only a few clicks to install.</td></tr></tbody></table><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td colspan="2"><h2 style="font-family: sans-serif, verdana, arial, helvetica; font-size: 24px; color: #255060; ">Features</h2></td><td rowspan="5" valign="top"><div style="margin-left: 50px; text-align: center; "><br /><strong class="bolditem" style="color: #255060; font-size: 13px; ">Screenshots</strong>&nbsp;<br /><br /><a href="http://ugene.unipro.ru/images/ss_mac_h1n1.png" alt="screenshot2"><img border="0" src="http://ugene.unipro.ru/images/ss_mac_h1n1_small.png" title="Feature-rich sequence viewer and annotator"  alt="" /></a>&nbsp;<br /><a class="content_gray" href="http://ugene.unipro.ru/images/ss_mac_h1n1.png" style="color: gray; font-size: 12px; ">Swine flu in UGENE</a>&nbsp;<br /><br /><br /><a href="http://ugene.unipro.ru/images/ss_win7_assembly.png" alt="screenshot1"><img border="0" src="http://ugene.unipro.ru/images/ss_win7_assembly_small.png" title="Assembly Browser"  alt="" /></a>&nbsp;<br /><a class="content_gray" href="http://ugene.unipro.ru/images/ss_win7_assembly.png" style="color: gray; font-size: 12px; ">Assembly Browser</a>&nbsp;<br /><br /><br /><a href="http://ugene.unipro.ru/images/ss_fed_wd_big.png" alt="screenshot3"><img border="0" src="http://ugene.unipro.ru/images/ss_fed_wd_small.png" title="Workflow Designer visual interface"  alt="" /></a>&nbsp;<br /><a class="content_gray" href="http://ugene.unipro.ru/images/ss_fed_wd_big.png" style="color: gray; font-size: 12px; ">Workflow Designer</a>&nbsp;<br /><br /><br /><a href="http://ugene.unipro.ru/images/ss_w7_ma_big.png" alt="screenshot4"><img border="0" src="http://ugene.unipro.ru/images/ss_w7_ma_small.png" title="Multiple sequence alignment editor"  alt="" /></a>&nbsp;<br /><a class="content_gray" href="http://ugene.unipro.ru/images/ss_w7_ma_big.png" style="color: gray; font-size: 12px; ">Multiple alignment</a></div></td></tr><tr><td width="30" rowspan="5"></td><td valign="top"><strong class="bolditem" style="color: #255060; ">Integrated tools</strong><ul><li>Multiple sequence alignment using MUSCLE 3, KAlign, Clustal;</li><li>HMM profiles build and search, based on the source of HMMER 2 and HMMER 3;</li><li>PCR Primers design using Primer 3;</li><li>Cloning in silico capabilities;</li><li>Queries to NCBI BLAST and CDD databases;</li><li>Protein secondary structure prediction using GOR IV and PSIPRED;</li><li>Phylogenetic analysis with Phylip;</li><li>Search for restriction enzymes and integration with REBASE;</li><li>Extremely fast repeat finder;</li><li>DNA short reads to reference alignment using Bowtie;</li><li>De novo assembly with CAP3;</li><li>Search for transcription factor binding sites using SITECON;</li><li>Protein back translation;</li><li>ORF finder;</li><li>Complete Smith-Waterman algorithm implementation;</li><li>Support for external tools: BLAST+, MAFFT, T-Coffee;</li><li>Assembly Browser &#8212; a shiny BAM viewer.</li></ul></td></tr><tr><td valign="top"><br /><strong class="bolditem" style="color: #255060; ">User interface</strong><ul><li>Visual and interactive genome browsing including circular plasmid view;</li><li>Multiple alignment editor;</li><li>Chromatograms visualization;</li><li>3D viewer for files in PDB and MMDB formats with anaglyph stereo mode support;</li><li>Phylogenetic tree viewer;</li><li>Dot plot visualization;</li><li>Query designer enables search for complex annotation patterns;</li><li>Easy to use workflow designer for custom computational workflows.</li></ul></td></tr><tr><td valign="top"><br /><strong class="bolditem" style="color: #255060; ">High performance computing in UGENE</strong><ul><li>Complete support of modern multicore processors and SSE instructions;</li><li>Out of the box support of modern GPUs using NVIDIA CUDA and ATI Stream;</li><li>Support for cloud computing: running computational tasks on Amazon EC2 cloud;</li><li>Support for supercomputers and distributed computing.</li></ul></td></tr><tr><td valign="top"><br /><strong class="bolditem" style="color: #255060; ">Cooperation</strong><ul><li>Can be used for education purposes in schools and universities;</li><li>Features to be included into the next release are initiated by users;</li><li>UGENE team is ready for collaboration in related projects, both free or commercial.</li></ul></td></tr></tbody></table><br /><h2 style="font-family: sans-serif, verdana, arial, helvetica; font-size: 24px; color: #255060; ">Availability</h2><table border="0"><tbody><tr><td width="410" style="font-size: 14px; ">Unipro UGENE is a free software distributed under the terms of&nbsp;<a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" class="content_gray" style="color: gray; ">GNU General Public License</a>.<p>Prebuilt version for set of operating systems can be found<a href="http://ugene.unipro.ru/download.html" class="content_gray" style="color: gray; ">here</a>.</p><p><a href="http://ugene.unipro.ru/contacts.html" class="content_gray" style="color: gray; ">Contact</a>&nbsp;us to learn more about alternative licensing terms.</p><table><tbody><tr><td valign="top"><div id="___plusone_0" style="height: 24px; width: 106px; display: inline-block; text-indent: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; "><iframe allowtransparency="true" frameborder="0" hspace="0" id="I1_1319154880775" marginheight="0" marginwidth="0" name="I1_1319154880775" scrolling="no" src="https://plusone.google.com/u/0/_/+1/fastbutton?url=http%3A%2F%2Fugene.unipro.ru%2F&amp;size=standard&amp;count=true&amp;annotation=&amp;hl=en-US&amp;jsh=r%3Bgc%2F24479126-6666cb8c#id=I1_1319154880775&amp;parent=http%3A%2F%2Fugene.unipro.ru&amp;rpctoken=366441172&amp;_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe" tabindex="-1" vspace="0" width="100%" title="+1" style="position: absolute; left: -10000px; top: -10000px; width: 106px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; "></iframe></div></td><td valign="top"><iframe src="http://www.facebook.com/plugins/like.php?app_id=133295776759385&amp;href=http%3A%2F%2Fugene.unipro.ru%2Frus%2Findex.html&amp;send=false&amp;layout=button_count&amp;width=120&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" allowtransparency="true" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; overflow-x: hidden; overflow-y: hidden; width: 120px; height: 21px; "></iframe></td></tr></tbody></table></td><td><div style="margin-left: 25px; "><img src="http://ugene.unipro.ru/images/qt_amb_logo.png" title="UGENE project is a member of Qt Ambassador Program"  alt="" /></div></td></tr></tbody></table></div></td></tr></tbody></table></div><div class="footer_wrapper" style="position: absolute; bottom: 0px; height: 48px; width: 1349px; "><div class="language" style="clear: both; color: gray; width: 1349px; font-size: 13px; text-align: center; padding-bottom: 15px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a class="language" href="http://ugene.unipro.ru/rus/index.html" style="color: gray; text-decoration: none; "><img border="0" src="http://ugene.unipro.ru/images/ru.gif"  alt="" /></a>&nbsp;<a href="http://ugene.unipro.ru/rus/index.html" class="language" style="color: gray; text-decoration: none; ">По-русски</a></div><div class="footer" style="clear: both; color: white; width: 1349px; font-size: 13px; text-align: center; background-image: url(http://ugene.unipro.ru/images/foot_line.png); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a class="footer" href="http://unipro.ru/" style="color: white; text-decoration: none; ">UniPro, Russia, 2008&#8211;2011</a></div></div></div></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/158795.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-10-21 07:55 <a href="http://www.cppblog.com/lauer3912/archive/2011/10/21/158795.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>http://developer.qt.nokia.com/wiki/Category:Developing_with_Qt</title><link>http://www.cppblog.com/lauer3912/archive/2011/10/08/157826.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sat, 08 Oct 2011 14:34:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/10/08/157826.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/157826.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/10/08/157826.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/157826.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/157826.html</trackback:ping><description><![CDATA[<a href="http://developer.qt.nokia.com/wiki/Category:Developing_with_Qt">http://developer.qt.nokia.com/wiki/Category:Developing_with_Qt</a><img src ="http://www.cppblog.com/lauer3912/aggbug/157826.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-10-08 22:34 <a href="http://www.cppblog.com/lauer3912/archive/2011/10/08/157826.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MeeGo 设备运行全部 Android 应用程序？</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/25/156737.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Sun, 25 Sep 2011 01:18:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/25/156737.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/156737.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/25/156737.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/156737.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/156737.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: Verdana, Simsun, sans-serif; font-size: 13px; line-height: normal; background-color: #ffffff; "><div class="pubDate" style="padding-bottom: 5px; margin-top: 0px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #dddddd; color: #666666; "><a href="http://my.oschina.net/javayou" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #cc0000; outline-width: 0px; outline-style: initial; outline-color: initial; ">红薯</a>&nbsp;发布于： 2011年09月22日 (<a href="http://www.oschina.net/news/21622/openmobile-acl#comments" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">8评</a>)</div><div id="OSChina_News_21622" class="NewsContent TextContent NewsType2" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; line-height: 24px; color: #000000; font-size: 10.5pt; overflow-x: hidden; overflow-y: hidden; "><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">啥是 OpenMobile ACL？它是一个应用程序兼容层（Application Compatibility Layer），能<strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">让 MeeGo 设备运行全部 Android 应用程序</strong>。</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; ">据 ACL 宣称：</p><ul style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; list-style-type: disc; list-style-position: inside; "><li style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">100% 兼容 Android 所有程序。</li><li style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">和原生 MeeGo 程序以同样速度性能，不会拖慢速度或消耗更多电力。</li><li style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">无需对 Android 程序做任何修改，不用重编译或打包。</li><li style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">完整的 3D 和多媒体支持。</li><li style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">支持 Android API Level 4+, NDK6 以上的程序。</li></ul><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; "><a href="http://www.youtube.com/watch?v=YsRH8w6RMHQ&amp;feature=player_embedded" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">使用 MeeGo X86 1.2 进行的视频演示</a>(<a href="http://v.youku.com/v_show/id_XMzA2MzA5Njgw.html" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">朝内镜像</a>)</p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; text-indent: 2em; "><em style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">消息来源：</em><a href="http://mge.bz/nK" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">MeeGoExperts</a></p></div></span><div><a href="http://v.youku.com/v_show/id_XMzA2MzA5Njgw.html">http://v.youku.com/v_show/id_XMzA2MzA5Njgw.html<br /><br />收藏</a>：<a href="http://u.youku.com/user_show/id_UMTk0NzM5NjU2.html">http://u.youku.com/user_show/id_UMTk0NzM5NjU2.html</a></div><img src ="http://www.cppblog.com/lauer3912/aggbug/156737.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-25 09:18 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/25/156737.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt Lighthouse学习(三)</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/15/155889.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 15 Sep 2011 13:25:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/15/155889.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/155889.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/15/155889.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/155889.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/155889.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><ul><li style="list-style-type: none; "><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">想不出好的名字，还是继续用lighthouse这个名字吧，毕竟和<a href="http://127.0.0.1/wiki/Qt%20Lighthouse%E5%AD%A6%E4%B9%A0%28%E4%BA%8C%29" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Qt Lighthouse学习(二)</a>内容相连。<span class="anchor" id="line-2-3"></span><span class="anchor" id="line-3-3"></span></p></li></ul><p class="line874">注：本文内容基于现阶段的Qt5源码，等Qt5正式发布时，本文的内容可能不再适用了。 2011.09.11<span class="anchor" id="line-4-3"></span><span class="anchor" id="line-5-3"></span></p><h2 id="QPA.2BY9JO9lKgj30-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPA插件加载</h2><span class="anchor" id="line-6-3"></span><p class="line874">Qt5所有的gui程序都将依赖一个 qpa 插件(QGuiApplication初始化时将会加载qpa插件)。<span class="anchor" id="line-7-3"></span></p><ul><li>程序如何知道去哪儿找插件呢？<span class="anchor" id="line-8-3"></span></li><li>又如何知道加载哪一个插件呢？<span class="anchor" id="line-9-3"></span><span class="anchor" id="line-10-3"></span></li></ul><h3 id="A.2Bje9fhA-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">路径</h3><span class="anchor" id="line-11-3"></span><span class="anchor" id="line-12-2"></span><ul><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">命令行参数：<tt>-platformpluginpath</tt><span class="anchor" id="line-13-2"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">环境变量：<span>&nbsp;</span><tt>QT_QPA_PLATFORM_PLUGIN_PATH</tt><span class="anchor" id="line-14-2"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">常规插件路径(QCoreApplication::libraryPaths())下的<strong>platform</strong>子目录<span class="anchor" id="line-15-2"></span></p><ul><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">恩，常规路径很复杂，详见：<a class="http" href="http://blog.csdn.net/dbzhang800/article/details/6543489" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Qt 插件路径(笔记)</a><span class="anchor" id="line-16-2"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">QLibraryInfo::location(QLibraryInfo::PluginsPath)<span class="anchor" id="line-17-2"></span></p><ul><li>文件:/qt/etc/qt.conf中设置的路径<span class="anchor" id="line-18-1"></span></li><li>环境变量：QT_PLUGIN_PATH<span class="anchor" id="line-19-1"></span></li><li>编译Qt时生成的 src/corelib/global/config.cpp 中写死的路径<span class="anchor" id="line-20-1"></span></li></ul></li><li>可执行程序自身所在路径<span class="anchor" id="line-21-1"></span></li><li>可执行程序路径下qt.conf设置的路径<span class="anchor" id="line-22-1"></span></li><li>手动调用 QCoreApplication::addLibraryPath()设置的路径<span class="anchor" id="line-23-1"></span></li><li>环境变量QT_QPA_PLATFORM_PLUGIN_PATH设置的路径以及-platformpluginpath指定的路径<span class="anchor" id="line-24-1"></span><span class="anchor" id="line-25-1"></span></li></ul></li></ul><h3 id="A.2BY9JO9lQN-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">插件名</h3><span class="anchor" id="line-26-1"></span><ul><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">命令行参数：<tt>-platform</tt><span class="anchor" id="line-27-1"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">环境变量：<tt>QT_QPA_PLATFORM</tt><span class="anchor" id="line-28-1"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">编译Qt源码时定义的宏：<tt>QT_QPA_DEFAULT_PLATFORM_NAME</tt><span class="anchor" id="line-29-1"></span></p></li><li>默认插件名：<span class="anchor" id="line-30-1"></span><ul><li>MAC 平台下的 &#8220;cocoa&#8221;<span class="anchor" id="line-31-1"></span></li><li>WIN 平台下的 &#8220;windows&#8221;<span class="anchor" id="line-32-1"></span></li><li>其他 平台下 "xcb"<span class="anchor" id="line-33-1"></span><span class="anchor" id="line-34-1"></span></li></ul></li></ul><h2 id="QWindow" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QWindow</h2><span class="anchor" id="line-35"></span><p class="line862">QWidget和QApplication都从QtGui模块中移走了(移到了QtWidgets模块)。那么如何使用QtGui模块写一个最简单的界面呢？<span class="anchor" id="line-36"></span><span class="anchor" id="line-37"></span></p><p class="line874">需要使用 QWindow 和 QGuiApplication，一个简单的例子：<span class="anchor" id="line-38"></span></p><ul><li>widget.h<span class="anchor" id="line-39"></span></li></ul><p class="line867"><span class="anchor" id="line-40"></span><span class="anchor" id="line-41"></span><span class="anchor" id="line-42"></span><span class="anchor" id="line-43"></span><span class="anchor" id="line-44"></span><span class="anchor" id="line-45"></span><span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><span class="anchor" id="line-48"></span><span class="anchor" id="line-49"></span><span class="anchor" id="line-50"></span><span class="anchor" id="line-51"></span><span class="anchor" id="line-52"></span><span class="anchor" id="line-53"></span><span class="anchor" id="line-54"></span><span class="anchor" id="line-55"></span><span class="anchor" id="line-56"></span><span class="anchor" id="line-57"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1"></span>#ifndef WINDOW_H
<span class="anchor" id="line-2"></span>#define WINDOW_H
<span class="anchor" id="line-3"></span>
<span class="anchor" id="line-4"></span>#include &lt;QtGui/QWindow&gt;
<span class="anchor" id="line-5"></span>class Window : public QWindow
<span class="anchor" id="line-6"></span>{
<span class="anchor" id="line-7"></span>    Q_OBJECT
<span class="anchor" id="line-8"></span>public:
<span class="anchor" id="line-9"></span>    Window(QWindow *parent = 0);
<span class="anchor" id="line-10"></span>protected:
<span class="anchor" id="line-11"></span>    void exposeEvent(QExposeEvent *);
<span class="anchor" id="line-12"></span>    void resizeEvent(QResizeEvent *);
<span class="anchor" id="line-13"></span>private:
<span class="anchor" id="line-14"></span>    void render();
<span class="anchor" id="line-15"></span>    QBackingStore *m_backingStore;
<span class="anchor" id="line-16"></span>};
<span class="anchor" id="line-17"></span>#endif // WINDOW_H</pre><span class="anchor" id="line-58"></span><ul><li>window.cpp<span class="anchor" id="line-59"></span></li></ul><p class="line867"><span class="anchor" id="line-60"></span><span class="anchor" id="line-61"></span><span class="anchor" id="line-62"></span><span class="anchor" id="line-63"></span><span class="anchor" id="line-64"></span><span class="anchor" id="line-65"></span><span class="anchor" id="line-66"></span><span class="anchor" id="line-67"></span><span class="anchor" id="line-68"></span><span class="anchor" id="line-69"></span><span class="anchor" id="line-70"></span><span class="anchor" id="line-71"></span><span class="anchor" id="line-72"></span><span class="anchor" id="line-73"></span><span class="anchor" id="line-74"></span><span class="anchor" id="line-75"></span><span class="anchor" id="line-76"></span><span class="anchor" id="line-77"></span><span class="anchor" id="line-78"></span><span class="anchor" id="line-79"></span><span class="anchor" id="line-80"></span><span class="anchor" id="line-81"></span><span class="anchor" id="line-82"></span><span class="anchor" id="line-83"></span><span class="anchor" id="line-84"></span><span class="anchor" id="line-85"></span><span class="anchor" id="line-86"></span><span class="anchor" id="line-87"></span><span class="anchor" id="line-88"></span><span class="anchor" id="line-89"></span><span class="anchor" id="line-90"></span><span class="anchor" id="line-91"></span><span class="anchor" id="line-92"></span><span class="anchor" id="line-93"></span><span class="anchor" id="line-94"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-1"></span>#include "window.h"
<span class="anchor" id="line-2-1"></span>#include &lt;QtGui/QPainter&gt;
<span class="anchor" id="line-3-1"></span>#include &lt;QtGui/QBackingStore&gt;
<span class="anchor" id="line-4-1"></span>
<span class="anchor" id="line-5-1"></span>Window::Window(QWindow *parent)
<span class="anchor" id="line-6-1"></span>    : QWindow(parent)
<span class="anchor" id="line-7-1"></span>{
<span class="anchor" id="line-8-1"></span>    setGeometry(QRect(10, 10, 640, 480));
<span class="anchor" id="line-9-1"></span>    m_backingStore = new QBackingStore(this);
<span class="anchor" id="line-10-1"></span>}
<span class="anchor" id="line-11-1"></span>
<span class="anchor" id="line-12-1"></span>void Window::exposeEvent(QExposeEvent *)
<span class="anchor" id="line-13-1"></span>{
<span class="anchor" id="line-14-1"></span>    render();
<span class="anchor" id="line-15-1"></span>}
<span class="anchor" id="line-16-1"></span>
<span class="anchor" id="line-17-1"></span>void Window::resizeEvent(QResizeEvent *)
<span class="anchor" id="line-18"></span>{
<span class="anchor" id="line-19"></span>    render();
<span class="anchor" id="line-20"></span>}
<span class="anchor" id="line-21"></span>
<span class="anchor" id="line-22"></span>void Window::render()
<span class="anchor" id="line-23"></span>{
<span class="anchor" id="line-24"></span>    QRect rect(QPoint(), geometry().size());
<span class="anchor" id="line-25"></span>    m_backingStore-&gt;resize(rect.size());
<span class="anchor" id="line-26"></span>
<span class="anchor" id="line-27"></span>    m_backingStore-&gt;beginPaint(rect);
<span class="anchor" id="line-28"></span>
<span class="anchor" id="line-29"></span>    QPainter p(m_backingStore-&gt;paintDevice());
<span class="anchor" id="line-30"></span>    p.drawRect(rect);
<span class="anchor" id="line-31"></span>
<span class="anchor" id="line-32"></span>    m_backingStore-&gt;endPaint();
<span class="anchor" id="line-33"></span>    m_backingStore-&gt;flush(rect);
<span class="anchor" id="line-34"></span>}</pre><span class="anchor" id="line-95"></span><ul><li>main.cpp<span class="anchor" id="line-96"></span></li></ul><p class="line867"><span class="anchor" id="line-97"></span><span class="anchor" id="line-98"></span><span class="anchor" id="line-99"></span><span class="anchor" id="line-100"></span><span class="anchor" id="line-101"></span><span class="anchor" id="line-102"></span><span class="anchor" id="line-103"></span><span class="anchor" id="line-104"></span><span class="anchor" id="line-105"></span><span class="anchor" id="line-106"></span><span class="anchor" id="line-107"></span><span class="anchor" id="line-108"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-2"></span>#include &lt;QtGui/QGuiApplication&gt;
<span class="anchor" id="line-2-2"></span>#include "window.h"
<span class="anchor" id="line-3-2"></span>
<span class="anchor" id="line-4-2"></span>int main(int argc, char *argv[])
<span class="anchor" id="line-5-2"></span>{
<span class="anchor" id="line-6-2"></span>    QGuiApplication a(argc, argv);
<span class="anchor" id="line-7-2"></span>    Window w;
<span class="anchor" id="line-8-2"></span>    w.show();
<span class="anchor" id="line-9-2"></span>
<span class="anchor" id="line-10-2"></span>    return a.exec();
<span class="anchor" id="line-11-2"></span>}</pre><div></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/155889.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-15 21:25 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/15/155889.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt Lighthouse学习(二)</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/15/155888.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 15 Sep 2011 13:24:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/15/155888.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/155888.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/15/155888.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/155888.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/155888.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p class="line867"><a href="http://blog.csdn.net/dbzhang800/article/details/6526535" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">上一次</a>关注Qt Lighthouse是在6月初，可是现在都8月底了。时间真快...<span class="anchor" id="line-2-8"></span><span class="anchor" id="line-3-8"></span></p><p class="line874">Lighthouse 是 QPA(Qt Platform Abstraction) 项目的名字，它使得将Qt移植到新的平台变得比较简单。尽管现在它已经完全融入到了Qt主干代码中，lighthouse作为独立项目已经不复存在了，但本文中，我们继续使用这个名字(虽然已不太恰当)。<span class="anchor" id="line-4-7"></span><span class="anchor" id="line-5-7"></span></p><h2 id="QPA_.2BYr2MYU6GTsBOSP8f-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPA 抽象了什么？</h2><span class="anchor" id="line-6-4"></span><p class="line874">不妨看看QPA前后，有何不同：<span class="anchor" id="line-7-4"></span></p><h3 id="A.2BTktSTQ-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">之前</h3><span class="anchor" id="line-8-3"></span><p class="line874">考虑一下，传统的Qt是如何实现图形界面的夸平台：<span class="anchor" id="line-9-2"></span><span class="anchor" id="line-10-1"></span></p><ul><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">针对不同的窗口系统(WS)定义相应的宏：<span>&nbsp;</span><tt>Q_WS_*</tt><span class="anchor" id="line-11-1"></span></p></li></ul><p class="line867"><span class="anchor" id="line-12"></span><span class="anchor" id="line-13"></span><span class="anchor" id="line-14"></span><span class="anchor" id="line-15"></span><span class="anchor" id="line-16"></span><span class="anchor" id="line-17"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1"></span>Q_WS_X11
<span class="anchor" id="line-2"></span>Q_WS_MAC
<span class="anchor" id="line-3"></span>Q_WS_QWS
<span class="anchor" id="line-4"></span>Q_WS_WIN
<span class="anchor" id="line-5"></span>Q_WS_S60</pre><span class="anchor" id="line-18"></span><span class="anchor" id="line-19"></span><ul><li>代码中夹杂大量的编译预处理指令 (处理小段)<span class="anchor" id="line-20"></span></li></ul><p class="line867"><span class="anchor" id="line-21"></span><span class="anchor" id="line-22"></span><span class="anchor" id="line-23"></span><span class="anchor" id="line-24"></span><span class="anchor" id="line-25"></span><span class="anchor" id="line-26"></span><span class="anchor" id="line-27"></span><span class="anchor" id="line-28"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-1"></span>#if defined(Q_WS_X11)
<span class="anchor" id="line-2-1"></span>...
<span class="anchor" id="line-3-1"></span>#elif defined(Q_WS_MAC)
<span class="anchor" id="line-4-1"></span>...
<span class="anchor" id="line-5-1"></span>#elif defined(Q_WS_WIN)
<span class="anchor" id="line-6"></span>...
<span class="anchor" id="line-7"></span>#endif</pre><span class="anchor" id="line-29"></span><ul><li>各个窗口系统相关的代码文件 (处理大段)<span class="anchor" id="line-30"></span></li></ul><p class="line867"><span class="anchor" id="line-31"></span><span class="anchor" id="line-32"></span><span class="anchor" id="line-33"></span><span class="anchor" id="line-34"></span><span class="anchor" id="line-35"></span><span class="anchor" id="line-36"></span><span class="anchor" id="line-37"></span><span class="anchor" id="line-38"></span><span class="anchor" id="line-39"></span><span class="anchor" id="line-40"></span><span class="anchor" id="line-41"></span><span class="anchor" id="line-42"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-2"></span>qapplication_x11.cpp
<span class="anchor" id="line-2-2"></span>qapplication_win.cpp
<span class="anchor" id="line-3-2"></span>qapplication_s60.cpp
<span class="anchor" id="line-4-2"></span>qapplication_mac.mm
<span class="anchor" id="line-5-2"></span>qapplication_qws.cpp
<span class="anchor" id="line-6-1"></span>...
<span class="anchor" id="line-7-1"></span>qwidget_win.cpp
<span class="anchor" id="line-8"></span>qwidget_qws.cpp
<span class="anchor" id="line-9"></span>qwidget_mac.cpp
<span class="anchor" id="line-10"></span>qwidget_x11.cpp
<span class="anchor" id="line-11"></span>...</pre><span class="anchor" id="line-43"></span><span class="anchor" id="line-44"></span><ul><li>src/gui/kernel.pri 等工程文件内，控制哪些文件参与编译<span class="anchor" id="line-45"></span></li></ul><p class="line867"><span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span><span class="anchor" id="line-48"></span><span class="anchor" id="line-49"></span><span class="anchor" id="line-50"></span><span class="anchor" id="line-51"></span><span class="anchor" id="line-52"></span><span class="anchor" id="line-53"></span><span class="anchor" id="line-54"></span><span class="anchor" id="line-55"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-3"></span>win32 {
<span class="anchor" id="line-2-3"></span>...
<span class="anchor" id="line-3-3"></span>}
<span class="anchor" id="line-4-3"></span>symbian {
<span class="anchor" id="line-5-3"></span>...
<span class="anchor" id="line-6-2"></span>}
<span class="anchor" id="line-7-2"></span>unix:x11 {
<span class="anchor" id="line-8-1"></span>...
<span class="anchor" id="line-9-1"></span>}</pre><span class="anchor" id="line-56"></span><span class="anchor" id="line-57"></span><span class="anchor" id="line-58"></span><p class="line874">这一切这意味这什么？？<span class="anchor" id="line-59"></span><span class="anchor" id="line-60"></span></p><p class="line874">如果我们想在这个基础上支持一个新的窗口系统，比如wayland，需要<span class="anchor" id="line-61"></span></p><ul><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">添加平台相关的宏，代码中针对该窗口再扩充<span>&nbsp;</span><tt>#if&nbsp;#elif&nbsp;#endif</tt><span class="anchor" id="line-62"></span></p></li><li>添加平台相关的文件，扩充 **.pri 文件使其融入Qt<span class="anchor" id="line-63"></span></li><li>...<span class="anchor" id="line-64"></span><span class="anchor" id="line-65"></span></li></ul><p class="line874">总之，需要对Qt的代码进行大量的修改。这一切使得将Qt移植到新的窗口系统中，变得不是那么容易。<span class="anchor" id="line-66"></span><span class="anchor" id="line-67"></span></p><h3 id="A.2BTktUDg-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">之后</h3><span class="anchor" id="line-68"></span><p class="line874">QPA 定义了一套接口，而后，将窗口系统相关的代码放到插件中：<span class="anchor" id="line-69"></span><span class="anchor" id="line-70"></span></p><ul><li>src/plugins/platforms/xlib/*<span class="anchor" id="line-71"></span></li><li>src/plugins/platforms/wayland/*<span class="anchor" id="line-72"></span></li><li>src/plugins/platforms/cocoa/*<span class="anchor" id="line-73"></span><span class="anchor" id="line-74"></span></li></ul><p class="line862">这时，如果我们想支持一个新的窗口系统，怎么办？<strong>只需要</strong>编写一个新的插件，而Qt自身的代码则不需要任何改变。<span class="anchor" id="line-75"></span><span class="anchor" id="line-76"></span></p><p class="line874">(当然，编写插件本身还是很有难度的，哈...)<span class="anchor" id="line-77"></span><span class="anchor" id="line-78"></span></p><h2 id="QPA.2BbpB4AX7TZ4Q-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPA源码结构</h2><span class="anchor" id="line-79"></span><p class="line862">为了使插件能供工作，Qt中需要提供有相应的加载接口，在Qt源码中搜索<tt>*_qpa.h</tt>、<tt>*_qpa.cpp</tt>、<tt>&nbsp;*_qpa_p.h</tt><span>&nbsp;</span>即可找到所有(fixme)和 qpa有关的代码：<span class="anchor" id="line-80"></span><span class="anchor" id="line-81"></span></p><ul><li>QTDIR/src/opengl<span class="anchor" id="line-82"></span><ul><li>qgl_qpa.cpp<span class="anchor" id="line-83"></span></li></ul></li><li>QTDIR/src/gui<span class="anchor" id="line-84"></span><ul><li>painting<span class="anchor" id="line-85"></span><ul><li>qcolormap_qpa.cpp<span class="anchor" id="line-86"></span></li><li>qpaintdevice_qpa.cpp<span class="anchor" id="line-87"></span></li></ul></li><li>image<span class="anchor" id="line-88"></span><ul><li>qpixmap_qpa.cpp<span class="anchor" id="line-89"></span></li></ul></li><li>egl<span class="anchor" id="line-90"></span><ul><li>qegl_qpa.cpp<span class="anchor" id="line-91"></span></li></ul></li><li>kernel<span class="anchor" id="line-92"></span><ul><li>qplatformintegrationplugin_qpa.cpp<span class="anchor" id="line-93"></span></li><li>qplatformcursor_qpa.cpp<span class="anchor" id="line-94"></span></li><li>qwidget_qpa.cpp<span class="anchor" id="line-95"></span></li><li>...<span class="anchor" id="line-96"></span></li></ul></li><li>text<span class="anchor" id="line-97"></span><ul><li>qfontengine_qpa.cpp<span class="anchor" id="line-98"></span></li><li>qfontengine_qpa_p.h<span class="anchor" id="line-99"></span></li><li>...<span class="anchor" id="line-100"></span><span class="anchor" id="line-101"></span></li></ul></li></ul></li></ul><p class="line874">可以看到代码集中在 gui/kernel 部分；除此外，和字体相关gui/text，和绘图相关gui/painting、gui/image、gui/egl，和opengl相关<span class="anchor" id="line-102"></span><span class="anchor" id="line-103"></span></p><h2 id="QPA.2BftNnhA-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPA结构</h2><span class="anchor" id="line-104"></span><span class="anchor" id="line-105"></span><h3 id="QPlatformIntegration" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPlatformIntegration</h3><span class="anchor" id="line-106"></span><p class="line874">这个应该算是 QPA 的核心了，<span class="anchor" id="line-107"></span></p><ul><li>它是QApplication(准确地说是QApplicationPrivate)的成员<span class="anchor" id="line-108"></span></li></ul><p class="line867"><span class="anchor" id="line-109"></span><span class="anchor" id="line-110"></span><span class="anchor" id="line-111"></span><span class="anchor" id="line-112"></span><span class="anchor" id="line-113"></span><span class="anchor" id="line-114"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-4"></span>class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate
<span class="anchor" id="line-2-4"></span>{
<span class="anchor" id="line-3-4"></span>...
<span class="anchor" id="line-4-4"></span>    static QPlatformIntegration *platform_integration;
<span class="anchor" id="line-5-4"></span>...</pre><span class="anchor" id="line-115"></span><span class="anchor" id="line-116"></span><ul><li>在初始化QAppliction时它会被创建<span class="anchor" id="line-117"></span></li></ul><p class="line867"><span class="anchor" id="line-118"></span><span class="anchor" id="line-119"></span><span class="anchor" id="line-120"></span><span class="anchor" id="line-121"></span><span class="anchor" id="line-122"></span><span class="anchor" id="line-123"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-5"></span>QApplication::QApplication()
<span class="anchor" id="line-2-5"></span>  QApplicationPrivate::construct()
<span class="anchor" id="line-3-5"></span>   qt_init()
<span class="anchor" id="line-4-5"></span>     init_platform()
<span class="anchor" id="line-5-5"></span>       QPlatfromIntegrationFactory::create()</pre><span class="anchor" id="line-124"></span><span class="anchor" id="line-125"></span><ul><li>它是所有窗口系统相关函数的入口点<span class="anchor" id="line-126"></span></li></ul><p class="line867"><span class="anchor" id="line-127"></span><span class="anchor" id="line-128"></span><span class="anchor" id="line-129"></span><span class="anchor" id="line-130"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-6"></span>class Q_GUI_EXPORT QPlatformIntegration
<span class="anchor" id="line-2-6"></span>{
<span class="anchor" id="line-3-6"></span>public:</pre><span class="anchor" id="line-131"></span><span class="anchor" id="line-132"></span><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td colspan="2" style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">GraphicsSystem functions</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-133"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QPixmapData&nbsp;*createPixmapData()</tt></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-134"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QPlatformWindow&nbsp;*createPlatformWindow()</tt></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-135"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QWindowSurface&nbsp;*createWindowSurface()</tt></p></td></tr><tr><td colspan="2" style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-136"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Window System functions</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-137"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QList&lt;QPlatformScreen&nbsp;*&gt;&nbsp;screens()</tt></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-138"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;void&nbsp;moveToScreen()</tt></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-139"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;bool&nbsp;isVirtualDesktop()</tt></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-140"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QPixmap&nbsp;grabWindow()</tt></p></td></tr><tr><td colspan="2" style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-141"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Deeper window system integrations</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-142"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QPlatformFontDatabase&nbsp;*fontDatabase()</tt></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-143"></span></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><tt>virtual&nbsp;QPlatformClipboard&nbsp;*clipboard()</tt></p></td></tr><tr><td colspan="2" style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-144"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">...</p></td></tr></tbody></table></div><span class="anchor" id="line-145"></span><span class="anchor" id="line-146"></span><p class="line874">这样一来：<span class="anchor" id="line-147"></span></p><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>当你在程序中</strong></p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>它会向QPlatformIntegration请求</strong></p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-148"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用QWidget时</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">给我一个窗口(QPlatformWindow)及绘图区域(QWindowSurface)</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-149"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用QPixmap时</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">给我一个位图的后端(QPixmapData)</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-150"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用QFont时</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">给我字体数据信息(QPlatformFontDatabase)</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-151"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用QGLWidget时</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">给我一个窗口</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-152"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">...</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">...</p></td></tr></tbody></table></div><span class="anchor" id="line-153"></span><span class="anchor" id="line-154"></span><h3 id="QPlatformWindow_.2BTg4_QWindowSurface" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPlatformWindow 与 QWindowSurface</h3><span class="anchor" id="line-155"></span><span class="anchor" id="line-156"></span><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">QPlatformWindow</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">窗口<br />负责窗口的几何尺寸<br />可以是另一个窗口的子窗口</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-157"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">QWindowSurface</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">窗口绘图区域(drawing area of a window)<br />它来决定使用哪一个paintEngine<br />将像素Push到屏幕上</p></td></tr></tbody></table></div><span class="anchor" id="line-158"></span><span class="anchor" id="line-159"></span><span class="anchor" id="line-160"></span><span class="anchor" id="line-161"></span><p class="line862">相对而言，QPlatformWindow 出现的比较晚一点(见<a class="http" href="http://labs.qt.nokia.com/2010/04/21/say-hello-to-qplatformwindow/" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Say hello to QPlatformWindow</a>一文）之所以。之所以分离开来，原因见<a class="http" href="http://labs.qt.nokia.com/2010/04/06/remodelling-the-lighthouse/" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Remodelling the Lighthouse</a>。<span class="anchor" id="line-162"></span><span class="anchor" id="line-163"></span></p><h3 id="QPlatformScreen" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPlatformScreen</h3><span class="anchor" id="line-164"></span><span class="anchor" id="line-165"></span><ul><li>代表屏幕(显示器)<span class="anchor" id="line-166"></span></li><li>它提供的api对应用程序来说是只读的<span class="anchor" id="line-167"></span></li><li>用来计算分辨率 dpi<span class="anchor" id="line-168"></span></li></ul><p class="line867"><span class="anchor" id="line-169"></span><span class="anchor" id="line-170"></span><span class="anchor" id="line-171"></span><span class="anchor" id="line-172"></span><span class="anchor" id="line-173"></span><span class="anchor" id="line-174"></span><span class="anchor" id="line-175"></span><span class="anchor" id="line-176"></span><span class="anchor" id="line-177"></span></p><pre style="word-wrap: break-word; white-space: pre-wrap; padding-top: 0.5em; padding-right: 0.5em; padding-bottom: 0.5em; padding-left: 0.5em; font-family: courier, monospace; border-top-width: 1pt; border-right-width: 1pt; border-bottom-width: 1pt; border-left-width: 1pt; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #c0c0c0; border-right-color: #c0c0c0; border-bottom-color: #c0c0c0; border-left-color: #c0c0c0; background-color: #f0ece6; "><span class="anchor" id="line-1-7"></span>class Q_GUI_EXPORT QPlatformScreen : public QObject
<span class="anchor" id="line-2-7"></span>{
<span class="anchor" id="line-3-7"></span>...
<span class="anchor" id="line-4-6"></span>    virtual QRect geometry() const = 0;
<span class="anchor" id="line-5-6"></span>    virtual QRect availableGeometry() const {return geometry();}
<span class="anchor" id="line-6-3"></span>    virtual int depth() const = 0;
<span class="anchor" id="line-7-3"></span>    virtual QImage::Format format() const = 0;
<span class="anchor" id="line-8-2"></span>    virtual QSize physicalSize() const;</pre><span class="anchor" id="line-178"></span><span class="anchor" id="line-179"></span><h3 id="QPixmapData" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPixmapData</h3><span class="anchor" id="line-180"></span><p class="line874">为什么要有这个东西？<span class="anchor" id="line-181"></span><span class="anchor" id="line-182"></span></p><p class="line874">通常我们似乎都不怎么区分QImage和QPixmap，尽管在Manual中很大的篇幅在描述这二者的区别。<span class="anchor" id="line-183"></span><span class="anchor" id="line-184"></span></p><p class="line874">设计目的和用途(一个是IO和像素操作，一个是屏幕显示)：<span class="anchor" id="line-185"></span></p><ul><li>QImage is designed and optimized for I/O, and for direct pixel access and manipulation<span class="anchor" id="line-186"></span></li><li>while QPixmap is designed and optimized for showing images on screen.<span class="anchor" id="line-187"></span><span class="anchor" id="line-188"></span></li></ul><p class="line874">典型的用途：<span class="anchor" id="line-189"></span></p><ul><li>Typically, the QImage class is used to load an image file, optionally manipulating the image data, before the QImage object is converted into a QPixmap to be shown on screen.<span class="anchor" id="line-190"></span></li><li>Alternatively, if no manipulation is desired, the image file can be loaded directly into a QPixmap.<span class="anchor" id="line-191"></span><span class="anchor" id="line-192"></span></li></ul><p class="line874">与QImage不同，QPixmap 是平台相关的<span class="anchor" id="line-193"></span><span class="anchor" id="line-194"></span></p><ul><li style="list-style-type: none; ">Note that the pixel data in a pixmap is internal and is managed by the underlying window system.<span class="anchor" id="line-195"></span><span class="anchor" id="line-196"></span></li></ul><p class="line874">于是它的后端需要由各个窗口系统来提供也就不足为奇了。<span class="anchor" id="line-197"></span><span class="anchor" id="line-198"></span></p><h3 id="QPlatformFontDatabase" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">QPlatformFontDatabase</h3><span class="anchor" id="line-199"></span><p class="line874">提供字体信息<span class="anchor" id="line-200"></span><span class="anchor" id="line-201"></span></p><p class="line862">详见<a class="http" href="http://labs.qt.nokia.com/2010/09/02/fonts-in-lighthouse/" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Fonts in Lighthouse</a>一文。<span class="anchor" id="line-202"></span><span class="anchor" id="line-203"></span></p><h3 id="A.2BUXZO1g-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">其他</h3><span class="anchor" id="line-204"></span><ul><li>QPlatformClipboard<span class="anchor" id="line-205"></span></li><li>QPlatformCursor<span class="anchor" id="line-206"></span></li><li>...<span class="anchor" id="line-207"></span><span class="anchor" id="line-208"></span></li></ul><p class="line874">同前面几个一样，从名字上容易看出是做什么的。<span class="anchor" id="line-209"></span><span class="anchor" id="line-210"></span></p><h2 id="A.2BU8KAAw-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">参考</h2><span class="anchor" id="line-211"></span><ul><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="http" href="http://labs.qt.nokia.com/2010/04/06/remodelling-the-lighthouse/" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://labs.qt.nokia.com/2010/04/06/remodelling-the-lighthouse/</a><span class="anchor" id="line-212"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="http" href="http://labs.qt.nokia.com/2010/04/21/say-hello-to-qplatformwindow/" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://labs.qt.nokia.com/2010/04/21/say-hello-to-qplatformwindow/</a><span class="anchor" id="line-213"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="http" href="http://labs.qt.nokia.com/2010/09/02/fonts-in-lighthouse" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://labs.qt.nokia.com/2010/09/02/fonts-in-lighthouse</a></p></li></ul></span><img src ="http://www.cppblog.com/lauer3912/aggbug/155888.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-15 21:24 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/15/155888.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Qt5 结构及模块组成？</title><link>http://www.cppblog.com/lauer3912/archive/2011/09/15/155887.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 15 Sep 2011 13:23:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/09/15/155887.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/155887.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/09/15/155887.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/155887.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/155887.html</trackback:ping><description><![CDATA[<div><a href="http://blog.csdn.net/dbzhang800/article/details/6686859">http://blog.csdn.net/dbzhang800/article/details/6686859<br /><br /><br /><span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; -webkit-text-decorations-in-effect: none; background-color: #ffffff; "><ul><li style="list-style-type: none; ">作为一个Qt的粉丝，对将于明年发布的Qt5充满了期待。可是想想Qt5将发生的巨大变化，心底又有点不安。Qt5到底会变成什么样呢？<span class="anchor" id="line-2"></span><span class="anchor" id="line-3"></span></li></ul><p class="line874">看看近期Qt5的一些大动作：<span class="anchor" id="line-4"></span></p><ul><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">从 QtCore中移除 QSettings以及对QSettings的依赖(创建独立的模块？)<span class="anchor" id="line-5"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">从 QtCore中移除 QtConcurrent(创建独立模块？)<span class="anchor" id="line-6"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">将 QJSEngine 和 QDeclarativeEngine 放入 QtCore<span class="anchor" id="line-7"></span></p></li><li><p class="line862" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">从 QtGui 中分离出 QtPrintSupport，保留pdf生成功能<span class="anchor" id="line-8"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; ">QtCore 添加 zip 文件的读写功能<span class="anchor" id="line-9"></span></p></li><li>...<span class="anchor" id="line-10"></span><span class="anchor" id="line-11"></span></li></ul><h2 id="Qt5_.2BftNnhA-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">Qt5 结构</h2><span class="anchor" id="line-12"></span><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Essentials</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在所有平台可用</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-13"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Tools</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt的不可分割的组成部分，在所有桌面平台可用</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-14"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Add-Ons</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">可跨平台，也可不跨</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-15"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">其他模块和工具</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">第三方？</p></td></tr></tbody></table></div><span class="anchor" id="line-16"></span><span class="anchor" id="line-17"></span><h2 id="Qt5_.2BdoRX.2BnhAaiFXVw.28Qt_Essentials.29" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">Qt5 的基础模块(Qt Essentials)</h2><span class="anchor" id="line-18"></span><span class="anchor" id="line-19"></span><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Core</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-20"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Network</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">可能会集成到 Core</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-21"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Gui</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">除去所有QWidget相关的类以后的部分</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-22"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt OpenGL</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">可能会被合并到其他模块</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-23"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Quick2</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-24"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Test</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-25"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Sql</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-26"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">V8 JavaScript engine</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-27"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt DBus</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">由于依赖问题，必须被包含进来</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-28"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt WebKit</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">提供新的底层C++和QML的接口</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-29"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt MultimediaKit</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-30"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">来自Qt mobility的一些模块</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">初期可能还不会包含进来</p></td></tr></tbody></table></div><span class="anchor" id="line-31"></span><span class="anchor" id="line-32"></span><span class="anchor" id="line-33"></span><p class="line874">Qt5 的核心将是 Qt Quick，qml和javascript将成为一等公民。这些模块中变化最大的当属 Gui 模块了，GUI结构进行了彻底的更新：<span class="anchor" id="line-34"></span></p><ul><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><strong>SceneGraph</strong>, 什么东东呢？不太了解。似乎：&#8220;Scene Graph&#8221;是一种组织场景数据的方法，它把数据放进一个层次结构里。<span class="anchor" id="line-35"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><strong>OpenGL</strong>， Qt5将依赖OpenGL 2<span class="anchor" id="line-36"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><strong>lighthouse(QPA)</strong>，各个平台下图形系统的移植靠它实现，不过现在好像还没看到Win32插件的影子。<span class="anchor" id="line-37"></span><span class="anchor" id="line-38"></span></p></li></ul><p class="line862">同时 QWidget 相关内容将独立成为QtWidget 模块，与打印相关内容，独立出来成为QtPrintSupport,...<span class="anchor" id="line-39"></span><span class="anchor" id="line-40"></span></p><p class="line862">但是，这并不是说这部分被废弃了。之所以不在Qt Essentials内，是因为并不是所有平台都需要它。对于桌面平台来说，QtWidget 和其他模块一样，是一等公民！！<span class="anchor" id="line-41"></span><span class="anchor" id="line-42"></span></p><ul><li style="list-style-type: none; "><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><strong>We want to send the correct message to the users of QWidget classes:</strong><span>&nbsp;</span>they are 1st class citizens in the desktop environment, but not necessarily available in the embedded or mobile environments<span class="anchor" id="line-43"></span><span class="anchor" id="line-44"></span></p></li></ul><h2 id="Qt.2BlkRSoH7ETvY.28Qt_Add-Ons.29" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">Qt附加组件(Qt Add-Ons)</h2><span class="anchor" id="line-45"></span><p class="line874">在Qt5中，尽管 Qt Quick 是Qt的中心，但是Qt5仍将一如既往支持原生C++ Qt，而且不想与现在Qt4开发的代码分裂。Qt4中的一些模块在Qt5中被放入Qt Add-Ons中。<span class="anchor" id="line-46"></span><span class="anchor" id="line-47"></span></p><ul><li style="list-style-type: none; ">Qt 5 continues to offer all of the power of native Qt C++, and we don&#8217;t want Qt 5 to be disruptive for existing code developed for Qt 4.<span class="anchor" id="line-48"></span><span class="anchor" id="line-49"></span></li></ul><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">QWidget 模块</p></td><td colspan="1" rowspan="5" style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; text-align: center; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">模块成熟级别：<strong>完成(Done)</strong><br />不再添加新特性或进行性能优化</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-50"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Xml</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-51"></span><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">XmlPatterns</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-52"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Script 和 Scripts Tools</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-53"></span><p class="line891" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">ActiveQt</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-54"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Svg</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">模块成熟级别：<strong>废弃</strong><br />QtWebKit提供Svg Full支持</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-55"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Mobility中的一些模块</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-56"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Quick components模块</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-57"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">3D</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-58"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">graphics effects</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; ">&nbsp;</td></tr></tbody></table></div><span class="anchor" id="line-59"></span><span class="anchor" id="line-60"></span><p class="line874">还有些东西没看到哈，比如：<span class="anchor" id="line-61"></span></p><div><table style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0px; margin-left: 0.5em; border-collapse: collapse; "><tbody><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">phonon</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">phonon由KDE社区继续维护，Qt建议使用 QtMultimediaKit</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-62"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt Multimedia</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">从Qt4.8开始，废弃，建议 QtMultimediaKit</p></td></tr><tr><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><span class="anchor" id="line-63"></span><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt3 Support</p></td><td style="padding-top: 0.25em; padding-right: 0.5em; padding-bottom: 0.25em; padding-left: 0.5em; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #047307; border-right-color: #047307; border-bottom-color: #047307; border-left-color: #047307; "><p class="line862" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">废弃</p></td></tr></tbody></table></div><span class="anchor" id="line-64"></span><span class="anchor" id="line-65"></span><h2 id="A.2BU8KAAw-" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0.3em; padding-left: 0px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #047307; ">参考</h2><span class="anchor" id="line-66"></span><ul><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="http" href="http://developer.qt.nokia.com/groups/qt_contributors_summit/wiki/Qt5ProductDefinition" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://developer.qt.nokia.com/groups/qt_contributors_summit/wiki/Qt5ProductDefinition</a><span class="anchor" id="line-67"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="http" href="http://developer.qt.nokia.com/wiki/Qt_5.0" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://developer.qt.nokia.com/wiki/Qt_5.0</a><span class="anchor" id="line-68"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="http" href="http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_Level" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_Level</a><span class="anchor" id="line-69"></span></p></li><li><p class="line891" style="margin-top: 0.25em; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; "><a class="https" href="https://bugreports.qt.nokia.com/browse/QTBUG-20885" style="color: #047307; text-decoration: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">https://bugreports.qt.nokia.com/browse/QTBUG-20885</a></p><div></div></li></ul></span><br /></a></div><img src ="http://www.cppblog.com/lauer3912/aggbug/155887.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-09-15 21:23 <a href="http://www.cppblog.com/lauer3912/archive/2011/09/15/155887.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt的模态对话框和非模态对话框 经常使用setAttribute (Qt::WA_DeleteOnClose);</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/30/154747.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 30 Aug 2011 15:57:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/30/154747.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154747.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/30/154747.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154747.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154747.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>模态对话框就是指在子对话框弹出时，焦点被强行集中于该子对话框，子对话框不关闭，用户将无法操作其他的窗口。非模态相反，用户仍然可以操作其他的窗口，包括该子对话框的父对话框。</p><div>如果从线程角度来讲，模态对话框实际上是线程阻塞的，也就是子对话框是一个线程，但是在创建这个子线程之后，父窗口就阻塞了；模态对话框则不是阻塞型的线程模型，父子线程可以并行运行。</div><div>和所有流行的图形类库一样，Qt也提供了创建模态和非模态对话框的机制。</div><div>在Qt中创建模态对话框，主要用到了QDialog的exec函数：</div><div>SonDialog dlg(this);</div><div>int res = dlg.exec();</div><div>if (res == QDialog::Accepted)</div><div>{</div><div>&nbsp;&nbsp; &nbsp;QMessageBox::information(this, "INFORMATION", "You clicked OK button!");</div><div>}</div><div>if (res == QDialog::Rejected)</div><div>{</div><div>&nbsp;&nbsp; &nbsp;QMessageBox::information(this, "INFORMATION", "You clicked CANCEL button!");</div><div>}</div><div>正如上面代码所显示的，可以通过exec函数的返回值来判断用户点击了哪个按钮使得模态对话框退出的，这可以使得我们能够根据用户的不同行为在推出退出模态对话框之后采取不同的处理方法。</div><div>在Qt中创建非模态对话框，主要用到了QDialog的show函数：</div><div>SonDialog *dlg;</div><div>dlg = new SonDialog(this);</div><div>dlg-&gt;show();</div><div>由上面代码，细心的读者可能就会问了，既然new了，如果不delete，那么内存不就存在了泄露的问题了吗？确实如此！所以，我们希望该Qt窗口在退出时自动能够delete掉自己，因此，我们在SonDialog的构造函数里，添加这样的一句代码：</div><div>setAttribute (Qt::WA_DeleteOnClose);</div><div>这样，我们的SonDialog就能够在它退出时自动的delete掉自己了，不会再造成内存泄漏问题。</div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154747.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-30 23:57 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/30/154747.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt paintEvent绘制窗体 注意Qt::WA_PaintOutsidePaintEvent 只是适用于X11，其他系统均无效</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/30/154746.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 30 Aug 2011 15:51:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/30/154746.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/154746.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/30/154746.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/154746.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/154746.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>QPainter默认只能在paintEvent里面调用,但是:</p><p>&nbsp;</p><p>在其他事件中绘制窗体，提示信息如下：<br />QPainter::begin: Paint device returned engine == 0, type: 1<br /><br />绘制操作应该在paintEvent中完成.<br /><br />有一个属性值，在构造函数中设置可以在paintEvent()之外进行绘制：&nbsp;<br />this-&gt;setAttribute(Qt::WA_PaintOutsidePaintEvent);&nbsp;<br /><br />但是只支持X11，对于 Windows, Mac OS X or Embedded Linux。。。。不予支持</p><p>&nbsp;</p><p>void xx::paintEvent(QPaintEvent *p)</p><p>{</p><p>&nbsp; painter.begin(this);</p><p>&nbsp; painter.drawImage(image);</p><p>&nbsp; painter.end();</p><p>}</p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/154746.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-30 23:51 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/30/154746.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>doxygen2qthelp</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/16/153601.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 16 Aug 2011 15:29:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/16/153601.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/153601.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/16/153601.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/153601.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/153601.html</trackback:ping><description><![CDATA[<span style="font-size: 12px;">git://gitorious.org/qt-labs/doxygen2qthelp.git</span><img src ="http://www.cppblog.com/lauer3912/aggbug/153601.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-16 23:29 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/16/153601.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt的插件机制</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/10/152914.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Tue, 09 Aug 2011 23:34:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/10/152914.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152914.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/10/152914.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152914.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152914.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: http://yanboo.ycool.com/post.2749491.html(来自Qt文档)Qt有两种与插件有关的API。一种用来扩展Qt本身的功能，如自定义数据库驱动，图像格式，文本编解码，自定义分格，等等，称为Higher-Level API。另一种用于应用程序的功能扩展，称为Lower-Level API。前一种是建立在后一种的基础之上的。这里讨论的是后一种，即用来扩展应用程序的Low...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/08/10/152914.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/152914.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-10 07:34 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/10/152914.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决Qt系统托盘上下文菜单无法消失的问题</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152501.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:34:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152501.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152501.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152501.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152501.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152501.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; background-color: #ffffff; "><h3 style="font-size: 16px; line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 10px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: black; "><a href="http://fantasticinblur.iteye.com/blog/902263" style="color: #006699; text-decoration: underline; ">解决Qt系统托盘上下文菜单无法消失的问题</a></h3></span><span class="Apple-style-span" style="font-family: Arial, sans-serif, Helvetica, Tahoma; font-size: 12px; line-height: 18px; background-color: #ffffff; "><div id="blog_content" class="blog_content" style="font-size: 14px; line-height: 1.8em; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">在Qt demo中可以找到Qt系统托盘的例子（Desktop -&gt; System Tray）。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">右击系统托盘，可以弹出上下文菜单。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">然而在window下，弹出的菜单无法消失，必须点击菜单项或者应用程序窗体才会消失。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">如图：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><br /><img src="http://dl.iteye.com/upload/attachment/408676/03540542-5965-3af4-b696-c4a6349821a5.png" alt="" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">查阅Qt的BugReport，有相关记录。参见<a href="http://bugreports.qt.nokia.com/browse/QTBUG-7386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#issue-tabs" style="color: #006699; text-decoration: underline; ">http://bugreports.qt.nokia.com/browse/QTBUG-7386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel</a>。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">按照issue给出的方法，没有能够解决这个问题。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">参照Qt帮助文档：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><h3 class="fn" style="font-size: 1.2em; line-height: 1.5em; margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: black; ">void QSystemTrayIcon::setContextMenu (&nbsp;<a href="http://fantasticinblur.iteye.com/admin/blogs/qmenu.html" style="color: #00732f; text-decoration: none; ">QMenu</a>&nbsp;*&nbsp;<em style="font-style: italic; ">menu</em>&nbsp;)</h3><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 15px; ">发现有如下说明：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 15px; ">&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong style="font-weight: bold; color: #363534; line-height: 20px; ">&nbsp;</strong><span style="font-family: Verdana; font-size: 13px; color: #363534; line-height: 20px; "><strong style="font-weight: bold; ">Note:</strong>&nbsp;The system tray icon does not take ownership of the menu. You must ensure that it is deleted at the appropriate time by, for example, creating the menu with a suitable parent object.</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">注意到Qt demo中给出的示例是这样初始化上下文菜单的：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "></p><div class="dp-highlighter" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: transparent; width: 694px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; "><div class="bar"><div class="tools" style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: black; font-weight: bold; ">Cpp代码&nbsp;<embed src="http://fantasticinblur.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=trayIconMenu%20%3D%20new%20QMenu(this)%3B" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">&nbsp;<a href="http://fantasticinblur.iteye.com/blog/902263" title="收藏这段代码" style="color: #006699; text-decoration: underline; "><img class="star" src="http://fantasticinblur.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></a></div></div><ol start="1" class="dp-cpp" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; color: #2b91af; "><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span><span>trayIconMenu&nbsp;=&nbsp;</span><span class="keyword" style="color: #7f0055; ">new</span><span>&nbsp;QMenu(</span><span class="keyword" style="color: #7f0055; ">this</span><span>);&nbsp;&nbsp;</span></span></li></ol></div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;也就是说，该上下文菜单的context是默认的应用程序窗体，然而文档中已经表述的非常清楚：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="font-family: Verdana; font-size: 13px; color: #363534; line-height: 20px; ">The system tray icon does not take ownership of the menu.</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">所以，当窗体获得焦点时，系统托盘的上下文菜单才会消失。换言之，如果该菜单的context是整个桌面的话，点击菜单之外的其他任何地方，菜单就会消失，这样我们的问题就解决了。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">修改上文的初始化语句如下：</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "></p><div class="dp-highlighter" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: transparent; width: 694px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; "><div class="bar"><div class="tools" style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: black; font-weight: bold; ">Cpp代码&nbsp;<embed src="http://fantasticinblur.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=trayIconMenu%20%3D%20new%20QMenu(QApplication%3A%3Adesktop())%3B" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">&nbsp;<a href="http://fantasticinblur.iteye.com/blog/902263" title="收藏这段代码" style="color: #006699; text-decoration: underline; "><img class="star" src="http://fantasticinblur.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></a></div></div><ol start="1" class="dp-cpp" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #d1d7dc; border-right-color: #d1d7dc; border-bottom-color: #d1d7dc; border-left-color: #d1d7dc; color: #2b91af; "><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px; "><span><span>trayIconMenu&nbsp;=&nbsp;</span><span class="keyword" style="color: #7f0055; ">new</span><span>&nbsp;QMenu(QApplication::desktop());&nbsp;&nbsp;</span></span></li></ol></div><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">至此，我们成功解决了这个问题。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">其实Qt的文档中已经做出了说明，所以严格来说，这个bug并不是Qt本身的bug。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">希望本文对同样被这个问题困扰的Qt程序员有所帮助。</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p></div><div class="attachments" style="border-top-width: 1px; border-top-style: solid; border-top-color: #999999; margin-top: 10px; "><ul style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; list-style-type: none; list-style-position: initial; list-style-image: initial; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://fantasticinblur.iteye.com/blog/902263#" style="color: #006699; text-decoration: underline; ">查看图片附件</a></li></ul></div></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152501.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:34 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152501.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt文章精选（标题及链接）</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152499.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:28:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152499.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152499.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152499.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152499.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152499.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">原创:</h3><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/19/6085080.aspx" style="color: #336699; text-decoration: none; ">浅议Qt的事件处理机制 一</a></h4></li></h4><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/22/6092978.aspx" style="color: #336699; text-decoration: none; ">浅议Qt的事件处理机制 二</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/11/30/6044599.aspx" style="color: #336699; text-decoration: none; ">Qt的内省机制剖析</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/04/6114819.aspx" style="color: #336699; text-decoration: none; ">梦工厂动画与Qt</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/27/6167059.aspx" style="color: #336699; text-decoration: none; ">QML与C++混合编程使用</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/29/6168795.aspx" style="color: #336699; text-decoration: none; ">Qt/Qt Quick宏浅议</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/29/6169155.aspx" style="color: #336699; text-decoration: none; ">Q_INVOKABLE与invokeMethod用法全解</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/10/6068496.aspx" style="color: #336699; text-decoration: none; ">Qt 在symbian^3, windows 7 phone的用户体验</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/23/6095288.aspx" style="color: #336699; text-decoration: none; ">Qt资源链接收藏</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/25/6163044.aspx" style="color: #336699; text-decoration: none; ">Qt 好书好文推荐</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/07/24/5761590.aspx" style="color: #336699; text-decoration: none; ">诺基亚手机开发相关论坛网站推荐</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/article/details/%E5%88%9B%E5%BB%BAqt%20quick%20(qml)%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F" style="color: #336699; text-decoration: none; ">创建Qt quick (qml) 应用程序</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/31/6110303.aspx" style="color: #336699; text-decoration: none; ">Thread affinity与跨线程信号槽</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/29/6105018.aspx" style="color: #336699; text-decoration: none; ">Qt的智能指针使用指南</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span class="link_title"><a title="Qt的字符集编码以及转换" href="http://blog.csdn.net/changsheng230/article/details/6588447" style="color: #336699; text-decoration: none; ">Qt的字符集编码以及转换</a></span><span class="link_title"></span></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span class="link_title"><a title="QImage, QPixmap 的官方解释摘录" href="http://blog.csdn.net/changsheng230/article/details/6452825" style="color: #336699; text-decoration: none; ">QImage, QPixmap 的官方解释摘录</a></span><span class="link_title"></span></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span class="link_title"><a title="Qt  认证考试有用链接" href="http://blog.csdn.net/changsheng230/article/details/6451995" style="color: #336699; text-decoration: none; ">Qt 认证考试有用链接</a></span></h4></li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</h4><li><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">译文：</h3></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/27/6101232.aspx" style="color: #336699; text-decoration: none; ">事件循环与线程 一</a>&nbsp;&nbsp; （Event,Thread and QObject）</h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/19/6153449.aspx" style="color: #336699; text-decoration: none; ">事件循环与线程 二</a>&nbsp;&nbsp; （推荐）</h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/30/6170007.aspx" style="color: #336699; text-decoration: none; ">QML与现有Qt UI代码的整合</a></h4></li><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "></h3><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</h3><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">转帖：</h3><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "></h4><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/11/30/6044456.aspx" style="color: #336699; text-decoration: none; ">Qt源码分析之信号和槽机制</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/01/6046846.aspx" style="color: #336699; text-decoration: none; ">Qt源码分析之QObject</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2010/12/23/6095232.aspx" style="color: #336699; text-decoration: none; ">Qt事件和事件过滤器</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/28/6167933.aspx" style="color: #336699; text-decoration: none; ">Qt版权介绍：GPL, LGPL 以及 Commercial 授权</a></h4></li><li><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/02/03/6172171.aspx" style="color: #336699; text-decoration: none; ">KDE/QT 与 GNOME/GTK 之争</a></h4>&nbsp;&nbsp;<h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a href="http://blog.csdn.net/changsheng230/archive/2011/01/19/6153449.aspx" style="color: #336699; text-decoration: none; "></a></h4><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><hr /></h4><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><p><span style="font-size: 16px; ">请尊重原创作品和译文。转载请保持文章完整性，并以超链接形式注明原始作者</span><a href="http://blog.csdn.net/changsheng230" style="color: #336699; text-decoration: none; "><span style="font-size: 16px; ">主站点</span></a><span style="font-size: 16px; ">地址，方便其他朋友提问和指正。</span></p></h4></li></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152499.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:28 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152499.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用 cmake 构建Qt工程 (对比qmake进行学习)</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152498.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:24:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152498.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152498.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152498.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152498.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152498.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">cmake vs qmake</h2><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">qmake 是为 Qt 量身打造的，使用起来非常方便</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">cmake 使用上不如qmake简单直接，但复杂换来的是强大的功能<ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; "><p class="line862" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">内置的 out-of source 构建。（目前QtCreator为qmake也默认启用了该功能，称：shadow build）</p></li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">为各种平台和场景提供条件编译</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; "><p class="line862" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">可处理多个可执行文件情况，和很好配合 QtTest 工作</p></li></ul></li></ul><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">如何选择?</p><p class="line867" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><a class="http" href="http://developer.qt.nokia.com/quarterly/view/using_cmake_to_build_qt_projects" style="color: #006bad; text-decoration: none; ">Using CMake to Build Qt Projects</a>&nbsp;一文中说：</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">对简单的Qt工程，采用 qmake</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">对复杂度超过 qmake 处理能力的，采用 cmake</li></ul><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">尽管如此，如果简单Qt的工程都不知道怎么用 cmake 构建，复杂的工程，就更不知道如何使用 cmake 了。还是从简单的学起吧</p><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">简单的 Qt 程序</h2><div class="highlight cpp" style="word-wrap: break-word; "><div class="codearea" dir="ltr" style="word-wrap: break-word; "><pre dir="ltr" style="word-wrap: break-word; white-space: normal; "><span class="line"><span class="Preprc">#</span><span class="Preprc">include &lt;QtCore</span><span class="Preprc">/</span><span class="Preprc">QCoreApplication&gt;</span></span><br /><span class="line"><span class="Preprc">#</span><span class="Preprc">include &lt;QtCore</span><span class="Preprc">/</span><span class="Preprc">QDebug&gt;</span></span><br /><span class="line"><span class="ResWord">int</span>&nbsp;<span class="ID">main</span>(<span class="ResWord">int</span>&nbsp;<span class="ID">argc</span>,&nbsp;<span class="ResWord">char</span>**&nbsp;<span class="ID">argv</span>)</span><br /><span class="line">{</span><br /><span class="line"><span class="ID">QCoreApplication</span>&nbsp;<span class="ID">app</span>(<span class="ID">argc</span>,&nbsp;<span class="ID">argv</span>);</span><br /><span class="line"><span class="ID">qDebug</span>()&lt;&lt;<span class="String">"</span><span class="String">hello qt!</span><span class="String">"</span>;</span><br /><span class="line"><span class="ID">app</span>.<span class="ID">exec</span>();</span><br /><span class="line">}</span></pre></div></div><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">如果不使用构建工具，直接调用编译器来编译的话，只需要类似这样的一条命令：</p><pre style="word-wrap: break-word; white-space: normal; ">g++ main.cpp -Ie:/Qt/4.7.0/include -o main -Le:/Qt/4.7.0/lib -lQtCore4</pre><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">指定头文件目录，以及需要链接的库</p><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">qmake</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">qmake 需要一个 .pro 文件:</p><pre style="word-wrap: break-word; white-space: normal; ">CONFIG += qt<br />QT -= gui<br />SOURCES += main.cpp</pre><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; "><p class="line862" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">因为我们需要 Qt的库和头文件，所以需要<tt>&nbsp;CONFIG&nbsp;+=&nbsp;qt&nbsp;</tt>。</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">这是默认项，可直接去掉该行</li></ul></li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">启用qt后，可以通过 QT -= gui 来进一步细调我们需要的模块<ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">默认是 core gui。我们不需要gui模块，故去掉。</li></ul></li></ul><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">cmake</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">cmake 需要一个 CMakeLists.txt 文件：</p><div class="highlight cmake" style="word-wrap: break-word; "><div class="codearea" dir="ltr" style="word-wrap: break-word; "><pre dir="ltr" style="word-wrap: break-word; white-space: normal; "><span class="line"><span class="ResWord">PROJECT</span>(<span class="String">example</span>)</span><br /><span class="line"><span class="ResWord">FIND_PACKAGE</span>(<span class="String">Qt4</span>&nbsp;<span class="String">REQUIRED</span>)</span><br /><span class="line"><span class="ResWord">SET</span>(<span class="String">QT_DONT_USE_QTGUI</span>&nbsp;<span class="String">TRUE</span>)</span><br /><span class="line"><span class="ResWord">INCLUDE</span>(${<span class="ID">QT_USE_FILE</span>})</span><br /><span class="line"><span class="ResWord">ADD_EXECUTABLE</span>(<span class="String">example</span>&nbsp;<span class="String">main.cpp</span>)</span><br /><span class="line"><span class="ResWord">TARGET_LINK_LIBRARIES</span>(<span class="String">example</span>&nbsp;${<span class="ID">QT_LIBRARIES</span>})</span></pre></div></div><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">FIND_PACKAGE 来启用 Qt4</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">默认使用了core 和 gui，故手动禁用 QTGUI<ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; "><p class="line862" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">这两行可以直接使用&nbsp;<tt>FIND_PACKAGE(Qt4&nbsp;COMPONENTS&nbsp;QtCore&nbsp;REQUIRED)</tt>，未指定的模块将被禁用</p></li></ul></li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">包含一个CMake为Qt提供的配置文件，${QT_USE_FILE}变量是一个文件名</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">添加可执行程序目标</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">链接到 Qt 的库</li></ul><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">复杂一点</h2><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">考虑一个常规Qt程序：</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">main.cpp</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindows.ui</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindows.h</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindows.cpp</li></ul><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">如果手动编译的话：</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindow.ui 需要使用 uic 预处理</li></ul><p class="line867" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><pre style="word-wrap: break-word; white-space: normal; ">uic mainwindow.ui -o ui_mainwindow.h</pre><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindow.h 需要 moc 预处理</li></ul><p class="line867" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><pre style="word-wrap: break-word; white-space: normal; ">moc mainwindow.h -o moc_mainwindow.cpp</pre><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">调用编译器进行编译</li></ul><p class="line867" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><pre style="word-wrap: break-word; white-space: normal; ">g++ main.cpp mainwindow.cpp moc_mainwindow.cpp -Ie:/Qt/4.7.0/include -o main -Le:/Qt/4.7.0/lib -lQtCore4 -lQtGui4</pre><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">qmake</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用 qmake 的的话，一个简单的 pro 文件</p><pre style="word-wrap: break-word; white-space: normal; ">TARGET = example<br />TEMPLATE = app<br />SOURCES += main.cpp mainwindow.cpp<br />HEADERS += mainwindow.h<br />FORMS += mainwindow.ui</pre><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">HEADERS 中的文件是否需要 moc 进行预处理，qmake 运行时会根据其是否含有Q_OBJECT自动判断。</p><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">这也是为什么 很多人添加Q_OBJECT宏后不重新运行qmake会出错误的原因。</p><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">cmake</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">看看相应的 cmake 的 CMakeLists.txt 文件</p><div class="highlight cmake" style="word-wrap: break-word; "><div class="codearea" dir="ltr" style="word-wrap: break-word; "><pre dir="ltr" style="word-wrap: break-word; white-space: normal; "><span class="line"><span class="ResWord">PROJECT</span>(<span class="String">example</span>)</span><br /><span class="line"><span class="ResWord">CMAKE_MINIMUM_REQUIRED</span>(<span class="String">VERSION</span>&nbsp;<span class="String">2.6</span>)</span><br /><span class="line"><span class="ResWord">FIND_PACKAGE</span>(<span class="String">Qt4</span>&nbsp;<span class="String">REQUIRED</span>)</span><br /><span class="line"><span class="ResWord">INCLUDE</span>(${<span class="ID">QT_USE_FILE</span>})</span><br /><span class="line"><span class="ResWord">INCLUDE_DIRECTORIES</span>(${<span class="ID">CMAKE_CURRENT_BINARY_DIR</span>})</span><br /><span class="line">QT4_WRAP_CPP(example_MOCS mainwindow.h)</span><br /><span class="line">QT4_WRAP_UI(example_UIS mainwindow.ui)</span><br /><span class="line"><span class="ResWord">ADD_EXECUTABLE</span>(<span class="String">example</span>&nbsp;<span class="String">main.cpp</span>&nbsp;<span class="String">mainwindow.cpp</span>&nbsp;${<span class="ID">example_MOCS</span>})</span><br /><span class="line"><span class="ResWord">TARGET_LINK_LIBRARIES</span>(<span class="String">example</span>&nbsp;${<span class="ID">QT_LIBRARIES</span>})</span></pre></div></div><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">需要 moc 的文件，用 QT4_WRAP_CPP 处理<ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">生成的文件放入变量 example_MOCS 中，最后一块链接到可执行程序</li></ul></li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">需要 uic 的文件，用 QT4_WRAP_UI 处理</li></ul><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">Windows</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">因为windows下链接时分为 console 和 windows 两个子系统，所以windows下有些问题需要特殊处理。</p><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">用 qmake 时：</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">默认是 windows 子系统</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">可以通过 CONFIG += console 使用 console 子系统</li></ul><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">用 cmake 是：</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">默认是 console 子系统</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">使用 windows 子系统需要</li></ul><p class="line867" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><pre style="word-wrap: break-word; white-space: normal; ">SET(QT_USE_QTMAIN TRUE)<br />ADD_EXECUTABLE(example WIN32 main.cpp mainwindow.cpp ${example_MOCS})</pre><p class="line862" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">前者启用 qtmain.lib 库来提供windows下的 WinMain 入口函数。后者链接 windows 子系统</p><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">再复杂一点</h2><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">main.cpp</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindows.ui</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindows.h</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">mainwindows.cpp</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">main.qrc</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">main.rc</li></ul><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">前面已经用到了Qt的 moc 和 uic，这次增加了资源系统 需要用 rcc</p><pre style="word-wrap: break-word; white-space: normal; ">rcc main.qrc -o qrc_main.cpp</pre><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">同时，使用了windows下的资源文件 .rc (比如给程序添加图标)</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">MVSC 中使用 rc.exe 对 .rc 文件进行处理</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">MinGW 中使用 windres.exe 处理 .rc 文件</li></ul><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">qmake</h3><p class="line867" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">&nbsp;</p><pre style="word-wrap: break-word; white-space: normal; ">TARGET = example<br />TEMPLATE = lib<br />HEADERS = mainwindow.h widget.h<br />SOURCES = main.cpp widget.cpp mainwindow.cpp<br />RESOURCES = main.qrc<br />RC_FILE = main.rc</pre><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">cmake</h3><div class="highlight cmake" style="word-wrap: break-word; "><div class="codearea" dir="ltr" style="word-wrap: break-word; "><pre dir="ltr" style="word-wrap: break-word; white-space: normal; "><span class="line"><span class="ResWord">PROJECT</span>(<span class="String">example</span>)</span><br /><span class="line"><span class="ResWord">CMAKE_MINIMUM_REQUIRED</span>(<span class="String">VERSION</span>&nbsp;<span class="String">2.6</span>)</span><br /><span class="line"><span class="ResWord">FIND_PACKAGE</span>(<span class="String">Qt4</span>&nbsp;<span class="String">REQUIRED</span>)</span><br /><span class="line"><span class="ResWord">SET</span>(<span class="String">QT_USE_QTMAIN</span>&nbsp;<span class="String">TRUE</span>)</span><br /><span class="line"><span class="ResWord">INCLUDE</span>(${<span class="ID">QT_USE_FILE</span>})</span><br /><span class="line"><span class="ResWord">INCLUDE_DIRECTORIES</span>(${<span class="ID">CMAKE_CURRENT_BINARY_DIR</span>})</span><br /><br /><span class="line"><span class="ResWord">if</span>(<span class="String">MINGW</span>)</span><br /><span class="line"><span class="ResWord">set</span>(<span class="String">CMAKE_RC_COMPILER_INIT</span>&nbsp;<span class="String">windres</span>)</span><br /><span class="line"><span class="ResWord">ENABLE_LANGUAGE</span>(<span class="String">RC</span>)</span><br /><span class="line"><span class="ResWord">SET</span>(<span class="String">CMAKE_RC_COMPILE_OBJECT</span></span><br /><span class="line"><span class="String">"&lt;CMAKE_RC_COMPILER&gt; &lt;FLAGS&gt; -O coff &lt;DEFINES&gt; -i &lt;SOURCE&gt; -o &lt;OBJECT&gt;"</span>)</span><br /><span class="line"><span class="ResWord">endif</span>(<span class="String">MINGW</span>)</span><br /><br /><span class="line"><span class="ResWord">SET</span>(<span class="String">example_SRCS</span>&nbsp;<span class="String">main.cpp</span>&nbsp;<span class="String">mainwindow.cpp</span>&nbsp;<span class="String">widget.cpp</span>&nbsp;<span class="String">res/main.rc</span>)</span><br /><span class="line"><span class="ResWord">SET</span>(<span class="String">example_MOC_SRCS</span>&nbsp;<span class="String">mainwindow.h</span>&nbsp;<span class="String">widget.h</span>)</span><br /><span class="line">QT4_WRAP_CPP(example_MOCS ${example_MOC_SRCS})</span><br /><span class="line">QT4_ADD_RESOURCES(example_RCC_SRCS main.qrc)</span><br /><span class="line"><span class="ResWord">SET</span>(<span class="String">example_SRCS</span>&nbsp;${<span class="ID">example_SRCS</span>} ${<span class="ID">example_MOCS</span>} ${<span class="ID">example_RCC_SRCS</span>})</span><br /><br /><span class="line"><span class="ResWord">ADD_EXECUTABLE</span>(<span class="String">example</span>&nbsp;<span class="String">WIN32</span>&nbsp;<span class="String">main.cpp</span>&nbsp;<span class="String">mainwindow.cpp</span>&nbsp;${<span class="ID">example_SRCS</span>})</span><br /><span class="line"><span class="ResWord">TARGET_LINK_LIBRARIES</span>(<span class="String">example</span>&nbsp;${<span class="ID">QT_LIBRARIES</span>})</span></pre></div></div><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">对Qt的资源文件，使用 QT4_ADD_RESOURCES 来调用rcc进行预处理</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">对 Windows 资源文件，直接和源文件一样，添加到列表中即可。只是：<ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">MinGW 下仅仅这么做还不行，上面的 MinGW 块用来修复这个问题</li></ul></li></ul><h2 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Debug 与 Release</h2><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">qmake</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用 qmake 时，可以在 pro 文件内分别为两种模式设置不同的选项。</p><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">使用时，可以直接 make release 或 make debug 来编译不同的版本</p><h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: url(http://p.blog.csdn.net/images/p_blog_csdn_net/winnersong/234916/o_li.png); width: 877px; text-indent: 1em; border-bottom-color: #555555; border-bottom-width: 0px; border-bottom-style: dashed; height: 2em; background-origin: initial; background-clip: initial; ">cmake</h3><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">不同于 qmake，由于 cmake 采用 out-of-source 方式。故：</p><ul style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 35px; list-style-type: none; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">建立debug release两目录，分别在其中执行cmake -DCMAKE_BUILD_TYPE=Debug（或Release）</li><li style="padding-right: 0px; padding-left: 0px; padding-bottom: 2px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 2px; list-style-type: disc; ">需要编译不同版本时进入不同目录执行make</li></ul><p class="line874" style="margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">对生成 msvc 工程的情况, CMAKE_BUILD_TYPE 不起作用。生成工程后使用IDE自带的模式选择。</p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152498.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:24 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152498.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt资源链接收藏</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152497.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:22:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152497.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152497.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152497.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152497.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152497.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>Qt在线文档</strong></h4><p><span style="text-decoration: underline; "><span style="color: #810081; "><a href="http://doc.qt.nokia.com/4.7/" style="color: #336699; text-decoration: none; ">http://doc.qt.nokia.com/4.7/</a></span></span></p><p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>Qt e-Learning</strong></h4><p><a href="http://qt.nokia.com/developer/learning/elearning" style="color: #336699; text-decoration: none; ">http://qt.nokia.com/developer/learning/elearning</a></p><p><a href="http://wikis.in.nokia.com/QtSoftware/LearnQt" style="color: #336699; text-decoration: none; ">http://wikis.in.nokia.com/QtSoftware/LearnQt</a></p><p><a href="http://www.ics.com/learning/icsnetwork/" style="color: #336699; text-decoration: none; ">http://www.ics.com/learning/icsnetwork/</a></p><p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>官方Qt移动开发社区、资源、Wiki</strong></h4><p><a href="http://help.github.com/" style="color: #336699; text-decoration: none; ">Getting started with Git and GitHub</a></p><p><a href="https://projects.forum.nokia.com/home/" style="color: #336699; text-decoration: none; ">Nokia Forum projects</a></p><p><a href="http://forum.nokia.com/" style="color: #336699; text-decoration: none; ">http://forum.nokia.com</a></p><p><a href="http://forum.nokia.com.cn/" style="color: #336699; text-decoration: none; ">http://forum.nokia.com.cn/</a>&nbsp;</p><p><a href="http://wiki.forum.nokia.com/index.php/Qt_%E5%BC%80%E5%8F%91" style="color: #336699; text-decoration: none; ">http://wiki.forum.nokia.com/index.php/Qt_%E5%BC%80%E5%8F%91</a></p><p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">官方Qt论坛</h4><p><a href="http://developer.qt.nokia.com/forums" style="color: #336699; text-decoration: none; ">http://developer.qt.nokia.com/forums</a></p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "></h4><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">Qt for Symbian 开发资源</h4><p><a href="http://discussion.forum.nokia.com/forum/showthread.php?162323-Qt-for-Symbian-development-resources" style="color: #336699; text-decoration: none; ">http://discussion.forum.nokia.com/forum/showthread.php?162323-Qt-for-Symbian-development-resources</a></p><p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">中文Qt网站</h4><p><a class="external-link offSite" href="http://qt.csdn.net/" target="_blank" style="color: #336699; text-decoration: none; "><span style="color: #44a51c; ">http://qt.csdn.net</span></a></p><p><a class="external-link offSite" href="http://discussion.forum.nokia.com/forum/forumdisplay.php?f=204" target="_blank" style="color: #336699; text-decoration: none; "><span style="color: #44a51c; ">诺基亚论坛上的Qt for Symbian中文论坛</span></a></p><p><span class="718475902-02122008"><span class="link-external"><a class="external-link offSite" href="http://www.qtcn.org/" target="_blank" style="color: #336699; text-decoration: none; "><span style="color: #44a51c; ">http://www.qtcn.org</span></a></span></span></p><p><span class="718475902-02122008"><span class="link-external"><a class="external-link offSite" href="http://www.qteverywhere.com/" target="_blank" style="color: #336699; text-decoration: none; "><span style="color: #44a51c; ">www.qteverywhere.com</span></a></span></span></p><p>&nbsp;</p><p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">中文文档</h4><p><span style="text-decoration: underline; "><span style="color: #810081; "><a href="http://forum.nokia.com.cn/document_1.html" style="color: #336699; text-decoration: none; ">http://forum.nokia.com.cn/document_1.html</a></span></span></p><p><a href="http://qtdocs.sourceforge.net/index.php/%E5%88%86%E7%B1%BB:Qt_%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C" style="color: #336699; text-decoration: none; ">http://qtdocs.sourceforge.net/index.php/%E5%88%86%E7%B1%BB:Qt_%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C</a></p><p><strong><span><br /></span></strong></p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="color: #810081; "><span style="font-family: mceinline; ">其他</span></span></h4><p>&nbsp;</p><p>如果在开发中遇到了技术细节上的问题，相信再下面两个论坛搜索相关关键字会比直接在baidu/google上搜强很多</p><p><a href="http://lists.trolltech.com/qt-interest/" style="color: #336699; text-decoration: none; ">http://lists.trolltech.com/qt-interest/</a></p><p>&nbsp;</p><p>&nbsp;</p><p>Qt在SlideShare的幻灯片</p><p><span style="text-decoration: underline; "><span style="color: #810081; "><a href="http://www.slideshare.net/tag/qt" style="color: #336699; text-decoration: none; ">http://www.slideshare.net/tag/qt</a></span></span></p><p>&nbsp;</p><p><span style="text-decoration: underline; "><span style="color: #810081; "></span></span></p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">非官方的优秀Qt论坛</h4><p><a href="http://www.qtcentre.org/forum/" style="color: #336699; text-decoration: none; ">http://www.qtcentre.org/forum/</a></p><p>&nbsp;</p><p>&nbsp;</p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152497.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:22 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152497.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Q_INVOKABLE与invokeMethod用法全解</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152496.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:19:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152496.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152496.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152496.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152496.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152496.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p><span style="font-size: medium; ">请尊重原创作品和译文。转载请保持文章完整性，并以超链接形式注明原始作者</span><span style="font-size: medium; ">地址<a href="http://blog.csdn.net/changsheng230" style="color: #336699; text-decoration: none; ">http://blog.csdn.net/changsheng230</a>，方便其他朋友提问和指正。</span></p><p>&nbsp;</p><p>在<a href="http://blog.csdn.net/changsheng230/archive/2011/01/29/6168795.aspx" style="color: #336699; text-decoration: none; ">Qt/Qt Quick宏浅议</a>一文中，我们将介绍Qt中经常使用的几个宏： Q_OBJECT, SIGNAL与SLOT, Q_SIGNALS 与 Q_SLOTS, Q_EMIT ,Q_INVOKABLE, Q_PROPERTY。相比其他宏，Q_INVOKABLE 显得更加神秘，但Q_INVOKABLE的理解与使用变得越来越重要。本文将围绕Q_INVOKABLE以及相对应的invokeMethod展开讨论。</p><h5><strong>Q_INVOKABLE</strong></h5><p>#define Q_INVOKABLE</p><p>重新回顾一下Q_INVOKABLE的定义，它在$QTDIR/src/corelib/kernel/qobjectdefs.h 中，简单被define，目的在于让moc识别。</p><p>使用Q_INVOKABLE来修饰成员函数，目的在于被修饰的成员函数能够被元对象系统所唤起。</p><h5>QMetaObject::invokeMethod</h5><p>静态方法QMetaObject::invokeMethod() 的定义如下：</p><ol><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 647px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6169155#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="datatypes" style="border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; ">bool</span><span style="border-width: initial; border-color: initial; ">&nbsp;QMetaObject::invokeMethod&nbsp;(&nbsp;QObject&nbsp;*&nbsp;obj,&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="datatypes" style="border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; ">char</span><span style="border-width: initial; border-color: initial; ">&nbsp;*&nbsp;member,Qt::ConnectionType&nbsp;type,&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">QGenericReturnArgument&nbsp;ret,&nbsp;QGenericArgument&nbsp;val0&nbsp;=&nbsp;QGenericArgument(&nbsp;0&nbsp;),&nbsp;&#8230;)&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>&nbsp;</p></ol><p>invokeMethod的用法为，尝试调用对象obj的方法member（注意member可以为信号或者是槽)，如何member可以被调用，则返回真，否则返回假。QMetaObject::invokeMethod可以是异步调用，也可以是同步调用。这取决与它的连接方式Qt::ConnectionType type。如果type为Qt::DirectConnection，则为同步调用，若为Qt::QueuedConnection，则为异步调用。例如：</p><ol><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 647px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6169155#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span style="border-width: initial; border-color: initial; ">QMetaObject::invokeMethod(object,&nbsp;</span><span class="string" style="border-width: initial; border-color: initial; ">"methodName"</span><span style="border-width: initial; border-color: initial; ">,&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">Qt::QueuedConnection,&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">Q_ARG(type1,&nbsp;arg1),&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">Q_ARG(type2,&nbsp;arg2));&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p></ol><p>上述调用为异步调用。请注意，因为上面所示的参数需要被在构建事件时进行硬拷贝，参数的自定义型别所对应的类需要提供一个共有的构造函数、析构函数以及拷贝构造函数。而且必须使用注册Qt型别系统所提供的qRegisterMetaType() 方法来注册这一自定义型别。</p><p>Q_INVOKABLE与QMetaObject::invokeMethod均由元对象系统唤起。这一机制在<strong>Qt C++/QML混合编程</strong>，<strong>跨线程编程</strong>，<strong>Qt Service Framework 以及</strong>&nbsp;<strong>Qt/ HTML5混合编程</strong>以及里广泛使用。</p><h5><strong>Qt C++/QML混合编程</strong></h5><p>QML中调用C++方法借助了Qt元对象系统。考虑在QML中使用Qt C++定义的方法，如下代码所示：</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6169155#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span style="border-width: initial; border-color: initial; ">import&nbsp;Qt&nbsp;4.7&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">import&nbsp;Shapes&nbsp;5.0&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//自定义模块</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">Item&nbsp;{&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;width:&nbsp;300;&nbsp;height:&nbsp;200&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Ellipse&nbsp;{&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x:&nbsp;50;&nbsp;y:&nbsp;35;&nbsp;width:&nbsp;200;&nbsp;height:&nbsp;100&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color:&nbsp;<span class="string" style="border-width: initial; border-color: initial; ">"blue"</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MouseArea&nbsp;{&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;anchors.fill:&nbsp;parent&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;调用C++中定义的randomColor方法&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;onClicked:&nbsp;parent.color&nbsp;=&nbsp;parent.randomColor()&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">}&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>为了让上述QML代码成功的调用下面这段代码定义的randomColor()函数，最为关键的一点见randomColor方法用Q_INVOKABLE 修饰。</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6169155#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#include&nbsp;&lt;QDeclarativeItem&nbsp;&gt;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">class</span><span style="border-width: initial; border-color: initial; ">&nbsp;EllipseItem&nbsp;:&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">public</span><span style="border-width: initial; border-color: initial; ">&nbsp;QDeclarativeItem&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">{&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Q_OBJECT&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">public</span><span style="border-width: initial; border-color: initial; ">：&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q_INVOKABLE&nbsp;QColor&nbsp;randomColor()&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8230;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">｝&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>更多细节，请参看我的另一篇博文：<a href="http://blog.csdn.net/changsheng230/archive/2011/01/27/6167059.aspx" style="color: #336699; text-decoration: none; ">QML与C++混合编程使用</a></p><h5>在跨线程编程中的使用</h5><p>我们如何调用驻足在其他线程里的QObject方法呢？Qt提供了一种非常友好而且干净的解决方案：向事件队列post一个事件，事件的处理将以调用我们所感兴趣的方法为主（当然这需要线程有一个正在运行的事件循环）。而触发机制的实现是由moc提供的内省方法实现的。因此，只有信号、槽以及<strong>被标记成Q_INVOKABLE的方法才能够被其它线程所触发调用</strong>。如果你不想通过跨线程的信号、槽这一方法来实现调用驻足在其他线程里的QObject方法。另一选择就是将方法声明为Q_INVOKABLE，并且在另一线程中用<strong>invokeMethod</strong>唤起。</p><p>&nbsp;</p><p>更多细节，译文<a href="http://blog.csdn.net/changsheng230/archive/2011/01/19/6153449.aspx" style="color: #336699; text-decoration: none; "><span style="color: #006bad; ">事件循环与线程</span></a></p><h5><strong>Qt Service Framework</strong></h5><p>Qt服务框架是Qt Mobility 1.0.2版本推出的，一个服务（service）是一个独立的组件提供给客户端（client）定义好的操作。客户端可以通过服务的名称，版本号和服务的对象提供的接口来查找服务。 查找到服务后，框架启动服务并返回一个指针。</p><p>服务通过插件（plug-ins）来实现。为了避免客户端依赖某个具体的库，服务必须继承自QObject。这样<a href="http://qt.nokia.com/doc/4.7/qmetaobject.html" style="color: #336699; text-decoration: none; ">QMetaObject&nbsp;</a>系统可以用来提供动态发现和唤醒服务的能力。要使QmetaObject机制充分的工作，服务必须满足，其所有的方法都是通过 signal，slot，property 或<strong>invokable method</strong>和<strong>Q_INVOKEBLE</strong>来实现</p><p>其中，最常见的与servicer交互的方法如下：</p><pre style="word-wrap: break-word; white-space: normal; "><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6169155#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span style="border-width: initial; border-color: initial; ">QServiceManager&nbsp;manager;QObject&nbsp;*storage&nbsp;;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">storage&nbsp;=&nbsp;manager.loadInterface(<span class="string" style="border-width: initial; border-color: initial; ">"com.nokia.qt.examples.FileStorage"</span><span style="border-width: initial; border-color: initial; ">);&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">if</span><span style="border-width: initial; border-color: initial; ">&nbsp;(storage)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QMetaObject::invokeMethod(storage,&nbsp;</span><span class="string" style="border-width: initial; border-color: initial; ">"deleteFile"</span><span style="border-width: initial; border-color: initial; ">,&nbsp;Q_ARG(QString,&nbsp;</span><span class="string" style="border-width: initial; border-color: initial; ">"/tmp/readme.txt"</span><span style="border-width: initial; border-color: initial; ">));&nbsp;&nbsp;</span></span></li></ol></div></pre><pre style="word-wrap: break-word; white-space: normal; ">上面的代码通过service的元对象提供的invokeMethod方法，调用文件存储对象的deleteFile() 方法。客户端不需要知道对象的类型，因此也没有链接到具体的service库。&nbsp; 当然在服务端的deleteFile方法，一定要被标记为<strong>Q_INVOKEBLE，</strong>才能够被元对象系统识别</pre><p>Qt服务框架的一个亮点是它支持<strong>跨进程通信</strong>，服务可以接受远程进程。在服务管理器上注册后 进程通过signal，slot，<strong>invokable method</strong>和property来通信，就像本地对象一样。服务可以设定为在客户端间共享，或针对一个客户端。&nbsp;&nbsp;<strong>请注意</strong>，在Qt服务框架推出之前，信号、槽以及invokable method仅支持跨线程。 下图是跨进成的服务/客户段通信示意图（图片来自诺基亚论坛）。这里我们可以清楚的看到，<strong>invokable method</strong>和<strong>Q_INVOKEBLE</strong>&nbsp;是跨进城、跨线程对象之间通信的重要利器。</p><p>&nbsp;</p><p><a href="http://hi.csdn.net/attachment/201101/29/0_12963045652nN8.gif" style="color: #336699; text-decoration: none; "><img title="serivceFramework" src="http://hi.csdn.net/attachment/201101/29/0_12963045714Y05.gif" border="0" alt="serivceFramework" width="611" height="354" style="border-top-style: initial; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-width: initial; border-color: initial; border-right-width: 0px; border-right-color: initial; border-top-width: 0px; border-top-color: initial; display: inline; border-left-width: 0px; border-left-color: initial; border-bottom-width: 0px; border-bottom-color: initial; " /></a></p><p>有关Qt Service Framework的更多讨论和用例，请参见<a href="http://wiki.forum.nokia.com/index.php/Qt_Service_Framework_%E6%96%87%E6%A1%A3" style="color: #336699; text-decoration: none; ">Qt Service Framework文档</a></p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152496.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:19 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152496.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt版权介绍：GPL, LGPL 以及 Commercial 授权</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152495.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:18:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152495.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152495.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152495.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152495.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152495.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><div class="tit">Qt GPL, LGPL &amp; Commercial License</div><div class="tit"></div><table border="0"><tbody><tr><td><div id="blog_text" class="cnt"><p>From:</p><p>http://www.qteverywhere.com/</p><p>&nbsp;</p><p>Qt 4.5中提供了三种授权协议，分别是GPL, LGPL和Commercial，可能很多人要问，为什么同样的一个产品要提供三种授权协议，什么情况下使用什么的样的授权协议最合适？在这里我就大致解释一下：</p><p>&nbsp;</p><p>GPL全称是The GNU General Public License，是目前大多数的GNU程序和超过半数的自由软件使用的许可协议。GPL的出发点是代码的开源/免费使用和引用/修改/衍生代码的开源/免 费使用，但不允许修改后和衍生的代码做为闭源的商业软件发布和销售。<br />GPL协议的主要内容是只要在一个软件中使用(&#8221;使用&#8221;指类库引用，修改后的代码或者衍生代码)GPL 协议的产品，则该软件产品必须也采用GPL协议，既必须也是开源和免费。这就是所谓的&#8221;传染性&#8221;。GPL协议的产品作为一个单独的产品使用没有任何问题， 还可以享受免费的优势。</p><p>&nbsp;</p><p>回到LGPL，LGPL的全称是 GNU Lesser General Public License，GNU 较宽松公共许可证，也是由协议是由自由软体基金会发布的许可证，是一个主要为类库使用设计的开源协议，和GPL要求任何使用/修改/衍生之GPL类库的的 软件必须采用GPL协议不同。LGPL允许商业软件通过类库引用(link)方式使用LGPL类库而不需要开源商业软件的代码。这使得采用LGPL协议的 开源代码可以被商业软件作为类库引用并发布和销售。</p><p>&nbsp;</p><p>除了GPL和LGPL两种开源协议之外，Qt还提供了Commercial商业协议，Qt的商业协议是由Nokia定义的，由Nokia和购买方签 订的，具有法律效应的Qt产品授权协议。 Commercial License相教与GPL和LGPL，对于商业客户提供了更多的灵活性，客户可以任意的修改Qt的源代码，开发商业软件，而不需要公开任何源代码。并 且，在Commercial License中，我们还提供了技术支持服务。当然，商业授权协议是需要费用的。</p><p>到底什么时候需要选择GPL和LGPL呢？一个最显而易见的理由就是他们都是免费的，使用LGPL和GPL版本的Qt是不需要支付任何费用的，当然 我们也相应的不会提供技术支持。如果你打算开发真正的开源软件，并希望使用者也可以保持开源，那么GPL是更好的选择，因为所有人，不论你自己还是将来基 于你的代码进行再次开发都必须开源。如果你打算开发闭源（不开放源代码）的商业软件，那么LGPL则更适合，但必须满足下面两个条件：<br />1. 你的应用程序应该动态链接Qt函数库，并使你的应用程序与未做修改的LGPL库分开发布。同时必须确保使用者（接受者）知道应用程序使用了LGPL版本的Qt；<br />2. 如果你对LGPL版本的Qt进行了任何修改，并发布，则必须遵循LGPL 条款发布。任何使用者有权利得到这些修改（通常情况下是源代码），并且确保使用者可以通过这些修改自己生成相应你修改过的Qt版本。</p><p>相信到这里大家已经对Qt提供的这三种协议有了基本的了解，通常大家还会有一个疑问，就是基于这三种授权协议的Qt产品到底由多少功能上的区别，是 不是商业版本的会更完整，性能更好一些？这里我可以负责任的说：99%的代码都是一样的，无论是GPL, LGPL还是Commercial，功能，性能都没有区别，唯一的区别就在于授权协议的不同。</p><p>还有一点需要说明的就是，由于LGPL是在Qt4.5这个版本里面才引入的，所以之前的Qt版本，4.4或者3.x的版本，并不提供LGPL协议，是不可逆的。同时未来发布的Qt版本，就一直会提供三种不同的授权协议版本。</p><p>&nbsp;</p><p>下面有一些链接，有兴趣想深入了解这些授权协议的同学，可以学习学习</p><p>GPL协议原文 －&nbsp;<a href="http://www.gnu.org/copyleft/gpl.html" target="_blank" style="color: #336699; text-decoration: none; ">http://www.gnu.org/copyleft/gpl.html</a><br />GPL协议中文译文 －&nbsp;<a href="http://bergwolf.googlepages.com/gplv3_zh" target="_blank" style="color: #336699; text-decoration: none; ">http://bergwolf.googlepages.com/gplv3_zh</a><br />LGPL协议原文 -&nbsp;<a href="http://www.gnu.org/copyleft/lesser.html" target="_blank" style="color: #336699; text-decoration: none; ">http://www.gnu.org/copyleft/lesser.html</a><br />LGPL协议中文译文 －&nbsp;<a href="http://www.thebigfly.com/gnu/lgpl/lgpl-v3.php" target="_blank" style="color: #336699; text-decoration: none; ">http://www.thebigfly.com/gnu/lgpl/lgpl-v3.php</a><br />58种不同的开源协议 －&nbsp;<a href="http://www.fsf.org/licensing/licenses/" target="_blank" style="color: #336699; text-decoration: none; ">http://www.fsf.org/licensing/licenses/</a><br />什么是动态链接 －&nbsp;<a href="http://zh.wikipedia.org/wiki/%E5%8A%A8%E6%80%81%E9%93%BE%E6%8E%A5%E5%BA%93" target="_blank" style="color: #336699; text-decoration: none; ">http://zh.wikipedia.org/wiki/%E5%8A%A8%E6%80%81%E9%93%BE%E6%8E%A5%E5%BA%93</a><br />官方声明 －&nbsp;<a href="http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt" target="_blank" style="color: #336699; text-decoration: none; ">http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt</a><br />官方Q&amp;A －&nbsp;<a href="http://www.qtsoftware.com/about/licensing/frequently-asked-questions" target="_blank" style="color: #336699; text-decoration: none; ">http://www.qtsoftware.com/about/licensing/frequently-asked-questions</a></p></div></td></tr></tbody></table></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:18 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt/Qt Quick宏浅议</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/05/152494.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 23:16:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/05/152494.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152494.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/05/152494.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152494.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152494.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p><span style="font-size: medium; ">请尊重原创作品和译文。转载请保持文章完整性，并以超链接形式注明原始作者</span><span style="font-size: medium; ">地址<a href="http://blog.csdn.net/changsheng230" style="color: #336699; text-decoration: none; ">http://blog.csdn.net/changsheng230</a>，方便其他朋友提问和指正。</span></p><p>&nbsp;</p><p>刚开始接触Qt的朋友可能对Qt在使用当中需要声明的各色各样的宏感到神秘而又陌生，本文将介绍Qt中经常使用的几个宏： Q_OBJECT, SIGNAL与SLOT, Q_SIGNALS 与 Q_SLOTS, Q_EMIT ,Q_INVOKABLE, Q_PROPERTY：</p><p>&nbsp;</p><p>宏的头文件出处： $QTDIR/src/corelib/kernel/qobjectdefs.h</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>Q_OBJECT</strong></h4><p>#define Q_OBJECT /&nbsp;<br />public: /&nbsp;<br />&nbsp;&nbsp;&nbsp; Q_OBJECT_CHECK /&nbsp;<br />&nbsp;&nbsp;&nbsp; static const QMetaObject staticMetaObject; /&nbsp;<br />&nbsp;&nbsp;&nbsp; Q_OBJECT_GETSTATICMETAOBJECT /&nbsp;<br />&nbsp;&nbsp;&nbsp; virtual const QMetaObject *metaObject() const; /&nbsp;<br />&nbsp;&nbsp;&nbsp; virtual void *qt_metacast(const char *); /&nbsp;<br />&nbsp;&nbsp;&nbsp; QT_TR_FUNCTIONS /&nbsp;<br />&nbsp;&nbsp;&nbsp; virtual int qt_metacall(QMetaObject::Call, int, void **); /</p><p>宏Q_OBJECT是Qt所有宏中最为重要的一个，Q_OBJECT是使用信号槽机制以及其他所有元对象系统提供的服务（内省、invokeMethod，元对象property系统等等）的前提条件。有关Q_OBJECT的讨论请参考<a href="http://blog.csdn.net/changsheng230/archive/2010/12/01/6046846.aspx" style="color: #336699; text-decoration: none; ">Qt源码分析之QObject</a>。&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>SIGNAL与SLOT</strong></h4><p>这两个宏是调用connect方法时用到:</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6168795#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span style="border-width: initial; border-color: initial; ">QObject::connect(myButton,&nbsp;SIGNAL(clicked()),&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label,&nbsp;&nbsp;SLOT(showText()));&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>那么宏SIGNAL和SLOT为我们做了那些事情呢，看一下源代码：</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6168795#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span style="border-width: initial; border-color: initial; ">$QTDIR/src/corelib/kernel/qobjectdefs.h&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#&nbsp;define&nbsp;SLOT(a)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qFlagLocation("1"#a&nbsp;QLOCATION)&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#&nbsp;define&nbsp;SIGNAL(a)&nbsp;&nbsp;&nbsp;qFlagLocation("2"#a&nbsp;QLOCATION)</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">$QTDIR/src/corelib/kernel/qobject.cpp&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="datatypes" style="border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; ">char</span><span style="border-width: initial; border-color: initial; ">&nbsp;*qFlagLocation(</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="datatypes" style="border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; ">char</span><span style="border-width: initial; border-color: initial; ">&nbsp;*method)&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">{&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">static</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="datatypes" style="border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; ">int</span><span style="border-width: initial; border-color: initial; ">&nbsp;idx&nbsp;=&nbsp;0;&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;flagged_locations[idx]&nbsp;=&nbsp;method;&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;idx&nbsp;=&nbsp;(idx+1)&nbsp;%&nbsp;flagged_locations_count;&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">return</span><span style="border-width: initial; border-color: initial; ">&nbsp;method;&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">}&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>原来它会基于把我们定义的信号、槽的名称返回一个字符串，比如SIGNAL(clicked()) 返回字符串 &#8220;2clicked()&#8221;, SLOT(showText())返回字符串&#8220;1showText()&#8221;</p><p><strong></strong></p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><strong><a href="http://blog.csdn.net/changsheng230/article/details/6168795#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></strong></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><strong><span style="border-width: initial; border-color: initial; "><span style="border-width: initial; border-color: initial; ">Q_SIGNALS&nbsp;与&nbsp;Q_SLOTS&nbsp;&nbsp;</span></span></strong></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><strong><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#&nbsp;&nbsp;define&nbsp;slots&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></strong></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><strong><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#&nbsp;&nbsp;define&nbsp;signals&nbsp;protected&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></strong></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><strong><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#&nbsp;define&nbsp;Q_SLOTS&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></strong></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><strong><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#&nbsp;define&nbsp;Q_SIGNALS&nbsp;protected</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></strong></li></ol></div><strong>&nbsp;</strong><p>&nbsp;</p><p>Q_SIGNALS 与 Q_SLOTS是Qt 4.1引入的，它们用来替换关键字signals和slots，原因是更好的与第三方信号槽机制兼容，比如boost库。尽管Q_SIGNALS 与 Q_SLOTS看起来没有做什么。其实不然，QT的元对象编译器moc会识别声明在头文件中的宏Q_SIGNALS，Q_SLOTS。并做为依据，生成元对象模型数据，详见文中最后所示代码实例</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>Q_EMIT</strong></h4><pre style="word-wrap: break-word; white-space: normal; "><span style="font-family: monospace; font-size: x-small; "><span>#define Q_EMIT #define emit</span></span></pre><p><span style="white-space: normal; ">Q_EMIT用来替换关键字emit,原因也是更好的与第三方信号槽机制兼容，比如boost库。</span></p><p>这里要注意，我们看到Q_EMIT看起来同样的简单， 但它们是有区别的！表面的区别在于Q_SIGNALS 与 Q_SLOTS用在头文件中，而Q_EMIT用在代码视线中。 本质的区别的在于，Q_SIGNALS 与 Q_SLOTS将被moc识别，是必须使用的。而Q_EMIT或者emit是可有可无的。它不会被moc识别，它存在的唯一理由是：<strong>增加代码的可读性。</strong>&nbsp; 也就是说如下代码都能正常工作，但2）的写法也许会惹怒你的同事。</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6168795#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;method()&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">{&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1）&nbsp;emit&nbsp;signalA();&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2）&nbsp;signalA();&nbsp;&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">}&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>Q_INVOKABLE</strong></h4><p>#define Q_INVOKABLE</p><p>&nbsp;</p><p>使用Q_INVOKABLE来修饰成员函数，目的在于被修饰的成员函数能够被元对象系统所唤起。这一机制在<strong>Qt C++/QML混合编程，Qt service framework,&nbsp;</strong>以及<strong>Qt/ HTML5混合编</strong><strong>程</strong>里广泛使用。我会随后<strong><a href="http://blog.csdn.net/changsheng230/archive/2011/01/29/6169155.aspx" style="color: #336699; text-decoration: none; ">另撰写一文</a></strong>做深入探讨。</p><p>&nbsp;</p><p>&nbsp;</p><h4 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>Q_PROPERTY</strong></h4><p>&nbsp;</p><p><span>#define Q_PROPERTY(text) &nbsp;&nbsp;</span></p><p>&nbsp;</p><p><span>使用</span>Q_PROPERTY用以声明<strong>属性</strong>，属性类似于成员变量，但它能够被元对象系统所访问。QML的属性便是利用该机制得以实现的。&nbsp;Q_PROPERTY的用法如下：</p><p>&nbsp;</p><pre class=" cpp" name="code" style="word-wrap: break-word; white-space: normal; ">Q_PROPERTY(QString title READ title WRITE setTitle USER true)</pre><p>&nbsp;</p><p><span style="font-family: monospace; font-size: x-small; "><span style="white-space: pre-wrap; "><br /></span></span></p><p>&nbsp;</p><p>接下来，让我们结合代码来看一下上述宏的使用以及元对象编译器是如何利用这些宏的。</p><p>&nbsp;</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6168795#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="preprocessor" style="border-width: initial; border-color: initial; ">#include&nbsp;&lt;QDeclarativeItem&nbsp;&gt;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">class</span><span style="border-width: initial; border-color: initial; ">&nbsp;EllipseItem&nbsp;:&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">public</span><span style="border-width: initial; border-color: initial; ">&nbsp;QDeclarativeItem&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">{&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Q_OBJECT&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Q_PROPERTY(QColor&nbsp;color&nbsp;READ&nbsp;color&nbsp;WRITE&nbsp;setColor&nbsp;NOTIFY&nbsp;colorChanged)&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">public</span><span style="border-width: initial; border-color: initial; ">:&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;EllipseItem(QDeclarativeItem&nbsp;*parent&nbsp;=&nbsp;0);&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;paint(QPainter&nbsp;*painter,&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;QStyleOptionGraphicsItem&nbsp;*option,&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QWidget&nbsp;*widget&nbsp;=&nbsp;0);&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;QColor&nbsp;&amp;color()&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">;&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;setColor(</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;QColor&nbsp;&amp;newColor);&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;Q_INVOKABLE&nbsp;QColor&nbsp;randomColor()&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">public</span><span style="border-width: initial; border-color: initial; ">&nbsp;Q_SLOTS:&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;try1();&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;try2()&nbsp;{}&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">Q_SIGNALS:&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;colorChanged();&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword" style="border-width: initial; border-color: initial; ">void</span><span style="border-width: initial; border-color: initial; ">&nbsp;ready();&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">private</span><span style="border-width: initial; border-color: initial; ">:&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;QColor&nbsp;m_color;&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">};&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>&nbsp;</p><p>以下代码由元对象编译器moc根据上述头文件自动生成：</p><p>&nbsp;</p><p>&nbsp;</p><div class="dp-highlighter bg_cpp" style="width: 687px; "><div class="bar"><div class="tools"><a href="http://blog.csdn.net/changsheng230/article/details/6168795#" class="ViewSource" title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); border-width: initial; border-color: initial; padding-top: 1px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat; ">view plain</a></div></div><ol start="1" class="dp-cpp" style="border-width: initial; border-color: initial; "><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">static</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;uint&nbsp;qt_meta_data_EllipseItem[]&nbsp;=&nbsp;{&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;content:&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;revision&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;classname&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;classinfo&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5,&nbsp;&nbsp;&nbsp;14,&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;methods&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1,&nbsp;&nbsp;&nbsp;39,&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;properties&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;enums/sets&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;constructors&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;flags&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;signalCount</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;signals:&nbsp;signature,&nbsp;parameters,&nbsp;type,&nbsp;tag,&nbsp;flags&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;0x05,&nbsp;&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;28,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;0x05,&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;slots:&nbsp;signature,&nbsp;parameters,&nbsp;type,&nbsp;tag,&nbsp;flags&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;36,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;0x0a,&nbsp;&nbsp;&nbsp;</span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;43,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;12,&nbsp;0x0a,&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;methods:&nbsp;signature,&nbsp;parameters,&nbsp;type,&nbsp;tag,&nbsp;flags&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;57,&nbsp;&nbsp;&nbsp;12,&nbsp;&nbsp;&nbsp;50,&nbsp;&nbsp;&nbsp;12,&nbsp;0x02,&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;properties:&nbsp;name,&nbsp;type,&nbsp;flags&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;71,&nbsp;&nbsp;&nbsp;50,&nbsp;0x43495103,&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;properties:&nbsp;notify_signal_id&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment" style="border-width: initial; border-color: initial; ">//&nbsp;eod&nbsp;</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">};&nbsp;&nbsp;</span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; "><span class="keyword" style="border-width: initial; border-color: initial; ">static</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="keyword" style="border-width: initial; border-color: initial; ">const</span><span style="border-width: initial; border-color: initial; ">&nbsp;</span><span class="datatypes" style="border-width: initial; border-color: initial; color: #2e8b57; font-weight: bold; ">char</span><span style="border-width: initial; border-color: initial; ">&nbsp;qt_meta_stringdata_EllipseItem[]&nbsp;=&nbsp;{&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="string" style="border-width: initial; border-color: initial; ">"EllipseItem/0/0colorChanged()/0ready()/0"</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="string" style="border-width: initial; border-color: initial; ">"try1()/0try2()/0QColor/0randomColor()/0"</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;</span></span></li><li class="alt" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;&nbsp;<span class="string" style="border-width: initial; border-color: initial; ">"color/0"</span><span style="border-width: initial; border-color: initial; ">&nbsp;&nbsp;&nbsp;</span></span></li><li class="" style="border-width: initial; border-color: initial; line-height: 18px; "><span style="border-width: initial; border-color: initial; ">};&nbsp;&nbsp;</span></li></ol></div>&nbsp;<p>&nbsp;</p><p>&nbsp;</p><p>从上面代码实例我们可以看到， QT的元对象编译器moc会识别声明在头文件中的宏Q_SIGNALS，Q_SLOTS, Q_PROPERTY, Q_PROPERTY。并以此做为依据，生成了元对象数据表。在这张元对象数据表中，我们已可以看到，moc根据头文件所声明的宏定义，识别出:</p><ul><li>两个信号：colorChanged(), ready(); &nbsp; &nbsp; &nbsp;(Q_SIGNALS）</li><li>两个槽: &nbsp; &nbsp;try1(), try2() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(Q_SLOTS)</li><li>五个方法，其中被标记为<strong>Q_INVOKABLE</strong>的方法randomColor()被记录在元对象字符串数组qt_meta_stringdata_EllipseItem中。 &nbsp;</li><li>一个属性：color &nbsp; (Q_PROPERTY)</li></ul></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152494.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-05 07:16 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/05/152494.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解析Qt内省机制</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/04/152475.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 14:33:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/04/152475.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152475.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/04/152475.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152475.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152475.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="font-family: 宋体; font-size: 12px; line-height: normal; background-color: #ffffff; "><table cellspacing="0" cellpadding="10" align="left" border="0"><tbody><tr><td style="font-family: 宋体; font-size: 9pt; line-height: 18px; "></td></tr></tbody></table><p>本文介绍的是<strong>Qt 内省</strong>机制，关于<strong>内省</strong>，新手的原因，我们一块学习，所谓<strong>内省</strong>是指面向对象语言的一种在运行期间查询对象信息的能力， 比如如果该语具有运行期间检查对象型别的能力，那么我们称它是型别<strong>内省</strong>（type intropection）的，型别<strong>内省</strong>可以用来实施多态。</p><p><a href="http://developer.51cto.com/col/1523/" style="text-decoration: none; color: #000000; "><u><font color="#004276">c++</font></u></a>的<strong>内省</strong>比较有限，它仅支持上面所说的型别<strong>内省</strong>，&nbsp;<a href="http://developer.51cto.com/col/1523/" style="text-decoration: none; color: #000000; "><u><font color="#004276">C++</font></u></a>的型别<strong>内省</strong>是通过运行时类型识别（RTTI）(Run-Time Type Information)中的typeid 以及 dynamic_case关键字来实现的，举例说明：</p><pre><ol class="dp-xml"><li class="alt"><span><span>    // rabbit 派生于 Animal, jump为虚函数  </span></span></li><li><span> </span></li><li class="alt"><span>if ( rabbit *</span><span class="attribute"><font color="#ff0000">p</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">dynamic_case</font></span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">Animal</span></font></strong><span>*</span><span class="tag"><strong><font color="#006699">&gt;</font></strong></span><span>(obj))     </span></li><li><span>{     </span></li><li class="alt"><span>   p-</span><span class="tag"><strong><font color="#006699">&gt;</font></strong></span><span>jump();     </span></li><li><span>}     </span></li><li class="alt"><span>//我们还可以通过typeid萃取到对象的型别信息，比如对象的名称   </span></li><li><span>std::cout </span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag">&lt;</span></font></strong><span> </span><span class="tag-name"><strong><font color="#006699">typeid</font></strong></span><span>(obj).name() </span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag">&lt;</span></font></strong><span> </span><span class="tag-name"><strong><font color="#006699">std::endl</font></strong></span><span>   </span></li></ol></pre><p><strong>Qt</strong>拓展了C++的内省机制，（实际上，它并没有采用c++的RTTI),而是提供了更为强大的元对象(meta object)机制，来实现内省。接下来，就让我们看看，Qt是如何扩展c++内省机制的。</p><p>要深刻理解Qt的内省机制，首先理解QObject，QObject类是整个Qt对象模型的心脏，Qt对象模型最为核心的功能是提供一种无缝的对象通讯机制，即就是我们所熟知的信号和槽。QObject主要有三大职责： 内存管理、内省(intropection)与事件处理。本文将集中在在内省的讨论。以下代码介绍了QObject类提供的内省方法:</p><pre><ol class="dp-xml"><li class="alt"><span><span>//每个对象可以通过QObject::setObjectName()和QObject::objectName()设置、取得类的实例的名字   </span></span></li><li><span>FirstQtApp obj;    </span></li><li class="alt"><span>obj.setObjectName("instanceName");    </span></li><li><span>QString </span><span class="attribute"><font color="#ff0000">name1</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">obj</font></span><span>.objectName();   // return instanceName   </span></li><li class="alt"><span>//每个对象还可以通过它的元对象className方法得到类的名字   </span></li><li><span>QString </span><span class="attribute"><font color="#ff0000">name2</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">obj</font></span><span>.metaObject()-</span><span class="tag"><strong><font color="#006699">&gt;</font></strong></span><span>className();  // return FirtstQtApp   </span></li><li class="alt"><span>//每个对象可以通过QObject::inherits方法来查询是否对前对象类派生于量一个类   </span></li><li><span>bool </span><span class="attribute"><font color="#ff0000">isherited</font></span><span> =  </span><span class="attribute-value"><font color="#0000ff">obj</font></span><span>.inherits("QObject");         // returns true   </span></li><li class="alt"><span class="attribute"><font color="#ff0000">isherited</font></span><span> =  </span><span class="attribute-value"><font color="#0000ff">obj</font></span><span>.inherits("QWideget");         // returns true  </span></li></ol></pre><p>让我们再来一下QObject::inherits方法的底层实现：</p><pre><ol class="dp-xml"><li class="alt"><span><span>inline bool inherits(const char *classname) const   </span></span></li><li><span>    { return const_cast</span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">QObject</span></font></strong><span> *</span><span class="tag"><strong><font color="#006699">&gt;</font></strong></span><span>(this)-</span><span class="tag"><strong><font color="#006699">&gt;</font></strong></span><span>qt_metacast(classname) != 0; }  </span></li></ol></pre><p>原来，QObject::inherits是通过qt_metacast()这个虚函数实现的， 事实上每个QObject的派生类都必须实现metaObject()以及其他qt_metacall()方法，从而满足自省方法className, inherits等方法的调用（当然还有其他用途）。</p><p>而所有有关派生从QObject的子类中的内省方法无须有用户实现，用户只要在类中声明宏Q_OBJECT即可，Qt的元对象编译器（moc)负责实现派生从QObject的子类中的内省方法。</p><pre><ol class="dp-xml"><li class="alt"><span><span>// defined at ..\Qt\src\corelib\kernel\qobjectdefs.h   </span></span></li><li><span>/* tmake ignore Q_OBJECT */   </span></li><li class="alt"><span>#define Q_OBJECT \   </span></li><li><span>public: \     </span></li><li class="alt"><span>    Q_OBJECT_CHECK \     </span></li><li><span>static const QMetaObject staticMetaObject; \     </span></li><li class="alt"><span>    Q_OBJECT_GETSTATICMETAOBJECT \     </span></li><li><span>virtual const QMetaObject *metaObject() const; \     </span></li><li class="alt"><span>virtual void *qt_metacast(const char *); \     </span></li><li><span>    QT_TR_FUNCTIONS \     </span></li><li class="alt"><span>virtual int qt_metacall(QMetaObject::Call, int, void **); \  </span></li></ol></pre><p>此外，所有的Qt widgets类均继承自QObject, QObject所提供的isWidgetType自省方法可以很方便让QObject子对象查询自己是否是wideget, 而且它会比 qobject_cast&lt;QWidget *&gt;(obj) 或者 obj-&gt;inherits快很多。原因qobject_cast()t和inherits()都是借助元对象系统来实现其功能的，isWidgetType()是QObject本身的标志位得以实现。</p><p>更多自省方法定义在QMetaObject，以下是QMetaObject声明的源代码：</p><pre><ol class="dp-xml"><li class="alt"><span><span>struct Q_CORE_EXPORT QMetaObject     </span></span></li><li><span>{     </span></li><li class="alt"><span>const char *className() const;     </span></li><li><span>const QMetaObject *superClass() const;     </span></li><li class="alt"><span>    QObject *cast(QObject *obj) const;     </span></li><li><span> </span></li><li class="alt"><span>    ....     </span></li><li><span>int methodOffset() const;     </span></li><li class="alt"><span>int enumeratorOffset() const;     </span></li><li><span>int propertyOffset() const;     </span></li><li class="alt"><span>int classInfoOffset() const;     </span></li><li><span>int constructorCount() const;     </span></li><li class="alt"><span>int methodCount() const;     </span></li><li><span>int enumeratorCount() const;     </span></li><li class="alt"><span>int propertyCount() const;     </span></li><li><span>int classInfoCount() const;     </span></li><li class="alt"><span>int indexOfConstructor(const char *constructor) const;     </span></li><li><span>int indexOfMethod(const char *method) const;     </span></li><li class="alt"><span>int indexOfSignal(const char *signal) const;     </span></li><li><span>int indexOfSlot(const char *slot) const;     </span></li><li class="alt"><span>int indexOfEnumerator(const char *name) const;     </span></li><li><span>int indexOfProperty(const char *name) const;     </span></li><li class="alt"><span>int indexOfClassInfo(const char *name) const;     </span></li><li><span>    ...     </span></li><li class="alt"><span>}   </span></li></ol></pre><p>上述方法主要是实现对元对象表的访问及其操作，对元对象表(由moc实现）实例如下所示：</p><pre><ol class="dp-xml"><li class="alt"><span><span>// defined at ..\Qt\src\corelib\kernel\qobjectdefs.h   </span></span></li><li><span>/* tmake ignore Q_OBJECT */   </span></li><li class="alt"><span>#define Q_OBJECT \   </span></li><li><span>public: \    </span></li><li class="alt"><span>    Q_OBJECT_CHECK \    </span></li><li><span>static const QMetaObject staticMetaObject; \    </span></li><li class="alt"><span>    Q_OBJECT_GETSTATICMETAOBJECT \    </span></li><li><span>virtual const QMetaObject *metaObject() const; \    </span></li><li class="alt"><span>virtual void *qt_metacast(const char *); \    </span></li><li><span>    QT_TR_FUNCTIONS \    </span></li><li class="alt"><span>virtual int qt_metacall(QMetaObject::Call, int, void **); \   </span></li></ol></pre><p>总结：</p><p>1、Qt是通过QObject、QMetaObject类实现其内省机制,</p><p>2、QObject暴露给用户的共有自省方法有objectName(), inherits()， isWidgetType()等</p><p>3、大多数自省方法是QObject派发给QMetaObject实现 (e.g. QMetaObject::className,)，元对象模型编译器moc负责自省方法的实现</p><p>4、更多自省方法定义在QMetaObject，而是为了等信号槽通讯、事件派发等机制，</p><p>小结：关于解析&nbsp;<strong>Qt 内省</strong>机制剖析的内容介绍完了，希望本文对你有所帮助！</p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152475.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-04 22:33 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/04/152475.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于QML中调用qt类中的信号，槽，成员函数,属性做记录</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/04/152464.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 13:19:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/04/152464.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152464.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/04/152464.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152464.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152464.html</trackback:ping><description><![CDATA[<span style="color: #984e13; font-family: Arial, Helvetica, simsun, u5b8bu4f53; font-size: 14px; line-height: 22px; background-color: #f5f8ee; ">废话不多说直接上代码<br style="line-height: 22px; " />(<span style="line-height: 22px; font-size: 10.5pt; font-family: 'Times New Roman'; ">(xp</span><span style="line-height: 22px; font-size: 10.5pt; font-family: 宋体; ">下</span><span style="line-height: 22px; font-size: 10.5pt; font-family: 'Times New Roman'; ">qt4.7 sdk)</span>&nbsp;出现情况是，当一个类<span style="line-height: 22px; font-size: 10.5pt; font-family: 宋体; ">在直接写在一个.h文件上后，在QML中调用会挂掉，我这里出现是在我调用的到处函数是获取一个QString的时候，但是把类分别写成.h和.cpp后，没有出现此 情况</span><span style="line-height: 22px; font-size: 10.5pt; font-family: 宋体; ">，不知道具体的原因</span>）<br style="line-height: 22px; " /><span style="line-height: 22px; color: #008000; ">//</span>&nbsp;<span style="line-height: 22px; color: #008000; ">main.cpp</span><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">int</span> main<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">int</span> argc<span style="line-height: 22px; color: #000000; ">,</span> <span style="line-height: 22px; color: #808000; ">char</span> <span style="line-height: 22px; color: #000000; ">*</span>argv<span style="line-height: 22px; color: #000000; ">[])</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QApplication</span> app<span style="line-height: 22px; color: #000000; ">(</span>argc<span style="line-height: 22px; color: #000000; ">,</span> argv<span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QDeclarativeView</span> view<span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> view<span style="line-height: 22px; color: #000000; ">.</span>rootContext<span style="line-height: 22px; color: #000000; ">()-&gt;</span>setContextProperty<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #008000; ">"ls"</span><span style="line-height: 22px; color: #000000; ">,</span><span style="line-height: 22px; color: #808000; ">new</span> LS<span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> view<span style="line-height: 22px; color: #000000; ">.</span>setSource<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">QUrl</span><span style="line-height: 22px; color: #000000; ">::</span>fromLocalFile<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #008000; ">"../QMLAPP/QMLtest.qml"</span><span style="line-height: 22px; color: #000000; ">));</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> view<span style="line-height: 22px; color: #000000; ">.</span>show<span style="line-height: 22px; color: #000000; ">();</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">return</span> app<span style="line-height: 22px; color: #000000; ">.</span>exec<span style="line-height: 22px; color: #000000; ">();</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">}</span></pre>// LS.h<br style="line-height: 22px; " /><span style="line-height: 22px; color: #000080; ">#ifndef</span>&nbsp;LS_H<pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #000080; ">#define</span> LS_H</pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #000080; ">#include</span> <span style="line-height: 22px; color: #008000; ">&lt;QObject&gt;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #000080; ">#include</span> <span style="line-height: 22px; color: #008000; ">&lt;QColor&gt;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #808000; ">class</span> LS <span style="line-height: 22px; color: #000000; ">:</span> <span style="line-height: 22px; color: #808000; ">public</span> <span style="line-height: 22px; color: #800080; ">QObject</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">Q_OBJECT</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">Q_PROPERTY</span><span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">QColor</span> color READ getColor WRITE setColor NOTIFY colorChange<span style="line-height: 22px; color: #000000; ">)</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #808000; ">public</span><span style="line-height: 22px; color: #000000; ">:</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> LS<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">QObject</span> <span style="line-height: 22px; color: #000000; ">*</span>parent <span style="line-height: 22px; color: #000000; ">=</span> <span style="line-height: 22px; color: #000080; ">0</span><span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">~</span>LS<span style="line-height: 22px; color: #000000; ">();</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #008000; ">//</span> <span style="line-height: 22px; color: #008000; ">Q_INVOKABLE</span> <span style="line-height: 22px; color: #008000; ">用于导出函数，让qml能使用</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">Q_INVOKABLE</span> <span style="line-height: 22px; color: #800080; ">QString</span> getText<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">void</span><span style="line-height: 22px; color: #000000; ">)</span> <span style="line-height: 22px; color: #808000; ">const</span><span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #008000; ">//</span> <span style="line-height: 22px; color: #008000; ">用于属性</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QColor</span> getColor<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">void</span><span style="line-height: 22px; color: #000000; ">)</span> <span style="line-height: 22px; color: #808000; ">const</span><span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">void</span> setColor<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">const</span> <span style="line-height: 22px; color: #800080; ">QColor</span> <span style="line-height: 22px; color: #000000; ">&amp;</span>c<span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #808000; ">signals</span><span style="line-height: 22px; color: #000000; ">:</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">void</span> sendMsg<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">const</span> <span style="line-height: 22px; color: #800080; ">QString</span> <span style="line-height: 22px; color: #000000; ">&amp;</span>s<span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #008000; ">//</span> <span style="line-height: 22px; color: #008000; ">用于属性</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">void</span> colorChange<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">void</span><span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #808000; ">public</span> <span style="line-height: 22px; color: #808000; ">slots</span><span style="line-height: 22px; color: #000000; ">:</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">void</span> echoMsg<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">const</span> <span style="line-height: 22px; color: #800080; ">QString</span> <span style="line-height: 22px; color: #000000; ">&amp;</span>s<span style="line-height: 22px; color: #000000; ">);</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #808000; ">private</span><span style="line-height: 22px; color: #000000; ">:</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QString</span> m_str<span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QColor</span> m_Color<span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #000000; ">};</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #000080; ">#endif</span> <span style="line-height: 22px; color: #008000; ">//</span> <span style="line-height: 22px; color: #008000; ">LS_H</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><br style="line-height: 22px; " /></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><br style="line-height: 22px; " />//LS.cpp<br style="line-height: 22px; " /></pre><span style="line-height: 22px; color: #000080; ">#include</span>&nbsp;<span style="line-height: 22px; color: #008000; ">"LS.h"</span><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> LS<span style="line-height: 22px; color: #000000; ">::</span>LS<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">QObject</span> <span style="line-height: 22px; color: #000000; ">*</span>parent<span style="line-height: 22px; color: #000000; ">)</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">:</span><span style="line-height: 22px; color: #800080; ">QObject</span><span style="line-height: 22px; color: #000000; ">(</span>parent<span style="line-height: 22px; color: #000000; ">),</span>m_str<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #008000; ">"I</span> <span style="line-height: 22px; color: #008000; ">am</span> <span style="line-height: 22px; color: #008000; ">LS</span> <span style="line-height: 22px; color: #008000; ">class"</span><span style="line-height: 22px; color: #000000; ">),</span>m_Color<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">Qt</span><span style="line-height: 22px; color: #000000; ">::</span>blue<span style="line-height: 22px; color: #000000; ">)</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QObject</span><span style="line-height: 22px; color: #000000; ">::</span>connect<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">this</span><span style="line-height: 22px; color: #000000; ">,</span> <span style="line-height: 22px; color: #808000; ">SIGNAL</span><span style="line-height: 22px; color: #000000; ">(</span>sendMsg<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">QString</span><span style="line-height: 22px; color: #000000; ">)),</span> <span style="line-height: 22px; color: #808000; ">this</span><span style="line-height: 22px; color: #000000; ">,</span> <span style="line-height: 22px; color: #808000; ">SLOT</span><span style="line-height: 22px; color: #000000; ">(</span>echoMsg<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #800080; ">QString</span><span style="line-height: 22px; color: #000000; ">)));</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">}</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> LS<span style="line-height: 22px; color: #000000; ">::~</span>LS<span style="line-height: 22px; color: #000000; ">(){}</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QString</span> LS<span style="line-height: 22px; color: #000000; ">::</span>getText<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">void</span><span style="line-height: 22px; color: #000000; ">)</span> <span style="line-height: 22px; color: #808000; ">const</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">return</span> m_str<span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">}</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #008000; ">//</span> <span style="line-height: 22px; color: #008000; ">用于属性</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #800080; ">QColor</span> LS<span style="line-height: 22px; color: #000000; ">::</span>getColor<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">void</span><span style="line-height: 22px; color: #000000; ">)</span> <span style="line-height: 22px; color: #808000; ">const</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">return</span> m_Color<span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">}</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">void</span> LS<span style="line-height: 22px; color: #000000; ">::</span>setColor<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">const</span> <span style="line-height: 22px; color: #800080; ">QColor</span> <span style="line-height: 22px; color: #000000; ">&amp;</span>c<span style="line-height: 22px; color: #000000; ">)</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> m_Color <span style="line-height: 22px; color: #000000; ">=</span> c<span style="line-height: 22px; color: #000000; ">;</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">}</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #808000; ">void</span> LS<span style="line-height: 22px; color: #000000; ">::</span>echoMsg<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #808000; ">const</span> <span style="line-height: 22px; color: #800080; ">QString</span> <span style="line-height: 22px; color: #000000; ">&amp;</span>s<span style="line-height: 22px; color: #000000; ">)</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">{</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> qDebug<span style="line-height: 22px; color: #000000; ">(</span><span style="line-height: 22px; color: #008000; ">"</span> <span style="line-height: 22px; color: #008000; ">%s</span> <span style="line-height: 22px; color: #008000; ">"</span><span style="line-height: 22px; color: #000000; ">,</span> s<span style="line-height: 22px; color: #000000; ">.</span>toLocal8Bit<span style="line-height: 22px; color: #000000; ">().</span>data<span style="line-height: 22px; color: #000000; ">());</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "> <span style="line-height: 22px; color: #000000; ">}</span></pre><pre style="line-height: 22px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-indent: 0px; "><span style="line-height: 22px; color: #008000; ">//----------------------------------------------------------------------</span><br style="line-height: 22px; " /><span style="line-height: 22px; color: #008000; ">//</span> <span style="line-height: 22px; color: #008000; ">QMLtest.qml</span><br style="line-height: 22px; " /><span style="line-height: 22px; color: #800080; ">Rectangle</span>{<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">id</span>: mainrect<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">width</span>: 400; <span style="line-height: 22px; color: #800000; ">height</span>: 300;<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">color</span>: ls.color;<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800080; ">Text</span> {<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">id</span>: tls;<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">text</span>: <span style="line-height: 22px; color: #008000; ">"click</span> <span style="line-height: 22px; color: #008000; ">this"</span><br style="line-height: 22px; " /> }<br style="line-height: 22px; " /><br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800080; ">MouseArea</span>{<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">anchors.fill</span>: parent;<br style="line-height: 22px; " /> <span style="line-height: 22px; color: #800000; ">onClicked</span>: {<br style="line-height: 22px; " /> tls.text = ls.getText();<br style="line-height: 22px; " /> ls.sendMsg(<span style="line-height: 22px; color: #008000; ">"</span> <span style="line-height: 22px; color: #008000; ">ok</span> <span style="line-height: 22px; color: #008000; ">"</span>);<br style="line-height: 22px; " /> }<br style="line-height: 22px; " /> }<br style="line-height: 22px; " /><br style="line-height: 22px; " />}</pre></span><img src ="http://www.cppblog.com/lauer3912/aggbug/152464.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-04 21:19 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/04/152464.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>QML 基本内容介绍</title><link>http://www.cppblog.com/lauer3912/archive/2011/08/04/152460.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Thu, 04 Aug 2011 12:06:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/08/04/152460.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/152460.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/08/04/152460.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/152460.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/152460.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 1.&nbsp;介绍QML是一种描述语言，主要是对界面效果等的一种描述，它可以结合javaScript来进行更复杂的效果及逻辑实现。比如做个游戏，实现一些更有趣的功能等2.&nbsp;简单的例子import&nbsp;Qt&nbsp;4.7Rectangle&nbsp;{width:&nbsp;200height:&nbsp;200color:&nbsp;"blue"}代码是绘制一个蓝色的矩形，宽...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/08/04/152460.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/152460.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-08-04 20:06 <a href="http://www.cppblog.com/lauer3912/archive/2011/08/04/152460.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt全局宏和变量</title><link>http://www.cppblog.com/lauer3912/archive/2011/07/26/151837.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 25 Jul 2011 22:53:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/07/26/151837.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/151837.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/07/26/151837.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/151837.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/151837.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff; "><p>1.&nbsp; Qt 全局宏定义</p><p>Qt版本号:</p><p>&nbsp;QT_VERSION :　 (major &lt;&lt; 16) + (minor &lt;&lt; 8) + patch</p><p>检测版本号：</p><p>QT_VERSION_CHECK(major, minor, patch)((major&lt;&lt;16)|(minor&lt;&lt;8)|(patch))</p><p>当使用命名空间时的一些宏定义：</p><p>namespace QT_NAMESPACE {}　//命名空间定义</p><p># define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name</p><p># define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE;</p><p># define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE {</p><p># define QT_END_NAMESPACE }</p><p># define QT_BEGIN_INCLUDE_NAMESPACE }</p><p># define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE {</p><p># define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE</p><p># define QT_END_MOC_NAMESPACE</p><p># define QT_FORWARD_DECLARE_CLASS(name) /</p><p>&nbsp;&nbsp;&nbsp; QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE /</p><p>&nbsp;&nbsp;&nbsp; using QT_PREPEND_NAMESPACE(name);</p><p>&nbsp;</p><p># define QT_FORWARD_DECLARE_STRUCT(name) /</p><p>&nbsp;&nbsp;&nbsp; QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE /</p><p>&nbsp;&nbsp;&nbsp; using QT_PREPEND_NAMESPACE(name);</p><p>Q_GLOBAL_STATIC(type, name)用于定义一个全局的静态变量（线程安全的）．用它来初始化一个对象指针（函数指针）．</p><p>Q_GLOBAL_STATIC_WITH_ARGS(type, name, arguments)：同上，可带参数．</p><p>&nbsp;</p><p><strong>Q_UNUSED（）</strong>:通常用于某个函数的参数，表明该参数未在方法体中使用．</p><p>常用数据类型：</p><p>qint8, quint8, qint16, quint16, qint32, quint32, qint64, quint64, qlonglong(=int64), qulonglong(=uint64)</p><p>quintptr, qptrdiff, 作为指针是一样大的．如：</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizeof(void *) == sizeof(quintptr)</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; sizeof(void *) == sizeof(qptrdiff)</p><p>Qt有用的类型定义：uchar, ushort, uint, ulong</p><p>实用内联函数：qAbs(), qRound(), qRound64(), qMin(), qMax(), qBound();</p><p>try-catch宏：</p><p>#ifdef QT_NO_EXCEPTIONS</p><p>#&nbsp; define QT_TRY if (true)</p><p>#&nbsp; define QT_CATCH(A) else</p><p>#&nbsp; define QT_THROW(A) qt_noop()</p><p>#&nbsp; define QT_RETHROW qt_noop()</p><p>#else</p><p>#&nbsp; define QT_TRY try</p><p>#&nbsp; define QT_CATCH(A) catch (A)</p><p>#&nbsp; define QT_THROW(A) throw A</p><p>#&nbsp; define QT_RETHROW throw</p><p>#endif</p><p>每个QT_TRY对应一个ＱT_CATCH，不要在catch语句块中使用异常实例．</p><p>&nbsp;</p><p>调试相关函数：</p><p>qDebug(), qWarnig(), qCritical(), Q_ASSERT()</p><p>&nbsp;</p><p>其他一些函数：</p><p>该宏用于定义某个类，禁止拷贝</p><p>#define&nbsp;<strong>Q_DISABLE_COPY(Class)</strong>&nbsp;/</p><p>&nbsp;&nbsp;&nbsp; Class(const Class &amp;); /</p><p>&nbsp;&nbsp;&nbsp; Class &amp;operator=(const Class &amp;);</p><p>qgetenv(), qputenv(), qIntCast(double 或float). qsrand(uint seed), qrand()</p><p>2. Qt的内存管理函数</p><p>void *qMalloc(size_t size);</p><p>void qFree(void *ptr);</p><p>void *qRealloc(void *ptr, size_t size);</p><p>void *qMallocAligned(size_t size, size_t alignment)</p><p>void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment)</p><p>void qFreeAligned(void *ptr)</p><p>void *qMemCopy(void *dest, const void *src, size_t n);</p><p>void *qMemSet(void *dest, int c, size_t n);</p><p><strong>注:</strong>&nbsp;数组下标为-1的地址对于数组来说是越界访问了，但是这个地址是有意义的.这个地址就是所申请的数组存储空间的首地址的向前偏移一个单位(也就是偏移一个当前数组类型所对应的字节数)所对应的地址。这个地址由于没有跟着数组空间一起初始化，所以其中的数据是不确定的.如果是正在被系统或者其他应用程序使用中的地址空间，那么可以被访问，其中的数据的意义取决于被系统或者其他应用程序所写入的数据，但是访问后，有可能会引起系统或者其他应用程序异常。如果是没有被使用的地址，那么就是一个野地址，那么其中的数据是随机的，无意义的</p><p>&nbsp;</p><p>３.　环境变量设置函数</p><p>qputenv()：与putenv()基本类似，由于VC2005后废除了putenv()函数，所有定义了此函数，在VC环境中调用替代的函数，其他平台调用标准Ｃ库函数putenv()．</p><p>qgetenv():获取某个环境变量的值．</p><p>&nbsp;</p><p>４.自定义输出函数</p><p>QtMsgHandler qInstallMsgHandler(QtMsgHandler h)</p><p>其中：typedef void (*QtMsgHandler)(QtMsgType, const char *);</p><p>利用该函数可定制自己的调试信息输出．</p><p>&nbsp;</p><p>5. 断言</p><p>Q_ASSERT(bool test)：当断言失败时，打印出警告信息，包含了源码文件名和行号．</p><p>void Q_ASSERT_X(bool test, const char *where, const char *what)</p><p>&nbsp;</p><p>void Q_CHECK_PTR(void *pointer)：检测非法指针，如果指针为０，打印警告信息．</p><p>&nbsp;</p><p>６.系统信息类QsysInfo</p></span><img src ="http://www.cppblog.com/lauer3912/aggbug/151837.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-07-26 06:53 <a href="http://www.cppblog.com/lauer3912/archive/2011/07/26/151837.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt编写模块化插件式应用程序 （下篇）</title><link>http://www.cppblog.com/lauer3912/archive/2011/07/26/151836.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 25 Jul 2011 22:42:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/07/26/151836.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/151836.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/07/26/151836.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/151836.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/151836.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 比起源码级别的模块化，二进制级别的模块划分使得各模块更加独立，各模块可以分别编译和链接，模块的升级不会引起其它模块和主程序的重新编译，这点对于大系统的构建来说更加实用。AD：继续&nbsp;Qt编写模块化插件式应用程序 （上篇）&nbsp;的内容继续介绍，本节介绍的是Qt编写模块化插件式应用程序 （下篇），我们先来看内容。2. 编写Animal插件&#8212;&#8212;BilDog和BilP...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/07/26/151836.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/151836.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-07-26 06:42 <a href="http://www.cppblog.com/lauer3912/archive/2011/07/26/151836.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Qt编写模块化插件式应用程序 （上篇）</title><link>http://www.cppblog.com/lauer3912/archive/2011/07/26/151835.html</link><dc:creator>RTY</dc:creator><author>RTY</author><pubDate>Mon, 25 Jul 2011 22:40:00 GMT</pubDate><guid>http://www.cppblog.com/lauer3912/archive/2011/07/26/151835.html</guid><wfw:comment>http://www.cppblog.com/lauer3912/comments/151835.html</wfw:comment><comments>http://www.cppblog.com/lauer3912/archive/2011/07/26/151835.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lauer3912/comments/commentRss/151835.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lauer3912/services/trackbacks/151835.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 比起源码级别的模块化，二进制级别的模块划分使得各模块更加独立，各模块可以分别编译和链接，模块的升级不会引起其它模块和主程序的重新编译，这点对于大系统的构建来说更加实用。AD：动态链接库技术使软件工程师们兽血沸腾，它使得应用系统（程序）可以以二进制模块的形式灵活地组建起来。比起源码级别的模块化，二进制级别的模块划分使得各模块更加独立，各模块可以分别编译和链接，模块的升级不会引起其它模块和主程序的重新...&nbsp;&nbsp;<a href='http://www.cppblog.com/lauer3912/archive/2011/07/26/151835.html'>阅读全文</a><img src ="http://www.cppblog.com/lauer3912/aggbug/151835.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lauer3912/" target="_blank">RTY</a> 2011-07-26 06:40 <a href="http://www.cppblog.com/lauer3912/archive/2011/07/26/151835.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>