<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mousefire Walking On The Earth &#187; helloworld</title>
	<atom:link href="http://www.mousefire.net/tag/helloworld/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mousefire.net</link>
	<description>点点滴滴</description>
	<lastBuildDate>Wed, 01 Sep 2010 11:45:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Qt学习笔记_Chapter1_1HelloQt</title>
		<link>http://www.mousefire.net/2010/01/06/qt%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0_chapter1_helloqt/</link>
		<comments>http://www.mousefire.net/2010/01/06/qt%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0_chapter1_helloqt/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 14:02:27 +0000</pubDate>
		<dc:creator>mousefire</dc:creator>
				<category><![CDATA[Qt学习笔记]]></category>
		<category><![CDATA[helloworld]]></category>
		<category><![CDATA[Qt]]></category>

		<guid isPermaLink="false">http://www.mousefire.net/2010/01/06/qt%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0_chapter1_helloqt/</guid>
		<description><![CDATA[　　Windows7下程序运行效果图： &#160; 　　学习的每一步总是HelloWorld，Qt4.6直接推出了VS2008的Binary包，大大方便了我的学习，现在可以像写一般的MFC程序一样在VS集成环境中编写Qt程序了，Qt中的HelloWorld程序如下： #include &#60;QApplication&#62; #include &#60;QLabel&#62; int main(int argc,char *argv[]) {     QApplication app(argc,argv);     QLabel *label=new QLabel(&#34;&#60;h2&#62;&#60;i&#62;Hello&#60;/i&#62; &#34;         &#34;&#60;font color=red&#62;Qt!&#60;/font&#62;&#60;/h2&#62;&#34;);     label-&#62;show();     return app.exec(); } Line1,2：对于每个Qt类，都有一个与该类同名（且大写）的头文件，在这个头文件中包括了对该类的定义。 Line5：创建了一个Qapplication对象，用来管理整个应用程序所用到的资源。Qt支持它自己的一些命令行参数，所以这里同样有argc,argv作为参数。 Line6：创建了一个QLabel Widget，这里的Widget相当于VC中的控件，Qt十分灵活，任意窗口部件(Widget)都可以作为窗口，这里就使用了一个Qlabel作为窗口。另外可以看到，通过使用一些简单的HTML样式格式，可以轻松地把Qt应用程序的用户接口变得更为丰富多彩。 Line8：使QLabel可见，默认隐藏是为了便于我们先进行设置然后再显示它们，从而避免了窗口部件的闪烁现象。 Line9：将应用程序的控制权传递给Qt。此时，程序会进入事件循环状态，这是一种等待模式，程序会等候用户的动作，例如鼠标单击和按键等操作。 BTW：在这个程序中没有过多关注在main()函数末尾处对QLabel对象的delete操作调用。在如此短小的程序内，这样一点内存泄漏(memory leak)问题无关大局，因为在程序结束时，这部分内存是可以由操作系统重新回收的。]]></description>
			<content:encoded><![CDATA[<p>　　Windows7下程序运行效果图：</p>
<p><a href="http://www.mousefire.net/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://www.mousefire.net/wp-content/uploads/2010/01/image_thumb5.png" width="132" height="59"></a>&nbsp;</p>
<p>　　学习的每一步总是HelloWorld，Qt4.6直接推出了VS2008的Binary包，大大方便了我的学习，现在可以像写一般的MFC程序一样在VS集成环境中编写Qt程序了，Qt中的HelloWorld程序如下：</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:96baf6ce-172d-42a6-a322-89f577155c63" class="wlWriterEditableSmartContent">
<div class="le-pavsc-container">
<div style="background: #fff; overflow: auto">
<ol style="background: #c2db8a; margin: 0; padding: 0 0 0 5px; white-space: nowrap">
<li><span style="color:#0000ff">#include</span><span style="color:#004000"> </span><span style="color:#a31515">&lt;QApplication&gt;</span></li>
<li class="even"><span style="color:#0000ff">#include</span><span style="color:#004000"> </span><span style="color:#a31515">&lt;QLabel&gt;</span></li>
<li><span style="color:#0000ff">int</span><span style="color:#004000"> </span><span style="color:#010001">main</span><span style="color:#004000">(</span><span style="color:#0000ff">int</span><span style="color:#004000"> </span><span style="color:#010001">argc</span><span style="color:#004000">,</span><span style="color:#0000ff">char</span><span style="color:#004000"> *</span><span style="color:#010001">argv</span><span style="color:#004000">[])</span></li>
<li class="even"><span style="color:#004000">{</span></li>
<li>    <span style="color:#004000"></span><span style="color:#010001">QApplication</span><span style="color:#004000"> </span><span style="color:#010001">app</span><span style="color:#004000">(</span><span style="color:#010001">argc</span><span style="color:#004000">,</span><span style="color:#010001">argv</span><span style="color:#004000">);</span></li>
<li class="even">    <span style="color:#004000"></span><span style="color:#010001">QLabel</span><span style="color:#004000"> *</span><span style="color:#010001">label</span><span style="color:#004000">=</span><span style="color:#0000ff">new</span><span style="color:#004000"> </span><span style="color:#010001">QLabel</span><span style="color:#004000">(</span><span style="color:#a31515">&quot;&lt;h2&gt;&lt;i&gt;Hello&lt;/i&gt; &quot;</span></li>
<li>        <span style="color:#a31515"></span><span style="color:#a31515">&quot;&lt;font color=red&gt;Qt!&lt;/font&gt;&lt;/h2&gt;&quot;</span><span style="color:#004000">);</span></li>
<li class="even">    <span style="color:#004000"></span><span style="color:#010001">label</span><span style="color:#004000">-&gt;</span><span style="color:#010001">show</span><span style="color:#004000">();</span></li>
<li>    <span style="color:#004000"></span><span style="color:#0000ff">return</span><span style="color:#004000"> </span><span style="color:#010001">app</span><span style="color:#004000">.</span><span style="color:#010001">exec</span><span style="color:#004000">();</span></li>
<li class="even"><span style="color:#004000">}</span></li>
</ol></div>
</p></div>
</p></div>
<p><strong>Line1,2：</strong>对于每个Qt类，都有一个与该类同名（且大写）的头文件，在这个头文件中包括了对该类的定义。</p>
<p><strong>Line5：</strong>创建了一个Qapplication对象，用来管理整个应用程序所用到的资源。Qt支持它自己的一些命令行参数，所以这里同样有argc,argv作为参数。</p>
<p><strong>Line6：</strong>创建了一个QLabel Widget，这里的Widget相当于VC中的控件，Qt十分灵活，任意窗口部件(Widget)都可以作为窗口，这里就使用了一个Qlabel作为窗口。另外可以看到，通过使用一些简单的HTML样式格式，可以轻松地把Qt应用程序的用户接口变得更为丰富多彩。</p>
<p><strong>Line8：</strong>使QLabel可见，默认隐藏是为了便于我们先进行设置然后再显示它们，从而避免了窗口部件的闪烁现象。</p>
<p><strong>Line9：</strong>将应用程序的控制权传递给Qt。此时，程序会进入事件循环状态，这是一种等待模式，程序会等候用户的动作，例如鼠标单击和按键等操作。</p>
<p>BTW：在这个程序中没有过多关注在main()函数末尾处对QLabel对象的delete操作调用。在如此短小的程序内，这样一点内存泄漏(memory leak)问题无关大局，因为在程序结束时，这部分内存是可以由操作系统重新回收的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mousefire.net/2010/01/06/qt%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0_chapter1_helloqt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
