Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
1e8e1c05
Commit
1e8e1c05
authored
15 years ago
by
Kavindra Devi Palaraja
Browse files
Options
Downloads
Patches
Plain Diff
Doc - making the code snippet quoting more consistent by removing more
of the \code tags and using \snippet tags instead
parent
1997d8fb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/examples/textfinder/textfinder.cpp
+6
-4
6 additions, 4 deletions
doc/examples/textfinder/textfinder.cpp
doc/examples/textfinder/textfinder.h
+2
-0
2 additions, 0 deletions
doc/examples/textfinder/textfinder.h
doc/qtcreator.qdoc
+6
-16
6 additions, 16 deletions
doc/qtcreator.qdoc
with
14 additions
and
20 deletions
doc/examples/textfinder/textfinder.cpp
+
6
−
4
View file @
1e8e1c05
...
@@ -29,18 +29,20 @@
...
@@ -29,18 +29,20 @@
#include
"textfinder.h"
#include
"textfinder.h"
//! [1]
#include
<QtCore/QFile>
#include
<QtCore/QFile>
#include
<QtCore/QTextStream>
#include
<QtCore/QTextStream>
//! [1]
#include
<QtGui/QMessageBox>
#include
<QtGui/QMessageBox>
//! [
2
]
//! [
3
]
TextFinder
::
TextFinder
(
QWidget
*
parent
)
TextFinder
::
TextFinder
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
TextFinder
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
TextFinder
)
{
{
ui
->
setupUi
(
this
);
ui
->
setupUi
(
this
);
loadTextFile
();
loadTextFile
();
}
}
//! [
2
]
//! [
3
]
TextFinder
::~
TextFinder
()
TextFinder
::~
TextFinder
()
{
{
...
@@ -63,10 +65,10 @@ void TextFinder::loadTextFile()
...
@@ -63,10 +65,10 @@ void TextFinder::loadTextFile()
}
}
//! [0]
//! [0]
//! [
1
]
//! [
2
]
void
TextFinder
::
on_findButton_clicked
()
void
TextFinder
::
on_findButton_clicked
()
{
{
QString
searchString
=
ui
->
lineEdit
->
text
();
QString
searchString
=
ui
->
lineEdit
->
text
();
ui
->
textEdit
->
find
(
searchString
,
QTextDocument
::
FindWholeWords
);
ui
->
textEdit
->
find
(
searchString
,
QTextDocument
::
FindWholeWords
);
}
}
//! [
1
]
//! [
2
]
This diff is collapsed.
Click to expand it.
doc/examples/textfinder/textfinder.h
+
2
−
0
View file @
1e8e1c05
...
@@ -47,12 +47,14 @@ public:
...
@@ -47,12 +47,14 @@ public:
TextFinder
(
QWidget
*
parent
=
0
);
TextFinder
(
QWidget
*
parent
=
0
);
~
TextFinder
();
~
TextFinder
();
//! [0]
private
slots
:
private
slots
:
void
on_findButton_clicked
();
void
on_findButton_clicked
();
private:
private:
Ui
::
TextFinder
*
ui
;
Ui
::
TextFinder
*
ui
;
void
loadTextFile
();
void
loadTextFile
();
//! [0]
};
};
#endif // TEXTFINDER_H
#endif // TEXTFINDER_H
This diff is collapsed.
Click to expand it.
doc/qtcreator.qdoc
+
6
−
16
View file @
1e8e1c05
...
@@ -564,15 +564,7 @@
...
@@ -564,15 +564,7 @@
\l{http://doc.trolltech.com/qtextedit.html}{QTextEdit}. This is done with
\l{http://doc.trolltech.com/qtextedit.html}{QTextEdit}. This is done with
the following code:
the following code:
\code
\snippet examples/textfinder/textfinder.h 0
private slots:
void on_findButton_clicked();
private:
Ui::TextFinder *ui;
void loadTextFile();
\endcode
\note The \c{Ui::TextFinder} object is already provided.
\note The \c{Ui::TextFinder} object is already provided.
\section2 The Source File
\section2 The Source File
...
@@ -581,7 +573,7 @@
...
@@ -581,7 +573,7 @@
\c{textfinder.cpp}. We begin by filling in the functionality to load a
\c{textfinder.cpp}. We begin by filling in the functionality to load a
text file. The code snippet below describes this:
text file. The code snippet below describes this:
\snippet example/textfinder/textfinder.cpp 0
\snippet example
s
/textfinder/textfinder.cpp 0
Basically, we load a text file using
Basically, we load a text file using
\l{http://doc.trolltech.com/qfile.html}{QFile}, read it with
\l{http://doc.trolltech.com/qfile.html}{QFile}, read it with
...
@@ -589,22 +581,20 @@
...
@@ -589,22 +581,20 @@
then display it on \c{textEdit} with
then display it on \c{textEdit} with
\l{http://doc.trolltech.com/qtextedit.html#plainText-prop}{setPlainText()}
\l{http://doc.trolltech.com/qtextedit.html#plainText-prop}{setPlainText()}
which requires adding the following additional #includes to textfinder.cpp:
which requires adding the following additional #includes to textfinder.cpp:
\code
#include <QtCore/QFile>
\snippet examples/textfinder/textfinder.cpp 1
#include <QtCore/QTextStream>
\endcode
For the \c{on_findButton_clicked()} slot, we extract the search string and
For the \c{on_findButton_clicked()} slot, we extract the search string and
use the \l{http://doc.trolltech.com/qtextedit.html#find}{find()} function
use the \l{http://doc.trolltech.com/qtextedit.html#find}{find()} function
to look for the search string within the text file. The code snippet below
to look for the search string within the text file. The code snippet below
further describes it:
further describes it:
\snippet example/textfinder/textfinder.cpp
1
\snippet example
s
/textfinder/textfinder.cpp
2
Once we have both these functions complete, we call \c{loadTextFile()} in
Once we have both these functions complete, we call \c{loadTextFile()} in
our constructor.
our constructor.
\snippet example/textfinder/textfinder.cpp
2
\snippet example
s
/textfinder/textfinder.cpp
3
The \c{on_findButton_clicked()} slot will be called automatically due to
The \c{on_findButton_clicked()} slot will be called automatically due to
this line of code:
this line of code:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment