Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Cantor
Commits
02691a83
Commit
02691a83
authored
Jul 13, 2020
by
Shubham .
Browse files
Fix case sensitive search in find text in page widget
parent
6d09f220
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/panelplugins/documentationpanel/documentationpanelwidget.cpp
View file @
02691a83
...
...
@@ -37,6 +37,7 @@
#include <QLabel>
#include <QLineEdit>
#include <QModelIndex>
#include <QPalette>
#include <QPushButton>
#include <QShortcut>
#include <QStandardPaths>
...
...
@@ -130,8 +131,9 @@ DocumentationPanelWidget::DocumentationPanelWidget(Cantor::Session* session, QWi
m_matchCase
=
new
QToolButton
(
this
);
m_matchCase
->
setIcon
(
QIcon
::
fromTheme
(
QLatin1String
(
"format-text-superscript"
)));
m_matchCase
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Match case sensitive"
));
m_matchCase
->
setCheckable
(
true
);
// Create a layout
// Create a layout
for find in text widgets
QHBoxLayout
*
lout
=
new
QHBoxLayout
(
this
);
lout
->
addWidget
(
hideButton
);
lout
->
addWidget
(
label
);
...
...
@@ -208,26 +210,26 @@ DocumentationPanelWidget::DocumentationPanelWidget(Cantor::Session* session, QWi
});
connect
(
findPage
,
&
QPushButton
::
clicked
,
[
=
]{
layout
->
addWidget
(
findPageWidgetContainer
,
2
,
0
,
3
,
0
);
findPageWidgetContainer
->
show
();
layout
->
addWidget
(
findPageWidgetContainer
,
2
,
0
,
3
,
0
);
m_findText
->
clear
();
m_findText
->
setFocus
();
});
connect
(
m_engine
->
contentWidget
(),
&
QHelpContentWidget
::
linkActivated
,
this
,
&
DocumentationPanelWidget
::
displayHelp
);
connect
(
m_index
,
&
QHelpIndexWidget
::
linkActivated
,
this
,
&
DocumentationPanelWidget
::
displayHelp
);
connect
(
m_index
,
&
QHelpIndexWidget
::
activated
,
this
,
&
DocumentationPanelWidget
::
refreshIndexWidget
);
connect
(
m_search
,
&
QLineEdit
::
returnPressed
,
this
,
&
DocumentationPanelWidget
::
returnPressed
);
connect
(
m_search
->
completer
(),
QOverload
<
const
QModelIndex
&>::
of
(
&
QCompleter
::
activated
),
this
,
&
DocumentationPanelWidget
::
returnPressed
);
// connect statements for Find in Page text widget
connect
(
hideButton
,
&
QToolButton
::
clicked
,
this
,
[
=
]{
findPageWidgetContainer
->
hide
();
m_textBrowser
->
findText
(
QString
());
m_textBrowser
->
findText
(
QString
());
// this clears up the selected text
});
connect
(
closeFindBarShortcut
,
&
QShortcut
::
activated
,
this
,
[
=
]{
findPageWidgetContainer
->
hide
();
m_textBrowser
->
findText
(
QString
());
m_textBrowser
->
findText
(
QString
());
// this clears up the selected text
});
connect
(
m_findText
,
&
QLineEdit
::
returnPressed
,
this
,
&
DocumentationPanelWidget
::
searchForward
);
...
...
@@ -235,6 +237,9 @@ DocumentationPanelWidget::DocumentationPanelWidget(Cantor::Session* session, QWi
connect
(
next
,
&
QToolButton
::
clicked
,
this
,
&
DocumentationPanelWidget
::
searchForward
);
connect
(
previous
,
&
QToolButton
::
clicked
,
this
,
&
DocumentationPanelWidget
::
searchBackward
);
connect
(
m_matchCase
,
&
QAbstractButton
::
toggled
,
this
,
&
DocumentationPanelWidget
::
searchForward
);
connect
(
m_matchCase
,
&
QAbstractButton
::
toggled
,
this
,
[
=
]{
m_textBrowser
->
findText
(
QString
());
});
setSession
(
session
);
}
...
...
@@ -293,17 +298,23 @@ void DocumentationPanelWidget::contextSensitiveHelp(const QString& keyword)
m_index
->
activateCurrentItem
();
// this internally emitts the QHelpIndexWidget::linkActivated signal
}
void
DocumentationPanelWidget
::
refreshIndexWidget
()
{
//QHelpIndexWidget* index = m_engine->indexWidget();
m_index
->
filterIndices
(
QString
());
m_index
->
activateCurrentItem
();
}
void
DocumentationPanelWidget
::
searchForward
()
{
m_matchCase
->
isChecked
()
?
m_textBrowser
->
findText
(
m_findText
->
text
(),
QWebEnginePage
::
FindCaseSensitively
)
:
m_textBrowser
->
findText
(
m_findText
->
text
());
/*QPalette *palette = new QPalette();
if(m_textBrowser->selectedText().isEmpty())
{
palette->setColor(QPalette::Base, Qt::red);
m_findText->setPalette(*palette);
}
else
{
palette->setColor(QPalette::Base, Qt::green);
m_findText->setPalette(*palette);
}*/
}
void
DocumentationPanelWidget
::
searchBackward
()
...
...
src/panelplugins/documentationpanel/documentationpanelwidget.h
View file @
02691a83
...
...
@@ -65,7 +65,6 @@ class DocumentationPanelWidget : public QWidget
void
displayHelp
(
const
QUrl
&
);
void
contextSensitiveHelp
(
const
QString
&
);
void
returnPressed
();
void
refreshIndexWidget
();
// SLOTS for Find in Page widget
void
searchForward
();
...
...
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