summaryrefslogtreecommitdiff
path: root/src/plugins/help/searchwidget.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2018-11-11 10:08:29 +0100
committerAlessandro Portale <alessandro.portale@qt.io>2018-11-12 11:10:38 +0000
commit901b2be036618f562ecfc3bf48be58830609bfe7 (patch)
treee078d729c33efb6c45dfaa67b8d112fb5e33396e /src/plugins/help/searchwidget.cpp
parent644110f6e03eae18ae9c382465a3f7eb550653a6 (diff)
downloadqt-creator-901b2be036618f562ecfc3bf48be58830609bfe7.tar.gz
HelpPlugin: Modernize
modernize-use-* Change-Id: Ie0058675c1336377326089dbc093436130f1fe03 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/help/searchwidget.cpp')
-rw-r--r--src/plugins/help/searchwidget.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp
index 2f3047064f..ccf120b59a 100644
--- a/src/plugins/help/searchwidget.cpp
+++ b/src/plugins/help/searchwidget.cpp
@@ -55,17 +55,13 @@
using namespace Help::Internal;
-SearchWidget::SearchWidget()
-{
-}
+SearchWidget::SearchWidget() = default;
-SearchWidget::~SearchWidget()
-{
-}
+SearchWidget::~SearchWidget() = default;
void SearchWidget::zoomIn()
{
- QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
+ auto browser = resultWidget->findChild<QTextBrowser*>();
if (browser && zoomCount != 10) {
zoomCount++;
browser->zoomIn();
@@ -74,7 +70,7 @@ void SearchWidget::zoomIn()
void SearchWidget::zoomOut()
{
- QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
+ auto browser = resultWidget->findChild<QTextBrowser*>();
if (browser && zoomCount != -5) {
zoomCount--;
browser->zoomOut();
@@ -86,7 +82,7 @@ void SearchWidget::resetZoom()
if (zoomCount == 0)
return;
- QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
+ auto browser = resultWidget->findChild<QTextBrowser*>();
if (browser) {
browser->zoomOut(zoomCount);
zoomCount = 0;
@@ -102,13 +98,13 @@ void SearchWidget::reindexDocumentation()
void SearchWidget::showEvent(QShowEvent *event)
{
if (!event->spontaneous() && !searchEngine) {
- QVBoxLayout *vLayout = new QVBoxLayout(this);
+ auto vLayout = new QVBoxLayout(this);
vLayout->setMargin(0);
vLayout->setSpacing(0);
searchEngine = new QHelpSearchEngine(&LocalHelpManager::helpEngine(), this);
- Utils::StyledBar *toolbar = new Utils::StyledBar(this);
+ auto toolbar = new Utils::StyledBar(this);
toolbar->setSingleRow(false);
m_queryWidget = searchEngine->queryWidget();
QLayout *tbLayout = new QVBoxLayout();
@@ -120,7 +116,7 @@ void SearchWidget::showEvent(QShowEvent *event)
tbLayout->addWidget(m_indexingDocumentationLabel);
toolbar->setLayout(tbLayout);
- Utils::StyledBar *toolbar2 = new Utils::StyledBar(this);
+ auto toolbar2 = new Utils::StyledBar(this);
toolbar2->setSingleRow(false);
tbLayout = new QVBoxLayout();
tbLayout->setSpacing(0);
@@ -149,7 +145,7 @@ void SearchWidget::showEvent(QShowEvent *event)
connect(searchEngine, &QHelpSearchEngine::searchingFinished, this,
&SearchWidget::searchingFinished);
- QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
+ auto browser = resultWidget->findChild<const QTextBrowser*>();
browser->viewport()->installEventFilter(this);
connect(searchEngine, &QHelpSearchEngine::indexingStarted, this,
@@ -210,10 +206,10 @@ void SearchWidget::indexingFinished()
bool SearchWidget::eventFilter(QObject *o, QEvent *e)
{
- QTextBrowser *browser = resultWidget->findChild<QTextBrowser *>();
+ auto browser = resultWidget->findChild<const QTextBrowser *>();
if (browser && o == browser->viewport()
&& e->type() == QEvent::MouseButtonRelease){
- QMouseEvent *me = static_cast<QMouseEvent *>(e);
+ auto me = static_cast<const QMouseEvent *>(e);
QUrl link = resultWidget->linkAt(me->pos());
if (!link.isEmpty() || link.isValid()) {
bool controlPressed = me->modifiers() & Qt::ControlModifier;
@@ -228,7 +224,7 @@ bool SearchWidget::eventFilter(QObject *o, QEvent *e)
void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
{
- QTextBrowser *browser = resultWidget->findChild<QTextBrowser *>();
+ auto browser = resultWidget->findChild<QTextBrowser *>();
if (!browser)
return;
@@ -280,7 +276,7 @@ SearchSideBarItem::SearchSideBarItem()
QList<QToolButton *> SearchSideBarItem::createToolBarWidgets()
{
- QToolButton *reindexButton = new QToolButton;
+ auto reindexButton = new QToolButton;
reindexButton->setIcon(Utils::Icons::RELOAD.icon());
reindexButton->setToolTip(tr("Regenerate Index"));
connect(reindexButton, &QAbstractButton::clicked,