Commit 896714cd authored by Shubham  .'s avatar Shubham .
Browse files

Add code for condition when input string does not exist inside index widget

parent 5cd77f37
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment