<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;feed=atom&amp;action=history</id>
		<title>Development/Tutorials/Qt4 Ruby Tutorial/Chapter 14/fi - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;action=history"/>
		<updated>2013-06-20T02:32:34Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=73689&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=73689&amp;oldid=prev"/>
				<updated>2012-07-18T14:26:50Z</updated>
		
		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:26, 18 July 2012&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;{{Template:I18n/Language Navigation Bar|Development/Tutorials/Qt4 Ruby Tutorial/Chapter 14}}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>FuzzyBot</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67174&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Harjoitukset ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67174&amp;oldid=prev"/>
				<updated>2011-11-01T17:34:13Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Harjoitukset ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:34, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 189:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 189:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The cannon now shoots when you press Enter. You can also position the cannon's angle using the mouse. The barrier makes it a little more challenging to play the game. We also have a nice looking frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The cannon now shoots when you press Enter. You can also position the cannon's angle using the mouse. The barrier makes it a little more challenging to play the game. We also have a nice looking frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Exercises &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Harjoitukset &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Write a space invaders game.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Write a space invaders game.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67172&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Sovellusen suorittaminen ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67172&amp;oldid=prev"/>
				<updated>2011-11-01T17:34:00Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Sovellusen suorittaminen ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:34, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 185:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 185:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We give '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;''' its own [http://doc.qt.nokia.com/latest/qvboxlayout.html Qt::VBoxLayout], and we add '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' to that layout. This implicitly makes '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' a child of '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;'''. Because nothing else is in the box, the effect is that the [http://doc.qt.nokia.com/latest/qvboxlayout.html Qt::VBoxLayout] will put a frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''. We put '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;''', not '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''', in the grid layout.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We give '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;''' its own [http://doc.qt.nokia.com/latest/qvboxlayout.html Qt::VBoxLayout], and we add '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' to that layout. This implicitly makes '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' a child of '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;'''. Because nothing else is in the box, the effect is that the [http://doc.qt.nokia.com/latest/qvboxlayout.html Qt::VBoxLayout] will put a frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''. We put '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;''', not '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''', in the grid layout.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Running the Application &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Sovellusen suorittaminen &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The cannon now shoots when you press Enter. You can also position the cannon's angle using the mouse. The barrier makes it a little more challenging to play the game. We also have a nice looking frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The cannon now shoots when you press Enter. You can also position the cannon's angle using the mouse. The barrier makes it a little more challenging to play the game. We also have a nice looking frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67170&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Läpikäynti rivi riviltä ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67170&amp;oldid=prev"/>
				<updated>2011-11-01T17:33:35Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Läpikäynti rivi riviltä ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:33, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We add keyboard accelerators and introduce mouse events to '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''. We put a frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' and add a barrier (wall) to make the game more challenging. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We add keyboard accelerators and introduce mouse events to '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''. We put a frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' and add a barrier (wall) to make the game more challenging. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Line by Line Walkthrough &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Läpikäynti rivi riviltä &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/cannon.rb cannon.rb]'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/cannon.rb cannon.rb]'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67168&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;=== Yleiskuva ===&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67168&amp;oldid=prev"/>
				<updated>2011-11-01T17:33:20Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;=== Yleiskuva ===&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:33, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/cannon.rb cannon.rb]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/cannon.rb cannon.rb]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Overview &lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Yleiskuva &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is the final example: a complete game.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This is the final example: a complete game.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67165&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;Qt4 Ruby -oppikurssi&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67165&amp;oldid=prev"/>
				<updated>2011-11-01T17:33:01Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Qt4 Ruby -oppikurssi&amp;quot;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 17:33, 1 November 2011&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{TutorialBrowser|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Tutorial&lt;/del&gt;]]|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-oppikurssi&lt;/ins&gt;]]|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name=Facing the Wall|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;name=Facing the Wall|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13|Tutorial 13 - Game Over]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13|Tutorial 13 - Game Over]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67163&amp;oldid=prev</id>
		<title>Centerlink: Created page with &quot;TutorialBrowser&quot;</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_14/fi&amp;diff=67163&amp;oldid=prev"/>
				<updated>2011-11-01T17:32:45Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;TutorialBrowser&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;languages /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Template:I18n/Language Navigation Bar|Development/Tutorials/Qt4 Ruby Tutorial/Chapter 14}}&lt;br /&gt;
&lt;br /&gt;
{{TutorialBrowser|&lt;br /&gt;
series=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial|Qt4 Ruby Tutorial]]|&lt;br /&gt;
name=Facing the Wall|&lt;br /&gt;
pre=[[Special:myLanguage/Development/Tutorials/Qt4_Ruby_Tutorial/Chapter_13|Tutorial 13 - Game Over]]&lt;br /&gt;
}}&lt;br /&gt;
== Facing the Wall ==&lt;br /&gt;
[[Image:Qt4_Ruby_Tutorial_Screenshot_14.png|center]]&lt;br /&gt;
Files:&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/lcdrange.rb lcdrange.rb]&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/gamebrd.rb gamebrd.rb]&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/t14.rb t14.rb]&lt;br /&gt;
* [http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/cannon.rb cannon.rb]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
This is the final example: a complete game.&lt;br /&gt;
&lt;br /&gt;
We add keyboard accelerators and introduce mouse events to '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''. We put a frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' and add a barrier (wall) to make the game more challenging. &lt;br /&gt;
&lt;br /&gt;
=== Line by Line Walkthrough ===&lt;br /&gt;
'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/cannon.rb cannon.rb]'''&lt;br /&gt;
&lt;br /&gt;
The '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' can now receive mouse events to make the user aim the barrel by clicking on it and dragging. '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' also has a barrier wall.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
@barrelPressed = false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This line has been added to the constructor. Initially, the mouse is not pressed on the barrel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
elsif shotR.x() &amp;gt; width() || shotR.y() &amp;gt; height() ||&lt;br /&gt;
    shotR.intersects(barrierRect())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that we have a barrier, there are three ways to miss. We test for the third, too. (In '''&amp;lt;tt&amp;gt;moveShot()&amp;lt;/tt&amp;gt;'''.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def mousePressEvent(event)&lt;br /&gt;
  unless event.button() == Qt::LeftButton&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if barrelHit(event.pos())&lt;br /&gt;
    @barrelPressed = true&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a Qt event handler. It is called when the user presses a mouse button when the mouse cursor is over the widget.&lt;br /&gt;
&lt;br /&gt;
If the event was not generated by the left mouse button, we return immediately. Otherwise, we check if the position of the mouse cursor is within the cannon's barrel. If it is, we set '''&amp;lt;tt&amp;gt;barrelPressed&amp;lt;/tt&amp;gt;''' to true.&lt;br /&gt;
&lt;br /&gt;
Notice that the [http://doc.qt.nokia.com/latest/qmouseevent.html#pos Qt::MouseEvent::pos()] function returns a point in the widget's coordinate system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def mouseMoveEvent(event)&lt;br /&gt;
  unless @barrelPressed&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  pos = event.pos();&lt;br /&gt;
&lt;br /&gt;
  if pos.x() &amp;lt;= 0&lt;br /&gt;
    pos.setX(1)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  if pos.y() &amp;gt;= height()&lt;br /&gt;
    pos.setY(height() - 1)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  rad = atan2((rect().bottom() - pos.y()), pos.x())&lt;br /&gt;
  setAngle((rad * 180 / 3.14159265).round())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is another Qt event handler. It is called when the user already has pressed the mouse button inside this widget and then moves/drags the mouse. (You can make Qt send mouse move events even when no buttons are pressed. See [http://doc.qt.nokia.com/latest/qwidget.html#mouseTracking-prop Qt::Widget::setMouseTracking()].)&lt;br /&gt;
&lt;br /&gt;
This handler repositions the cannon's barrel according to the position of the mouse cursor.&lt;br /&gt;
&lt;br /&gt;
First, if the barrel is not pressed, we return. Next, we fetch the mouse cursor's position. If the mouse cursor is to the left or below the widget, we adjust the point to be inside the widget.&lt;br /&gt;
&lt;br /&gt;
Then we calculate the angle between the bottom edge of the widget and the imaginary line between the bottom-left corner of the widget and the cursor position. Finally we set the cannon's angle to the new value converted to degrees.&lt;br /&gt;
&lt;br /&gt;
Remember that '''&amp;lt;tt&amp;gt;setAngle()&amp;lt;/tt&amp;gt;''' redraws the cannon.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def mouseReleaseEvent(event)&lt;br /&gt;
  if event.button() == Qt::LeftButton&lt;br /&gt;
    @barrelPressed = false&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This Qt event handler is called whenever the user releases a mouse button and it was pressed inside this widget.&lt;br /&gt;
&lt;br /&gt;
If the left button is released, we can be sure that the barrel is no longer pressed.&lt;br /&gt;
&lt;br /&gt;
The paint event has one extra line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
paintBarrier(painter)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;paintBarrier()&amp;lt;/tt&amp;gt;''' does the same sort of thing as '''&amp;lt;tt&amp;gt;paintShot()&amp;lt;/tt&amp;gt;''', '''&amp;lt;tt&amp;gt;paintTarget()&amp;lt;/tt&amp;gt;''', and '''&amp;lt;tt&amp;gt;paintCannon()&amp;lt;/tt&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def paintBarrier( painter )&lt;br /&gt;
  painter.setBrush(Qt::Brush.new(Qt::yellow))&lt;br /&gt;
  painter.setPen(Qt::Color.new(Qt::black))&lt;br /&gt;
  painter.drawRect(barrierRect())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function paints the barrier as a rectangle filled with yellow and with a black outline.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def barrierRect()&lt;br /&gt;
  return Qt::Rect.new(145, height() - 100, 15, 99)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function returns the rectangle of the barrier. We fix the bottom edge of the barrier to the bottom edge of the widget.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def barrelHit(pos)&lt;br /&gt;
  matrix = Qt::Matrix.new()&lt;br /&gt;
  matrix.translate(0, height())&lt;br /&gt;
  matrix.rotate(-@currentAngle)&lt;br /&gt;
  matrix = matrix.inverted()&lt;br /&gt;
  return @barrelRect.contains(matrix.map(pos))&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function returns '''&amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;''' if the point is in the barrel; otherwise it returns '''&amp;lt;tt&amp;gt;false&amp;lt;/tt&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
Here we use the class [http://doc.qt.nokia.com/latest/qmatrix.html Qt::Matrix]. [http://doc.qt.nokia.com/latest/qmatrix.html Qt::Matrix] defines a coordinate system mapping. It can perform the same transformations as the [http://doc.qt.nokia.com/latest/qpainter.html Qt::Painter].&lt;br /&gt;
&lt;br /&gt;
Here we perform the same transformation steps as we do when drawing the barrel in the '''&amp;lt;tt&amp;gt;paintCannon()&amp;lt;/tt&amp;gt;''' function. First we translate the coordinate system and then we rotate it.&lt;br /&gt;
&lt;br /&gt;
Now we need to check whether the point '''&amp;lt;tt&amp;gt;pos&amp;lt;/tt&amp;gt;''' (in widget coordinates) lies inside the barrel. To do this, we invert the transformation matrix. The inverted matrix performs the inverse transformation that we used when drawing the barrel. We map the point '''&amp;lt;tt&amp;gt;pos&amp;lt;/tt&amp;gt;''' using the inverted matrix and return '''&amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;''' if it is inside the original barrel rectangle.&lt;br /&gt;
&lt;br /&gt;
'''[http://www.darshancomputing.com/qt4-qtruby-tutorial/tutorial/t14/gamebrd.rb gamebrd.rb]'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
cannonBox = Qt::Frame.new()&lt;br /&gt;
cannonBox.setFrameStyle(Qt::Frame::WinPanel | Qt::Frame::Sunken)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We create and set up a [http://doc.qt.nokia.com/latest/qframe.html Qt::Frame], and set its frame style. This results in a 3D frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
Qt::Shortcut.new(Qt::KeySequence.new(Qt::Key_Enter.to_i),&lt;br /&gt;
                 self, SLOT('fire()'))&lt;br /&gt;
Qt::Shortcut.new(Qt::KeySequence.new(Qt::Key_Return.to_i),&lt;br /&gt;
                 self, SLOT('fire()'))&lt;br /&gt;
Qt::Shortcut.new(Qt::KeySequence.new(Qt::CTRL.to_i + Qt::Key_Q.to_i),&lt;br /&gt;
                 self, SLOT('close()'))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we create and set up three [http://doc.qt.nokia.com/latest/qshortcut.html Qt::Shortcut] objects. These objects intercept keyboard events to a widget and call slots if certain keys are pressed. Note that a [http://doc.qt.nokia.com/latest/qshortcut.html Qt::Shortcut] object is a child of a widget and will be destroyed when that widget is destroyed. [http://doc.qt.nokia.com/latest/qshortcut.html Qt::Shortcut] itself is not a widget and has no visible effect on its parent.&lt;br /&gt;
&lt;br /&gt;
We define three shortcut keys. We want the '''&amp;lt;tt&amp;gt;fire()&amp;lt;/tt&amp;gt;''' slot to be called when the user presses Enter or Return. We also want the application to quit when key Ctrl+Q is pressed. Instead of connecting to [http://doc.qt.nokia.com/latest/qcoreapplication.html#quit Qt::CoreApplication::quit()], we connect to [http://doc.qt.nokia.com/latest/qwidget.html#close Qt::Widget::close()] this time. Since the '''&amp;lt;tt&amp;gt;GameBoard&amp;lt;/tt&amp;gt;''' is the application's main widget, this has the same effect as [http://doc.qt.nokia.com/latest/qcoreapplication.html#quit QCoreApplication::quit()].&lt;br /&gt;
&lt;br /&gt;
Qt::CTRL, Qt::Key_Enter, Qt::Key_Return, and Qt::Key_Q are all constants declared in the Qt namespace. Unfortunately, in the current version of qtruby, they need to be converted to integers before we can use them in our shortcuts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
leftLayout = Qt::VBoxLayout.new()&lt;br /&gt;
leftLayout.addWidget(angle)&lt;br /&gt;
leftLayout.addWidget(force)&lt;br /&gt;
&lt;br /&gt;
gridLayout = Qt::GridLayout.new()&lt;br /&gt;
gridLayout.addWidget(quit, 0, 0)&lt;br /&gt;
gridLayout.addLayout(topLayout, 0, 1)&lt;br /&gt;
gridLayout.addLayout(leftLayout, 1, 0)&lt;br /&gt;
gridLayout.addWidget(@cannonField, 1, 1, 2, 1)&lt;br /&gt;
gridLayout.setColumnStretch(1, 10)&lt;br /&gt;
setLayout(gridLayout)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We give '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;''' its own [http://doc.qt.nokia.com/latest/qvboxlayout.html Qt::VBoxLayout], and we add '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' to that layout. This implicitly makes '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''' a child of '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;'''. Because nothing else is in the box, the effect is that the [http://doc.qt.nokia.com/latest/qvboxlayout.html Qt::VBoxLayout] will put a frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''. We put '''&amp;lt;tt&amp;gt;cannonBox&amp;lt;/tt&amp;gt;''', not '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;''', in the grid layout.&lt;br /&gt;
&lt;br /&gt;
=== Running the Application ===&lt;br /&gt;
&lt;br /&gt;
The cannon now shoots when you press Enter. You can also position the cannon's angle using the mouse. The barrier makes it a little more challenging to play the game. We also have a nice looking frame around the '''&amp;lt;tt&amp;gt;CannonField&amp;lt;/tt&amp;gt;'''.&lt;br /&gt;
&lt;br /&gt;
=== Exercises ===&lt;br /&gt;
&lt;br /&gt;
Write a space invaders game.&lt;br /&gt;
&lt;br /&gt;
The new exercise is: Write a Breakout game.&lt;br /&gt;
&lt;br /&gt;
Final exhortation: Go forth now and create masterpieces of the programming art!&lt;br /&gt;
&lt;br /&gt;
[[Category:Ruby]]&lt;/div&gt;</summary>
		<author><name>Centerlink</name></author>	</entry>

	</feed>