summaryrefslogtreecommitdiffstats
path: root/doc/html/tutorial1-01.html
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2011-11-08 12:31:36 -0600
committerTimothy Pearson <[email protected]>2011-11-08 12:31:36 -0600
commitd796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch)
tree6e3dcca4f77e20ec8966c666aac7c35bd4704053 /doc/html/tutorial1-01.html
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'doc/html/tutorial1-01.html')
-rw-r--r--doc/html/tutorial1-01.html168
1 files changed, 168 insertions, 0 deletions
diff --git a/doc/html/tutorial1-01.html b/doc/html/tutorial1-01.html
new file mode 100644
index 000000000..97005180a
--- /dev/null
+++ b/doc/html/tutorial1-01.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/tutorial.doc:80 -->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>TQt Tutorial - Chapter 1: Hello, World!</title>
+<style type="text/css"><!--
+fn { margin-left: 1cm; text-indent: -1cm; }
+a:link { color: #004faf; text-decoration: none }
+a:visited { color: #672967; text-decoration: none }
+body { background: #ffffff; color: black; }
+--></style>
+</head>
+<body>
+
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr bgcolor="#E5E5E5">
+<td valign=center>
+ <a href="index.html">
+<font color="#004faf">Home</font></a>
+ | <a href="classes.html">
+<font color="#004faf">All&nbsp;Classes</font></a>
+ | <a href="mainclasses.html">
+<font color="#004faf">Main&nbsp;Classes</font></a>
+ | <a href="annotated.html">
+<font color="#004faf">Annotated</font></a>
+ | <a href="groups.html">
+<font color="#004faf">Grouped&nbsp;Classes</font></a>
+ | <a href="functions.html">
+<font color="#004faf">Functions</font></a>
+</td>
+<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQt Tutorial - Chapter 1: Hello, World!</h1>
+
+
+<p> <center><img src="t1.png" alt="Screenshot of tutorial one"></center>
+<p> This first program is a simple hello-world example. It contains only
+the bare minimum you need to get a TQt application up and running.
+The picture above is a snapshot of this program.
+<p> <pre>/****************************************************************
+**
+** TQt tutorial 1
+**
+****************************************************************/
+
+#include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
+#include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
+
+
+int main( int argc, char **argv )
+{
+ <a href="qapplication.html">TQApplication</a> a( argc, argv );
+
+ <a href="qpushbutton.html">TQPushButton</a> hello( "Hello world!", 0 );
+ hello.<a href="qwidget.html#resize">resize</a>( 100, 30 );
+
+ a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &amp;hello );
+ hello.<a href="qwidget.html#show">show</a>();
+ return a.<a href="qapplication.html#exec">exec</a>();
+}
+</pre>
+
+
+
+<p> <h2> Line-by-line Walkthrough
+</h2>
+<a name="1"></a><p> <pre> #include &lt;<a href="qapplication-h.html">qapplication.h</a>&gt;
+</pre>
+<p> This line includes the <a href="qapplication.html">TQApplication</a> class definition. There has to be
+exactly one TQApplication object in every application that uses TQt.
+TQApplication manages various application-wide resources, such as the
+default font and cursor.
+<p> <pre> #include &lt;<a href="qpushbutton-h.html">qpushbutton.h</a>&gt;
+</pre>
+<p> This line includes the <a href="qpushbutton.html">TQPushButton</a> class definition. The
+<a href="hierarchy.html">reference documentation</a> for each class
+mentions at the top which file needs to be included to use that class.
+<p> TQPushButton is a classical GUI push button that the user can press
+and release. It manages its own look and feel, like every other <a href="qwidget.html">TQWidget</a>. A widget is a user interface object that can process user
+input and draw graphics. The programmer can change both the overall
+<a href="qapplication.html#setStyle">look and feel</a> and many minor
+properties of it (such as color), as well as the widget's content. A
+TQPushButton can show either a text or a <a href="qpixmap.html">TQPixmap</a>.
+<p> <pre> int main( int argc, char **argv )
+ {
+</pre>
+<p> The main() function is the entry point to the program. Almost always
+when using TQt, main() only needs to perform some kind of initialization
+before passing the control to the TQt library, which then tells the
+program about the user's actions via events.
+<p> <tt>argc</tt> is the number of command-line arguments and <tt>argv</tt> is the
+array of command-line arguments. This is a C/C++ feature. It is not
+specific to TQt; however, TQt needs to process these arguments (see
+following).
+<p> <pre> <a href="qapplication.html">TQApplication</a> a( argc, argv );
+</pre>
+<p> <tt>a</tt> is this program's <a href="qapplication.html">TQApplication</a>. Here it is created and processes
+some of the command-line arguments (such as -display under X Window).
+Note that all command-line arguments recognized by TQt are removed from
+<tt>argv</tt> (and <tt>argc</tt> is decremented accordingly). See the <a href="qapplication.html#argv">TQApplication::argv</a>() documentation for details.
+<p> <strong>Note:</strong> It is essential that the TQApplication object be
+created before any window-system parts of TQt are used.
+<p> <pre> <a href="qpushbutton.html">TQPushButton</a> hello( "Hello world!", 0 );
+</pre>
+<p> Here, <em>after</em> the TQApplication, comes the first window-system code: A
+push button is created.
+<p> The button is set up to display the text "Hello world!" and be a
+window of its own (because the constructor specifies 0 for the parent
+window, inside which the button should be located).
+<p> <pre> <a name="x2285"></a> hello.<a href="qwidget.html#resize">resize</a>( 100, 30 );
+</pre>
+<p> The button is set up to be 100 pixels wide and 30 pixels high (plus the
+window system frame). In this case we don't care about the button's
+position, and we accept the default value.
+<p> <pre> <a name="x2284"></a> a.<a href="qapplication.html#setMainWidget">setMainWidget</a>( &amp;hello );
+</pre>
+<p> The push button is chosen as the main widget for the application. If
+the user closes a main widget, the application exits.
+<p> You don't have to have a main widget, but most programs do have one.
+<p> <pre> <a name="x2286"></a> hello.<a href="qwidget.html#show">show</a>();
+</pre>
+<p> A widget is never visible when you create it. You must call show() to
+make it visible.
+<p> <pre> <a name="x2283"></a> return a.<a href="qapplication.html#exec">exec</a>();
+</pre>
+<p> This is where main() passes control to TQt, and exec() will return when
+the application exits.
+<p> In exec(), TQt receives and processes user and system events and passes
+these on to the appropriate widgets.
+<p> <pre> }
+</pre>
+<p> You should now try to compile and run this program.
+<p> <a name="compiling"></a>
+<h2> Compiling
+</h2>
+<a name="2"></a><p> To compile a C++ application you need to create a makefile. The
+easiest way to create a makefile for TQt is to use the <a href="qmake-manual.html">qmake</a> build tool supplied with TQt. If you've
+saved <tt>main.cpp</tt> in its own directory, all you have to do is:
+<pre>
+qmake -project
+qmake
+</pre>
+
+<p> The first command tells <a href="qmake-manual.html">qmake</a> to
+create a <tt>.pro</tt> (project) file. The second command tells it to create
+a (platform-specific) makefile based on the project file. You should
+now be able to type <tt>make</tt> (or <tt>nmake</tt> if you're using Visual
+Studio) and then run your first TQt application!
+<p> <h2> Behavior
+</h2>
+<a name="3"></a><p> When you run it, you will see a small window filled with a single
+button, and on it you can read the famous words, Hello World!
+<p> <h2> Exercises
+</h2>
+<a name="4"></a><p> Try to resize the window. Press the button. If you're running X
+Window, try running the program with the -geometry option
+(for example, <tt>-geometry 100x200+10+20</tt>).
+<p> You're now ready for <a href="tutorial1-02.html">Chapter 2.</a>
+<p> [<a href="tutorial1-02.html">Next tutorial</a>]
+[<a href="tutorial.html">Main tutorial page</a>]
+<p>
+<!-- eof -->
+<p><address><hr><div align=center>
+<table width=100% cellspacing=0 border=0><tr>
+<td>Copyright &copy; 2007
+<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
+<td align=right><div align=right>TQt 3.3.8</div>
+</table></div></address></body>
+</html>