summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-08-08 11:59:01 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-08-08 11:59:01 (GMT)
commit74b7d4c2c4036e9f2c0da7f0eaad06cef954b923 (patch)
treea82d916bc804ba24506f99701ac6202cd30e576a
parent3f8b5c71d09f4f420575568ea991a856c96dd566 (diff)
parent8815bc982b8361517a4376db4eb0e1b402c2bd65 (diff)
downloadQt-74b7d4c2c4036e9f2c0da7f0eaad06cef954b923.zip
Qt-74b7d4c2c4036e9f2c0da7f0eaad06cef954b923.tar.gz
Qt-74b7d4c2c4036e9f2c0da7f0eaad06cef954b923.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-doc-team
-rw-r--r--doc/src/getting-started/gettingstartedqt.qdoc72
-rw-r--r--doc/src/qt-webpages.qdoc2
-rwxr-xr-xexamples/tutorials/gettingStarted/gsQt/part2/main.cpp14
3 files changed, 55 insertions, 33 deletions
diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc
index eda5ee1..d37e8e0 100644
--- a/doc/src/getting-started/gettingstartedqt.qdoc
+++ b/doc/src/getting-started/gettingstartedqt.qdoc
@@ -38,6 +38,12 @@
documentation, and find the information you need for the
application you are developing.
+ The code for this tutorial is available in \c
+ {examples/tutorials/gettingStarted/gsQt} under your Qt
+ installation. If you are using the Qt SDK, you will find it in
+ \c{Examples/4.7/tutorials/gettingStarted/gsQt} (change \c{4.7} if
+ you are using a later Qt version).
+
\section1 Hello Notepad
In this first example, we simply create and show a text edit in a
@@ -139,28 +145,28 @@
Let us take a look at the code.
\code
- 1 #include <QtGui>
- 2
- 3 int main(int argv, char **args)
- 4 {
- 5 QApplication app(argv, args);
- 6
- 7 QTextEdit textEdit;
- 8 QPushButton quitButton("Quit");
- 9
-10 QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
-11
-12 QVBoxLayout layout;
-13 layout.addWidget(&textEdit);
-14 layout.addWidget(&quitButton);
-15
-16 QWidget window;
-17 window.setLayout(&layout);
-18
-19 window.show();
-20
-21 return app.exec();
-22 }
+ 1 #include <QtGui>
+ 2
+ 3 int main(int argv, char **args)
+ 4 {
+ 5 QApplication app(argv, args);
+ 6
+ 7 QTextEdit *textEdit = new QTextEdit;
+ 8 QPushButton *quitButton = new QPushButton("&Quit");
+ 9
+10 QObject::connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
+11
+12 QVBoxLayout *layout = new QVBoxLayout;
+13 layout->addWidget(textEdit);
+14 layout->addWidget(quitButton);
+15
+16 QWidget window;
+17 window.setLayout(layout);
+18
+19 window.show();
+20
+21 return app.exec();
+22 }
\endcode
Line 1 includes QtGui, which contains all of Qt's GUI classes.
@@ -278,9 +284,25 @@
visible strings. This function is necessary when you want to
provide your application in more than one language (e.g. English
and Chinese). We will not go into details here, but you can follow
- the \c {Qt Linguist} link from the learn more table. We will not
- look at the implementation of \c quit() slot and the \c main()
- function, but you can check out the source code if you want to.
+ the \c {Qt Linguist} link from the learn more table.
+
+ Here is the \c quit() slot:
+
+ \code
+75 void Notepad::quit()
+76 {
+77 QMessageBox messageBox;
+78 messageBox.setWindowTitle(tr("Notepad"));
+79 messageBox.setText(tr("Do you really want to quit?"));
+80 messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+81 messageBox.setDefaultButton(QMessageBox::No);
+82 if (messageBox.exec() == QMessageBox::Yes)
+83 qApp->quit();
+84 }
+ \endcode
+
+ We use the QMessageBox class to display a dialog that asks the
+ user whether he/she really wants to quit.
\section2 Learn More
diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc
index c993575..f67ff83 100644
--- a/doc/src/qt-webpages.qdoc
+++ b/doc/src/qt-webpages.qdoc
@@ -221,7 +221,7 @@
\title Forums on Qt Developer Network
*/
/*!
- \externalpage http://developer.qt.nokia.com/wikis
+ \externalpage http://developer.qt.nokia.com/wiki
\title Wiki on Qt Developer Network
*/
/*!
diff --git a/examples/tutorials/gettingStarted/gsQt/part2/main.cpp b/examples/tutorials/gettingStarted/gsQt/part2/main.cpp
index 24b4d77..afa26e1 100755
--- a/examples/tutorials/gettingStarted/gsQt/part2/main.cpp
+++ b/examples/tutorials/gettingStarted/gsQt/part2/main.cpp
@@ -44,17 +44,17 @@ int main(int argv, char **args)
{
QApplication app(argv, args);
- QTextEdit textEdit;
- QPushButton quitButton("&Quit");
+ QTextEdit *textEdit = new QTextEdit;
+ QPushButton *quitButton = new QPushButton("&Quit");
- QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
+ QObject::connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit()));
- QVBoxLayout layout;
- layout.addWidget(&textEdit);
- layout.addWidget(&quitButton);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(textEdit);
+ layout->addWidget(quitButton);
QWidget window;
- window.setLayout(&layout);
+ window.setLayout(layout);
window.show();