aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <[email protected]>2009-03-24 17:57:43 +0100
committerhjk <[email protected]>2009-03-24 17:57:43 +0100
commit6aeb8a764bbc17f57e3dec14187857697fc64ee2 (patch)
tree2752a18d53276aae12b786b0b07da19e135011bf
parenta4bb415f58fdcc5d2bbacc4a430e68e56423726d (diff)
more fixes to the textfinder example documentation
-rw-r--r--doc/example/textfinder/textfinder.cpp6
-rw-r--r--doc/qtcreator.qdoc26
-rw-r--r--doc/qtcreator.qdocconf1
3 files changed, 17 insertions, 16 deletions
diff --git a/doc/example/textfinder/textfinder.cpp b/doc/example/textfinder/textfinder.cpp
index 28cfc597b62..c302f91911f 100644
--- a/doc/example/textfinder/textfinder.cpp
+++ b/doc/example/textfinder/textfinder.cpp
@@ -33,18 +33,21 @@
#include <QtCore/QTextStream>
#include <QtGui/QMessageBox>
+//! [2]
TextFinder::TextFinder(QWidget *parent)
: QWidget(parent), ui(new Ui::TextFinder)
{
ui->setupUi(this);
loadTextFile();
}
+//! [2]
TextFinder::~TextFinder()
{
delete ui;
}
+//! [0]
void TextFinder::loadTextFile()
{
QFile inputFile(":/input.txt");
@@ -58,9 +61,12 @@ void TextFinder::loadTextFile()
QTextCursor cursor = ui->textEdit->textCursor();
cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1);
}
+//! [0]
+//! [1]
void TextFinder::on_findButton_clicked()
{
QString searchString = ui->lineEdit->text();
ui->textEdit->find(searchString, QTextDocument::FindWholeWords);
}
+//! [1]
diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc
index 37d93730f3f..37bd1846108 100644
--- a/doc/qtcreator.qdoc
+++ b/doc/qtcreator.qdoc
@@ -565,7 +565,7 @@
void loadTextFile();
\endcode
- \note The \c{Ui::Form} object is already provided.
+ \note The \c{Ui::TextFinder} object is already provided.
\section2 The Source File
@@ -573,9 +573,7 @@
\c{textfinder.cpp}. We begin by filling in the functionality to load a
text file. The code snippet below describes this:
- \quotefromfile textfinder.cpp
- \skipto TextFinder::loadTextFile
- \printuntil }
+ \snippet example/textfinder/textfinder.cpp 0
Basically, we load a text file using
\l{http://doc.trolltech.com/qfile.html}{QFile}, read it with
@@ -593,22 +591,18 @@
to look for the search string within the text file. The code snippet below
further describes it:
- \quotefromfile textfinder.cpp
- \skipto on_findButton_clicked
- \printuntil }
+ \snippet example/textfinder/textfinder.cpp 1
Once we have both these functions complete, we call \c{loadTextFile()} in
our constructor.
- \quotefromfile textfinder.cpp
- \skipto TextFinder::TextFinder
- \printuntil }
+ \snippet example/textfinder/textfinder.cpp 2
The \c{on_findButton_clicked()} slot will be called automatically due to
this line of code:
\code
- QMetaObject::connectSlotsByName(TextFinderClass);
+ QMetaObject::connectSlotsByName(TextFinder);
\endcode
in the uic generated \c{ui_textfinder.h} file.
@@ -1184,13 +1178,13 @@
\code
void TextFinder::on_findButton_clicked()
{
- QString searchString = ui.lineEdit->text();
+ QString searchString = ui->lineEdit->text();
- QTextDocument *document = ui.textEdit->document();
- QTextCursor cursor = ui.textEdit->textCursor();
+ QTextDocument *document = ui->textEdit->document();
+ QTextCursor cursor = ui->textEdit->textCursor();
cursor = document->find(searchString, cursor,
QTextDocument::FindWholeWords);
- ui.textEdit->setTextCursor(cursor);
+ ui->textEdit->setTextCursor(cursor);
bool found = cursor.isNull();
@@ -1203,7 +1197,7 @@
if (ret == QMessageBox::Yes) {
cursor = document->find(searchString,
QTextDocument::FindWholeWords);
- ui.textEdit->setTextCursor(cursor);
+ ui->textEdit->setTextCursor(cursor);
} else
return;
}
diff --git a/doc/qtcreator.qdocconf b/doc/qtcreator.qdocconf
index 8baed7725cf..ea504250cc3 100644
--- a/doc/qtcreator.qdocconf
+++ b/doc/qtcreator.qdocconf
@@ -8,6 +8,7 @@ sourcedirs =
sourcedirs = $SRCDIR
imagedirs = $SRCDIR
outputdir = $OUTDIR
+exampledirs = $SRCDIR
extraimages.HTML = qt-logo \
trolltech-logo