diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-04-18 10:25:29 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-04-18 11:11:50 +0000 |
commit | 0f090890a99f5bbd244c5537755f5c257b23805e (patch) | |
tree | 1557ee397b6f8482910a8426ad23c9d09d338e2d /src/plugins/help/searchwidget.cpp | |
parent | 3309ed878391a8b61414b0d3ac1b534366791da6 (diff) |
Disable help search widget while indexing documentation
If you try to search while indexing, in the best case you'd get
incomplete results (though with a warning that that is the case), and in
the worst case it crashes because of QTBUG-66816. So just disable the
search widget with info and progress indicator in that case.
Task-number: QTCREATORBUG-20295
Change-Id: Ibec602b1bc0e98f6fef029c6f10c0cdc5197294c
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Diffstat (limited to 'src/plugins/help/searchwidget.cpp')
-rw-r--r-- | src/plugins/help/searchwidget.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index 7d275fa0d54..c3bcd1c314d 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -32,6 +32,7 @@ #include <coreplugin/coreconstants.h> #include <coreplugin/icore.h> #include <coreplugin/progressmanager/progressmanager.h> +#include <utils/progressindicator.h> #include <utils/styledbar.h> #include <utils/utilsicons.h> @@ -43,6 +44,7 @@ #include <QHelpSearchResultWidget> #include <QKeyEvent> #include <QLayout> +#include <QLabel> #include <QMap> #include <QMenu> #include <QRegExp> @@ -112,11 +114,14 @@ void SearchWidget::showEvent(QShowEvent *event) Utils::StyledBar *toolbar = new Utils::StyledBar(this); toolbar->setSingleRow(false); - QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget(); + m_queryWidget = searchEngine->queryWidget(); QLayout *tbLayout = new QVBoxLayout(); tbLayout->setSpacing(6); tbLayout->setMargin(4); - tbLayout->addWidget(queryWidget); + tbLayout->addWidget(m_queryWidget); + m_indexingDocumentationLabel = new QLabel(tr("Indexing Documentation"), toolbar); + m_indexingDocumentationLabel->hide(); + tbLayout->addWidget(m_indexingDocumentationLabel); toolbar->setLayout(tbLayout); Utils::StyledBar *toolbar2 = new Utils::StyledBar(this); @@ -127,12 +132,17 @@ void SearchWidget::showEvent(QShowEvent *event) tbLayout->addWidget(resultWidget = searchEngine->resultWidget()); toolbar2->setLayout(tbLayout); + m_indexingIndicator = new Utils::ProgressIndicator(Utils::ProgressIndicatorSize::Medium, + resultWidget); + m_indexingIndicator->attachToWidget(resultWidget); + m_indexingIndicator->hide(); + vLayout->addWidget(toolbar); vLayout->addWidget(toolbar2); - setFocusProxy(queryWidget); + setFocusProxy(m_queryWidget); - connect(queryWidget, &QHelpSearchQueryWidget::search, this, &SearchWidget::search); + connect(m_queryWidget, &QHelpSearchQueryWidget::search, this, &SearchWidget::search); connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, this, [this](const QUrl &url) { emit linkActivated(url, currentSearchTerms(), false/*newPage*/); @@ -205,6 +215,10 @@ void SearchWidget::indexingStarted() m_watcher.setFuture(m_progress->future()); connect(&m_watcher, &QFutureWatcherBase::canceled, searchEngine, &QHelpSearchEngine::cancelIndexing); + + m_queryWidget->hide(); + m_indexingDocumentationLabel->show(); + m_indexingIndicator->show(); } void SearchWidget::indexingFinished() @@ -213,6 +227,10 @@ void SearchWidget::indexingFinished() delete m_progress; m_progress = NULL; + + m_queryWidget->show(); + m_indexingDocumentationLabel->hide(); + m_indexingIndicator->hide(); } bool SearchWidget::eventFilter(QObject *o, QEvent *e) |