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
896714cd
Commit
896714cd
authored
Jul 12, 2020
by
Shubham .
Browse files
Add code for condition when input string does not exist inside index widget
parent
5cd77f37
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/panelplugins/documentationpanel/documentationpanelwidget.cpp
View file @
896714cd
...
...
@@ -158,7 +158,6 @@ DocumentationPanelWidget::DocumentationPanelWidget(Cantor::Session* session, QWi
connect
(
m_engine
->
contentWidget
(),
&
QHelpContentWidget
::
linkActivated
,
this
,
&
DocumentationPanelWidget
::
displayHelp
);
connect
(
m_index
,
&
QHelpIndexWidget
::
linkActivated
,
this
,
&
DocumentationPanelWidget
::
displayHelp
);
//connect(m_search->completer(), QOverload<const QModelIndex&>::of(&QCompleter::activated), this, &DocumentationPanelWidget::changedSelection);
connect
(
m_search
,
&
QLineEdit
::
returnPressed
,
this
,
&
DocumentationPanelWidget
::
returnPressed
);
setSession
(
session
);
...
...
@@ -188,7 +187,23 @@ void DocumentationPanelWidget::returnPressed()
{
const
QString
&
input
=
m_search
->
text
();
if
(
input
.
isEmpty
()
/*| input is not in indexwidget*/
)
auto
model
=
m_index
->
model
();
bool
inputInIndex
=
false
;
for
(
int
row
=
0
;
row
<
model
->
rowCount
();
++
row
)
{
auto
keyword
=
model
->
index
(
row
,
0
);
if
(
keyword
.
data
().
toString
()
==
input
)
{
inputInIndex
=
true
;
qDebug
()
<<
"found"
;
break
;
}
}
if
(
input
.
isEmpty
()
&&
!
inputInIndex
)
return
;
contextSensitiveHelp
(
input
);
...
...
@@ -199,8 +214,6 @@ void DocumentationPanelWidget::contextSensitiveHelp(const QString& keyword)
// First make sure we have display browser as the current widget on the QStackedWidget
emit
activateBrowser
();
qDebug
()
<<
"Context sensitive help for "
<<
keyword
;
m_index
->
filterIndices
(
keyword
);
// filter exactly, no wildcards
m_index
->
activateCurrentItem
();
// this internally emitts the QHelpIndexWidget::linkActivated signal
}
...
...
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