Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
1e8e1c05
Commit
1e8e1c05
authored
Apr 02, 2009
by
Kavindra Devi Palaraja
Browse files
Options
Browse Files
Download
Email 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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
20 deletions
+14
-20
doc/examples/textfinder/textfinder.cpp
doc/examples/textfinder/textfinder.cpp
+6
-4
doc/examples/textfinder/textfinder.h
doc/examples/textfinder/textfinder.h
+2
-0
doc/qtcreator.qdoc
doc/qtcreator.qdoc
+6
-16
No files found.
doc/examples/textfinder/textfinder.cpp
View file @
1e8e1c05
...
...
@@ -29,18 +29,20 @@
#include "textfinder.h"
//! [1]
#include <QtCore/QFile>
#include <QtCore/QTextStream>
//! [1]
#include <QtGui/QMessageBox>
//! [
2
]
//! [
3
]
TextFinder
::
TextFinder
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
TextFinder
)
{
ui
->
setupUi
(
this
);
loadTextFile
();
}
//! [
2
]
//! [
3
]
TextFinder
::~
TextFinder
()
{
...
...
@@ -63,10 +65,10 @@ void TextFinder::loadTextFile()
}
//! [0]
//! [
1
]
//! [
2
]
void
TextFinder
::
on_findButton_clicked
()
{
QString
searchString
=
ui
->
lineEdit
->
text
();
ui
->
textEdit
->
find
(
searchString
,
QTextDocument
::
FindWholeWords
);
}
//! [
1
]
//! [
2
]
doc/examples/textfinder/textfinder.h
View file @
1e8e1c05
...
...
@@ -47,12 +47,14 @@ public:
TextFinder
(
QWidget
*
parent
=
0
);
~
TextFinder
();
//! [0]
private
slots
:
void
on_findButton_clicked
();
private:
Ui
::
TextFinder
*
ui
;
void
loadTextFile
();
//! [0]
};
#endif // TEXTFINDER_H
doc/qtcreator.qdoc
View file @
1e8e1c05
...
...
@@ -564,15 +564,7 @@
\l{http://doc.trolltech.com/qtextedit.html}{QTextEdit}. This is done with
the following code:
\code
private slots:
void on_findButton_clicked();
private:
Ui::TextFinder *ui;
void loadTextFile();
\endcode
\snippet examples/textfinder/textfinder.h 0
\note The \c{Ui::TextFinder} object is already provided.
\section2 The Source File
...
...
@@ -581,7 +573,7 @@
\c{textfinder.cpp}. We begin by filling in the functionality to load a
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
\l{http://doc.trolltech.com/qfile.html}{QFile}, read it with
...
...
@@ -589,22 +581,20 @@
then display it on \c{textEdit} with
\l{http://doc.trolltech.com/qtextedit.html#plainText-prop}{setPlainText()}
which requires adding the following additional #includes to textfinder.cpp:
\code
#include <QtCore/QFile>
#include <QtCore/QTextStream>
\endcode
\snippet examples/textfinder/textfinder.cpp 1
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
to look for the search string within the text file. The code snippet below
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
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
this line of code:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment