Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-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
Marco Bubke
flatpak-qt-creator
Commits
a8801d15
Commit
a8801d15
authored
15 years ago
by
kh1
Browse files
Options
Downloads
Patches
Plain Diff
Implement text highlight support after full text search.
parent
6ea66ca3
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
src/plugins/help/helpviewer.h
+1
-1
1 addition, 1 deletion
src/plugins/help/helpviewer.h
src/plugins/help/helpviewer_qtb.cpp
+34
-8
34 additions, 8 deletions
src/plugins/help/helpviewer_qtb.cpp
src/plugins/help/helpviewer_qwv.cpp
+4
-4
4 additions, 4 deletions
src/plugins/help/helpviewer_qwv.cpp
with
39 additions
and
13 deletions
src/plugins/help/helpviewer.h
+
1
−
1
View file @
a8801d15
...
...
@@ -83,7 +83,7 @@ public:
bool
isBackwardAvailable
()
const
;
bool
findText
(
const
QString
&
text
,
Find
::
IFindSupport
::
FindFlags
flags
,
bool
incremental
);
bool
incremental
,
bool
fromSearch
);
static
QString
AboutBlankPage
;
static
QString
PageNotFoundMessage
;
...
...
This diff is collapsed.
Click to expand it.
src/plugins/help/helpviewer_qtb.cpp
+
34
−
8
View file @
a8801d15
...
...
@@ -53,6 +53,13 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent)
:
QTextBrowser
(
parent
)
,
d
(
new
HelpViewerPrivate
(
zoom
))
{
QPalette
p
=
palette
();
p
.
setColor
(
QPalette
::
Inactive
,
QPalette
::
Highlight
,
p
.
color
(
QPalette
::
Active
,
QPalette
::
Highlight
));
p
.
setColor
(
QPalette
::
Inactive
,
QPalette
::
HighlightedText
,
p
.
color
(
QPalette
::
Active
,
QPalette
::
HighlightedText
));
setPalette
(
p
);
installEventFilter
(
this
);
document
()
->
setDocumentMargin
(
8
);
...
...
@@ -173,16 +180,16 @@ bool HelpViewer::isBackwardAvailable() const
}
bool
HelpViewer
::
findText
(
const
QString
&
text
,
IFindSupport
::
FindFlags
flags
,
bool
incremental
)
bool
incremental
,
bool
fromSearch
)
{
QTextDocument
*
doc
=
document
();
QTextCursor
cursor
=
textCursor
();
if
(
!
doc
||
cursor
.
isNull
())
return
false
;
const
int
position
=
cursor
.
selectionStart
();
if
(
incremental
)
cursor
.
setPosition
(
cursor
.
selectionStart
()
);
cursor
.
setPosition
(
position
);
QTextDocument
::
FindFlags
f
=
IFindSupport
::
textDocumentFlagsForFindFlags
(
flags
);
QTextCursor
found
=
doc
->
find
(
text
,
cursor
,
f
);
...
...
@@ -192,14 +199,33 @@ bool HelpViewer::findText(const QString &text, IFindSupport::FindFlags flags,
else
cursor
.
movePosition
(
QTextCursor
::
End
);
found
=
doc
->
find
(
text
,
cursor
,
f
);
if
(
found
.
isNull
())
{
return
false
;
}
if
(
fromSearch
)
{
cursor
.
beginEditBlock
();
viewport
()
->
setUpdatesEnabled
(
false
);
QTextCharFormat
marker
;
marker
.
setForeground
(
Qt
::
red
);
cursor
.
movePosition
(
QTextCursor
::
Start
);
setTextCursor
(
cursor
);
while
(
find
(
text
))
{
QTextCursor
hit
=
textCursor
();
hit
.
mergeCharFormat
(
marker
);
}
viewport
()
->
setUpdatesEnabled
(
true
);
cursor
.
endEditBlock
();
}
if
(
!
found
.
isNull
())
{
setTextCursor
(
found
);
bool
cursorIsNull
=
found
.
isNull
();
if
(
cursorIsNull
)
{
found
=
textCursor
();
found
.
setPosition
(
position
);
}
return
true
;
setTextCursor
(
found
);
return
cursorIsNull
;
}
// -- public slots
...
...
This diff is collapsed.
Click to expand it.
src/plugins/help/helpviewer_qwv.cpp
+
4
−
4
View file @
a8801d15
...
...
@@ -140,8 +140,8 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
}
const
QHelpEngineCore
&
engine
=
HelpManager
::
helpEngineCore
();
const
QByteArray
&
data
=
engine
.
findFile
(
url
).
isValid
()
?
engine
.
fileData
(
url
)
:
HelpViewer
::
PageNotFoundMessage
.
arg
(
url
.
toString
()).
toUtf8
();
const
QByteArray
&
data
=
engine
.
findFile
(
url
).
isValid
()
?
engine
.
fileData
(
url
)
:
HelpViewer
::
PageNotFoundMessage
.
arg
(
url
.
toString
()).
toUtf8
();
return
new
HelpNetworkReply
(
request
,
data
,
mimeType
);
}
...
...
@@ -329,9 +329,9 @@ bool HelpViewer::isBackwardAvailable() const
}
bool
HelpViewer
::
findText
(
const
QString
&
text
,
IFindSupport
::
FindFlags
flags
,
bool
incremental
)
bool
incremental
,
bool
fromSearch
)
{
Q_UNUSED
(
incremental
)
Q_UNUSED
(
(
incremental
&&
fromSearch
)
)
QWebPage
::
FindFlags
options
=
QWebPage
::
FindWrapsAroundDocument
;
if
(
flags
&
Find
::
IFindSupport
::
FindBackward
)
options
|=
QWebPage
::
FindBackward
;
...
...
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