summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/find
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2018-07-21 21:11:46 +0200
committerAlessandro Portale <alessandro.portale@qt.io>2018-08-08 16:04:21 +0000
commitf36f04debabcf839a50c73e47202b24527e89ece (patch)
treeccd98e0c6ae1efb957aae97c12fb1fa4e6ca022b /src/plugins/coreplugin/find
parent86b8164a937afd4c8ef76bcff66eca280e3f7ddc (diff)
downloadqt-creator-f36f04debabcf839a50c73e47202b24527e89ece.tar.gz
Core: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init (partially) Change-Id: Idf10d7ffb1d98a04edc09a25c35e4e9e3abe87b5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/coreplugin/find')
-rw-r--r--src/plugins/coreplugin/find/basetextfind.cpp6
-rw-r--r--src/plugins/coreplugin/find/currentdocumentfind.cpp14
-rw-r--r--src/plugins/coreplugin/find/currentdocumentfind.h2
-rw-r--r--src/plugins/coreplugin/find/findplugin.cpp18
-rw-r--r--src/plugins/coreplugin/find/findtoolbar.cpp36
-rw-r--r--src/plugins/coreplugin/find/findtoolbar.h12
-rw-r--r--src/plugins/coreplugin/find/findtoolwindow.cpp24
-rw-r--r--src/plugins/coreplugin/find/findtoolwindow.h8
-rw-r--r--src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp2
-rw-r--r--src/plugins/coreplugin/find/ifindsupport.h2
-rw-r--r--src/plugins/coreplugin/find/itemviewfind.cpp2
-rw-r--r--src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp2
-rw-r--r--src/plugins/coreplugin/find/searchresulttreeitemdelegate.h4
-rw-r--r--src/plugins/coreplugin/find/searchresulttreeitems.cpp6
-rw-r--r--src/plugins/coreplugin/find/searchresulttreeitems.h2
-rw-r--r--src/plugins/coreplugin/find/searchresulttreemodel.cpp8
-rw-r--r--src/plugins/coreplugin/find/searchresulttreemodel.h12
-rw-r--r--src/plugins/coreplugin/find/searchresulttreeview.cpp2
-rw-r--r--src/plugins/coreplugin/find/searchresulttreeview.h2
-rw-r--r--src/plugins/coreplugin/find/searchresultwidget.cpp22
-rw-r--r--src/plugins/coreplugin/find/searchresultwidget.h4
-rw-r--r--src/plugins/coreplugin/find/searchresultwindow.cpp12
22 files changed, 100 insertions, 102 deletions
diff --git a/src/plugins/coreplugin/find/basetextfind.cpp b/src/plugins/coreplugin/find/basetextfind.cpp
index f0b3ad64c3..b9c38b3a5e 100644
--- a/src/plugins/coreplugin/find/basetextfind.cpp
+++ b/src/plugins/coreplugin/find/basetextfind.cpp
@@ -111,7 +111,7 @@ void BaseTextFind::setTextCursor(const QTextCursor &cursor)
QTextDocument *BaseTextFind::document() const
{
- QTC_ASSERT(d->m_editor || d->m_plaineditor, return 0);
+ QTC_ASSERT(d->m_editor || d->m_plaineditor, return nullptr);
return d->m_editor ? d->m_editor->document() : d->m_plaineditor->document();
}
@@ -140,7 +140,7 @@ void BaseTextFind::resetIncrementalSearch()
void BaseTextFind::clearHighlights()
{
- highlightAll(QString(), 0);
+ highlightAll(QString(), nullptr);
}
QString BaseTextFind::currentFindString() const
@@ -191,7 +191,7 @@ IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, FindFlags
if (found)
highlightAll(txt, findFlags);
else
- highlightAll(QString(), 0);
+ highlightAll(QString(), nullptr);
return found ? Found : NotFound;
}
diff --git a/src/plugins/coreplugin/find/currentdocumentfind.cpp b/src/plugins/coreplugin/find/currentdocumentfind.cpp
index eca3527bac..834b651ce7 100644
--- a/src/plugins/coreplugin/find/currentdocumentfind.cpp
+++ b/src/plugins/coreplugin/find/currentdocumentfind.cpp
@@ -40,7 +40,7 @@ using namespace Core;
using namespace Core::Internal;
CurrentDocumentFind::CurrentDocumentFind()
- : m_currentFind(0)
+ : m_currentFind(nullptr)
{
connect(qApp, &QApplication::focusChanged,
this, &CurrentDocumentFind::updateCandidateFindFilter);
@@ -48,7 +48,7 @@ CurrentDocumentFind::CurrentDocumentFind()
void CurrentDocumentFind::removeConnections()
{
- disconnect(qApp, 0, this, 0);
+ disconnect(qApp, nullptr, this, nullptr);
removeFindSupportConnections();
}
@@ -82,7 +82,7 @@ bool CurrentDocumentFind::supportsReplace() const
FindFlags CurrentDocumentFind::supportedFindFlags() const
{
- QTC_ASSERT(m_currentFind, return 0);
+ QTC_ASSERT(m_currentFind, return nullptr);
return m_currentFind->supportedFindFlags();
}
@@ -134,7 +134,7 @@ int CurrentDocumentFind::replaceAll(const QString &before, const QString &after,
QTC_CHECK(m_currentWidget);
int count = m_currentFind->replaceAll(before, after, findFlags);
Utils::FadingIndicator::showText(m_currentWidget,
- tr("%n occurrences replaced.", 0, count),
+ tr("%n occurrences replaced.", nullptr, count),
Utils::FadingIndicator::SmallText);
return count;
}
@@ -155,7 +155,7 @@ void CurrentDocumentFind::updateCandidateFindFilter(QWidget *old, QWidget *now)
{
Q_UNUSED(old)
QWidget *candidate = now;
- QPointer<IFindSupport> impl = 0;
+ QPointer<IFindSupport> impl = nullptr;
while (!impl && candidate) {
impl = Aggregation::query<IFindSupport>(candidate);
if (!impl)
@@ -215,8 +215,8 @@ void CurrentDocumentFind::removeFindSupportConnections()
void CurrentDocumentFind::clearFindSupport()
{
removeFindSupportConnections();
- m_currentWidget = 0;
- m_currentFind = 0;
+ m_currentWidget = nullptr;
+ m_currentFind = nullptr;
emit changed();
}
diff --git a/src/plugins/coreplugin/find/currentdocumentfind.h b/src/plugins/coreplugin/find/currentdocumentfind.h
index a0d40d8706..32aa5b97f8 100644
--- a/src/plugins/coreplugin/find/currentdocumentfind.h
+++ b/src/plugins/coreplugin/find/currentdocumentfind.h
@@ -61,7 +61,7 @@ public:
void removeConnections();
bool setFocusToCurrentFindSupport();
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
signals:
void changed();
diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp
index dad9776247..3fcc8fa14b 100644
--- a/src/plugins/coreplugin/find/findplugin.cpp
+++ b/src/plugins/coreplugin/find/findplugin.cpp
@@ -181,24 +181,24 @@ public:
void setupFilterMenuItems();
void readSettings();
- Internal::CurrentDocumentFind *m_currentDocumentFind = 0;
- Internal::FindToolBar *m_findToolBar = 0;
- Internal::FindToolWindow *m_findDialog = 0;
- SearchResultWindow *m_searchResultWindow = 0;
+ Internal::CurrentDocumentFind *m_currentDocumentFind = nullptr;
+ Internal::FindToolBar *m_findToolBar = nullptr;
+ Internal::FindToolWindow *m_findDialog = nullptr;
+ SearchResultWindow *m_searchResultWindow = nullptr;
FindFlags m_findFlags;
CompletionModel m_findCompletionModel;
QStringListModel m_replaceCompletionModel;
QStringList m_replaceCompletions;
- QAction *m_openFindDialog = 0;
+ QAction *m_openFindDialog = nullptr;
};
-Find *m_instance = 0;
-FindPrivate *d = 0;
+Find *m_instance = nullptr;
+FindPrivate *d = nullptr;
void Find::destroy()
{
delete m_instance;
- m_instance = 0;
+ m_instance = nullptr;
if (d) {
delete d->m_currentDocumentFind;
delete d->m_findToolBar;
@@ -245,7 +245,7 @@ void Find::extensionsInitialized()
void Find::aboutToShutdown()
{
d->m_findToolBar->setVisible(false);
- d->m_findToolBar->setParent(0);
+ d->m_findToolBar->setParent(nullptr);
d->m_currentDocumentFind->removeConnections();
}
diff --git a/src/plugins/coreplugin/find/findtoolbar.cpp b/src/plugins/coreplugin/find/findtoolbar.cpp
index 793b2990f8..e1aee5b9a7 100644
--- a/src/plugins/coreplugin/find/findtoolbar.cpp
+++ b/src/plugins/coreplugin/find/findtoolbar.cpp
@@ -121,26 +121,26 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
static_cast<void (QCompleter::*)(const QModelIndex &)>(&QCompleter::activated),
this, &FindToolBar::findCompleterActivated);
- QAction *shiftEnterAction = new QAction(m_ui.findEdit);
+ auto shiftEnterAction = new QAction(m_ui.findEdit);
shiftEnterAction->setShortcut(QKeySequence(tr("Shift+Enter")));
shiftEnterAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftEnterAction, &QAction::triggered,
this, &FindToolBar::invokeFindPrevious);
m_ui.findEdit->addAction(shiftEnterAction);
- QAction *shiftReturnAction = new QAction(m_ui.findEdit);
+ auto shiftReturnAction = new QAction(m_ui.findEdit);
shiftReturnAction->setShortcut(QKeySequence(tr("Shift+Return")));
shiftReturnAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftReturnAction, &QAction::triggered,
this, &FindToolBar::invokeFindPrevious);
m_ui.findEdit->addAction(shiftReturnAction);
- QAction *shiftEnterReplaceAction = new QAction(m_ui.replaceEdit);
+ auto shiftEnterReplaceAction = new QAction(m_ui.replaceEdit);
shiftEnterReplaceAction->setShortcut(QKeySequence(tr("Shift+Enter")));
shiftEnterReplaceAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftEnterReplaceAction, &QAction::triggered,
this, &FindToolBar::invokeReplacePrevious);
m_ui.replaceEdit->addAction(shiftEnterReplaceAction);
- QAction *shiftReturnReplaceAction = new QAction(m_ui.replaceEdit);
+ auto shiftReturnReplaceAction = new QAction(m_ui.replaceEdit);
shiftReturnReplaceAction->setShortcut(QKeySequence(tr("Shift+Return")));
shiftReturnReplaceAction->setShortcutContext(Qt::WidgetShortcut);
connect(shiftReturnReplaceAction, &QAction::triggered,
@@ -313,9 +313,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
connect(&m_findStepTimer, &QTimer::timeout, this, &FindToolBar::invokeFindStep);
}
-FindToolBar::~FindToolBar()
-{
-}
+FindToolBar::~FindToolBar() = default;
void FindToolBar::findCompleterActivated(const QModelIndex &index)
{
@@ -342,7 +340,7 @@ void FindToolBar::installEventFilters()
bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ auto ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Down) {
if (obj == m_ui.findEdit) {
if (m_ui.findEdit->text().isEmpty())
@@ -358,7 +356,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
if ((obj == m_ui.findEdit || obj == m_findCompleter->popup())
&& event->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ auto ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Space && (ke->modifiers() & Utils::HostOsInfo::controlModifier())) {
QString completedText = m_currentDocumentFind->completedFindString();
if (!completedText.isEmpty()) {
@@ -368,7 +366,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
}
}
} else if (obj == this && event->type() == QEvent::ShortcutOverride) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ auto ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Space && (ke->modifiers() & Utils::HostOsInfo::controlModifier())) {
event->accept();
return true;
@@ -394,7 +392,7 @@ void FindToolBar::adaptToCandidate()
void FindToolBar::updateGlobalActions()
{
IFindSupport *candidate = m_currentDocumentFind->candidate();
- bool enabled = (candidate != 0);
+ bool enabled = (candidate != nullptr);
bool replaceEnabled = enabled && candidate->supportsReplace();
m_findInDocumentAction->setEnabled(enabled || (toolBarHasFocus() && isEnabled()));
m_findNextSelectedAction->setEnabled(enabled);
@@ -670,7 +668,7 @@ void FindToolBar::findFlagsChanged()
void FindToolBar::findEditButtonClicked()
{
- OptionsPopup *popup = new OptionsPopup(m_ui.findEdit);
+ auto popup = new OptionsPopup(m_ui.findEdit);
popup->show();
}
@@ -753,7 +751,7 @@ FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const
}
candidate = candidate->parentWidget();
}
- return 0;
+ return nullptr;
}
bool FindToolBar::toolBarHasFocus() const
@@ -826,7 +824,7 @@ void FindToolBar::openFindToolBar(OpenFlags flags)
FindToolBarPlaceHolder *previousHolder = FindToolBarPlaceHolder::getCurrent();
if (previousHolder != holder) {
if (previousHolder)
- previousHolder->setWidget(0);
+ previousHolder->setWidget(nullptr);
holder->setWidget(this);
FindToolBarPlaceHolder::setCurrent(holder);
}
@@ -987,7 +985,7 @@ OptionsPopup::OptionsPopup(QWidget *parent)
: QWidget(parent, Qt::Popup)
{
setAttribute(Qt::WA_DeleteOnClose);
- QVBoxLayout *layout = new QVBoxLayout(this);
+ auto layout = new QVBoxLayout(this);
layout->setContentsMargins(2, 2, 2, 2);
layout->setSpacing(2);
setLayout(layout);
@@ -1003,7 +1001,7 @@ OptionsPopup::OptionsPopup(QWidget *parent)
bool OptionsPopup::event(QEvent *ev)
{
if (ev->type() == QEvent::ShortcutOverride) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(ev);
+ auto ke = static_cast<QKeyEvent *>(ev);
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
ev->accept();
return true;
@@ -1014,9 +1012,9 @@ bool OptionsPopup::event(QEvent *ev)
bool OptionsPopup::eventFilter(QObject *obj, QEvent *ev)
{
- QCheckBox *checkbox = qobject_cast<QCheckBox *>(obj);
+ auto checkbox = qobject_cast<QCheckBox *>(obj);
if (ev->type() == QEvent::KeyPress && checkbox) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(ev);
+ auto ke = static_cast<QKeyEvent *>(ev);
if (!ke->modifiers() && (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return)) {
checkbox->click();
ev->accept();
@@ -1028,7 +1026,7 @@ bool OptionsPopup::eventFilter(QObject *obj, QEvent *ev)
void OptionsPopup::actionChanged()
{
- QAction *action = qobject_cast<QAction *>(sender());
+ auto action = qobject_cast<QAction *>(sender());
QTC_ASSERT(action, return);
QCheckBox *checkbox = m_checkboxMap.value(action);
QTC_ASSERT(checkbox, return);
diff --git a/src/plugins/coreplugin/find/findtoolbar.h b/src/plugins/coreplugin/find/findtoolbar.h
index c1c78e6bcc..1095317682 100644
--- a/src/plugins/coreplugin/find/findtoolbar.h
+++ b/src/plugins/coreplugin/find/findtoolbar.h
@@ -51,8 +51,8 @@ public:
explicit OptionsPopup(QWidget *parent);
protected:
- bool event(QEvent *ev);
- bool eventFilter(QObject *obj, QEvent *ev);
+ bool event(QEvent *ev) override;
+ bool eventFilter(QObject *obj, QEvent *ev) override;
private:
void actionChanged();
@@ -77,7 +77,7 @@ public:
Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
explicit FindToolBar(CurrentDocumentFind *currentDocumentFind);
- ~FindToolBar();
+ ~FindToolBar() override;
void readSettings();
void writeSettings();
@@ -91,8 +91,8 @@ public slots:
void setBackward(bool backward);
protected:
- bool focusNextPrevChild(bool next);
- void resizeEvent(QResizeEvent *event);
+ bool focusNextPrevChild(bool next) override;
+ void resizeEvent(QResizeEvent *event) override;
private:
void invokeFindNext();
@@ -147,7 +147,7 @@ private:
void acceptCandidateAndMoveToolBar();
void indicateSearchState(IFindSupport::Result searchState);
- bool eventFilter(QObject *obj, QEvent *event);
+ bool eventFilter(QObject *obj, QEvent *event) override;
void setFindText(const QString &text);
QString getFindText();
QString getReplaceText();
diff --git a/src/plugins/coreplugin/find/findtoolwindow.cpp b/src/plugins/coreplugin/find/findtoolwindow.cpp
index 7bb01b67a3..85897fb8ae 100644
--- a/src/plugins/coreplugin/find/findtoolwindow.cpp
+++ b/src/plugins/coreplugin/find/findtoolwindow.cpp
@@ -41,7 +41,7 @@
using namespace Core;
using namespace Core::Internal;
-static FindToolWindow *m_instance = 0;
+static FindToolWindow *m_instance = nullptr;
static bool validateRegExp(Utils::FancyLineEdit *edit, QString *errorMessage)
{
@@ -63,8 +63,8 @@ static bool validateRegExp(Utils::FancyLineEdit *edit, QString *errorMessage)
FindToolWindow::FindToolWindow(QWidget *parent)
: QWidget(parent),
m_findCompleter(new QCompleter(this)),
- m_currentFilter(0),
- m_configWidget(0)
+ m_currentFilter(nullptr),
+ m_configWidget(nullptr)
{
m_instance = this;
m_ui.setupUi(this);
@@ -93,7 +93,7 @@ FindToolWindow::FindToolWindow(QWidget *parent)
connect(m_ui.searchTerm, &Utils::FancyLineEdit::validChanged,
this, &FindToolWindow::updateButtonStates);
- QVBoxLayout *layout = new QVBoxLayout;
+ auto layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
m_ui.configWidget->setLayout(layout);
@@ -115,7 +115,7 @@ FindToolWindow *FindToolWindow::instance()
bool FindToolWindow::event(QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ auto ke = static_cast<QKeyEvent *>(event);
if ((ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
&& (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::KeypadModifier)) {
ke->accept();
@@ -130,7 +130,7 @@ bool FindToolWindow::event(QEvent *event)
bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_ui.searchTerm && event->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
+ auto ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Down) {
if (m_ui.searchTerm->text().isEmpty())
m_findCompleter->setCompletionPrefix(QString());
@@ -247,12 +247,12 @@ void FindToolWindow::setCurrentFilter(int index)
m_ui.configWidget->layout()->addWidget(m_configWidget);
} else {
if (configWidget)
- configWidget->setParent(0);
+ configWidget->setParent(nullptr);
}
}
QWidget *w = m_ui.configWidget;
while (w) {
- QScrollArea *sa = qobject_cast<QScrollArea *>(w);
+ auto sa = qobject_cast<QScrollArea *>(w);
if (sa) {
sa->updateGeometry();
break;
@@ -268,7 +268,7 @@ void FindToolWindow::setCurrentFilter(int index)
void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)
{
QTC_ASSERT(filter, return);
- *filter = 0;
+ *filter = nullptr;
Find::updateFindCompletion(m_ui.searchTerm->text());
int index = m_ui.filterList->currentIndex();
QString searchTerm = m_ui.searchTerm->text();
@@ -277,13 +277,13 @@ void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)
if (term)
*term = searchTerm;
if (searchTerm.isEmpty() && *filter && !(*filter)->isValid())
- *filter = 0;
+ *filter = nullptr;
}
void FindToolWindow::search()
{
QString term;
- IFindFilter *filter = 0;
+ IFindFilter *filter = nullptr;
acceptAndGetParameters(&term, &filter);
QTC_ASSERT(filter, return);
filter->findAll(term, Find::findFlags());
@@ -292,7 +292,7 @@ void FindToolWindow::search()
void FindToolWindow::replace()
{
QString term;
- IFindFilter *filter = 0;
+ IFindFilter *filter = nullptr;
acceptAndGetParameters(&term, &filter);
QTC_ASSERT(filter, return);
filter->replaceAll(term, Find::findFlags());
diff --git a/src/plugins/coreplugin/find/findtoolwindow.h b/src/plugins/coreplugin/find/findtoolwindow.h
index 10097f1e80..91db0bd4db 100644
--- a/src/plugins/coreplugin/find/findtoolwindow.h
+++ b/src/plugins/coreplugin/find/findtoolwindow.h
@@ -42,8 +42,8 @@ class FindToolWindow : public QWidget
Q_OBJECT
public:
- explicit FindToolWindow(QWidget *parent = 0);
- ~FindToolWindow();
+ explicit FindToolWindow(QWidget *parent = nullptr);
+ ~FindToolWindow() override;
static FindToolWindow *instance();
void setFindFilters(const QList<IFindFilter *> &filters);
@@ -55,8 +55,8 @@ public:
void writeSettings();
protected:
- bool event(QEvent *event);
- bool eventFilter(QObject *obj, QEvent *event);
+ bool event(QEvent *event) override;
+ bool eventFilter(QObject *obj, QEvent *event) override;
private:
void search();
diff --git a/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp b/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp
index e9c8b237ae..c760460fac 100644
--- a/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp
+++ b/src/plugins/coreplugin/find/highlightscrollbarcontroller.cpp
@@ -204,7 +204,7 @@ void HighlightScrollBarOverlay::drawHighlights(QPainter *painter,
const QColor &color = creatorTheme()->color(itColor.key());
const QMap<int, int> &positions = itColor.value();
const auto itPosEnd = positions.constEnd();
- const int firstPos = int(docStart / lineHeight);
+ const auto firstPos = int(docStart / lineHeight);
auto itPos = positions.upperBound(firstPos);
if (itPos != positions.constBegin())
--itPos;
diff --git a/src/plugins/coreplugin/find/ifindsupport.h b/src/plugins/coreplugin/find/ifindsupport.h
index 384caddf27..213e1feb0d 100644
--- a/src/plugins/coreplugin/find/ifindsupport.h
+++ b/src/plugins/coreplugin/find/ifindsupport.h
@@ -40,7 +40,7 @@ public:
enum Result { Found, NotFound, NotYetFound };
IFindSupport() : QObject(nullptr) {}
- ~IFindSupport() override {}
+ ~IFindSupport() override = default;
virtual bool supportsReplace() const = 0;
virtual FindFlags supportedFindFlags() const = 0;
diff --git a/src/plugins/coreplugin/find/itemviewfind.cpp b/src/plugins/coreplugin/find/itemviewfind.cpp
index cc2dd466e5..13174c8cd9 100644
--- a/src/plugins/coreplugin/find/itemviewfind.cpp
+++ b/src/plugins/coreplugin/find/itemviewfind.cpp
@@ -230,7 +230,7 @@ IFindSupport::Result ItemViewFind::find(const QString &searchTxt,
d->m_view->setCurrentIndex(resultIndex);
d->m_view->scrollTo(resultIndex);
if (resultIndex.parent().isValid())
- if (QTreeView *treeView = qobject_cast<QTreeView *>(d->m_view))
+ if (auto treeView = qobject_cast<QTreeView *>(d->m_view))
treeView->expand(resultIndex.parent());
if (wrapped)
*wrapped = anyWrapped;
diff --git a/src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp
index de67e62b99..81ec2541c6 100644
--- a/src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp
+++ b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.cpp
@@ -134,7 +134,7 @@ int SearchResultTreeItemDelegate::drawLineNumber(QPainter *painter, const QStyle
opt.palette.setColor(cg, QPalette::Text, Qt::darkGray);
const QStyle *style = QApplication::style();
- const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
+ const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, nullptr) + 1;
const QRect rowRect = lineNumberAreaRect.adjusted(-textMargin, 0, textMargin-lineNumberAreaHorizontalPadding, 0);
QItemDelegate::drawDisplay(painter, opt, rowRect, lineText);
diff --git a/src/plugins/coreplugin/find/searchresulttreeitemdelegate.h b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.h
index 99e05c2248..0551e4c8d7 100644
--- a/src/plugins/coreplugin/find/searchresulttreeitemdelegate.h
+++ b/src/plugins/coreplugin/find/searchresulttreeitemdelegate.h
@@ -33,8 +33,8 @@ namespace Internal {
class SearchResultTreeItemDelegate: public QItemDelegate
{
public:
- SearchResultTreeItemDelegate(int tabWidth, QObject *parent = 0);
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ SearchResultTreeItemDelegate(int tabWidth, QObject *parent = nullptr);
+ void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void setTabWidth(int width);
private:
diff --git a/src/plugins/coreplugin/find/searchresulttreeitems.cpp b/src/plugins/coreplugin/find/searchresulttreeitems.cpp
index e87681023b..51d6f9ced8 100644
--- a/src/plugins/coreplugin/find/searchresulttreeitems.cpp
+++ b/src/plugins/coreplugin/find/searchresulttreeitems.cpp
@@ -44,7 +44,7 @@ SearchResultTreeItem::~SearchResultTreeItem()
bool SearchResultTreeItem::isLeaf() const
{
- return childrenCount() == 0 && parent() != 0;
+ return childrenCount() == 0 && parent() != nullptr;
}
Qt::CheckState SearchResultTreeItem::checkState() const
@@ -96,7 +96,7 @@ int SearchResultTreeItem::insertionIndex(const QString &text, SearchResultTreeIt
if (insertionPosition != m_children.end() && (*insertionPosition)->item.text == text)
(*existingItem) = (*insertionPosition);
else
- *existingItem = 0;
+ *existingItem = nullptr;
}
return insertionPosition - m_children.begin();
}
@@ -113,7 +113,7 @@ void SearchResultTreeItem::insertChild(int index, SearchResultTreeItem *child)
void SearchResultTreeItem::insertChild(int index, const SearchResultItem &item)
{
- SearchResultTreeItem *child = new SearchResultTreeItem(item, this);
+ auto child = new SearchResultTreeItem(item, this);
insertChild(index, child);
}
diff --git a/src/plugins/coreplugin/find/searchresulttreeitems.h b/src/plugins/coreplugin/find/searchresulttreeitems.h
index 1709bc11d0..d4aa10f4ca 100644
--- a/src/plugins/coreplugin/find/searchresulttreeitems.h
+++ b/src/plugins/coreplugin/find/searchresulttreeitems.h
@@ -37,7 +37,7 @@ class SearchResultTreeItem
{
public:
explicit SearchResultTreeItem(const SearchResultItem &item = SearchResultItem(),
- SearchResultTreeItem *parent = NULL);
+ SearchResultTreeItem *parent = nullptr);
virtual ~SearchResultTreeItem();
bool isLeaf() const;
diff --git a/src/plugins/coreplugin/find/searchresulttreemodel.cpp b/src/plugins/coreplugin/find/searchresulttreemodel.cpp
index a60b46553c..ea2c5ae9df 100644
--- a/src/plugins/coreplugin/find/searchresulttreemodel.cpp
+++ b/src/plugins/coreplugin/find/searchresulttreemodel.cpp
@@ -37,7 +37,7 @@ using namespace Core::Internal;
SearchResultTreeModel::SearchResultTreeModel(QObject *parent)
: QAbstractItemModel(parent)
- , m_currentParent(0)
+ , m_currentParent(nullptr)
, m_showReplaceUI(false)
, m_editorFontIsUsed(false)
{
@@ -178,7 +178,7 @@ QVariant SearchResultTreeModel::data(const QModelIndex &idx, int role) const
bool SearchResultTreeModel::setData(const QModelIndex &idx, const QVariant &value, int role)
{
if (role == Qt::CheckStateRole) {
- Qt::CheckState checkState = static_cast<Qt::CheckState>(value.toInt());
+ auto checkState = static_cast<Qt::CheckState>(value.toInt());
return setCheckState(idx, checkState);
}
return QAbstractItemModel::setData(idx, value, role);
@@ -308,7 +308,7 @@ QSet<SearchResultTreeItem *> SearchResultTreeModel::addPath(const QStringList &p
QSet<SearchResultTreeItem *> pathNodes;
SearchResultTreeItem *currentItem = m_rootItem;
QModelIndex currentItemIndex = QModelIndex();
- SearchResultTreeItem *partItem = 0;
+ SearchResultTreeItem *partItem = nullptr;
QStringList currentPath;
foreach (const QString &part, path) {
const int insertionIndex = currentItem->insertionIndex(part, &partItem);
@@ -418,7 +418,7 @@ QList<QModelIndex> SearchResultTreeModel::addResults(const QList<SearchResultIte
void SearchResultTreeModel::clear()
{
beginResetModel();
- m_currentParent = NULL;
+ m_currentParent = nullptr;
m_rootItem->clearChildren();
m_editorFontIsUsed = false;
endResetModel();
diff --git a/src/plugins/coreplugin/find/searchresulttreemodel.h b/src/plugins/coreplugin/find/searchresulttreemodel.h
index 9eeb10eec3..a8514e74c3 100644
--- a/src/plugins/coreplugin/find/searchresulttreemodel.h
+++ b/src/plugins/coreplugin/find/searchresulttreemodel.h
@@ -41,8 +41,8 @@ class SearchResultTreeModel : public QAbstractItemModel
Q_OBJECT
public:
- SearchResultTreeModel(QObject *parent = 0);
- ~SearchResultTreeModel();
+ SearchResultTreeModel(QObject *parent = nullptr);
+ ~SearchResultTreeModel() override;
void setShowReplaceUI(bool show);
void setTextEditorFont(const QFont &font, const SearchResultColor &color);
@@ -56,8 +56,8 @@ public:
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
- QModelIndex next(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = 0) const;
- QModelIndex prev(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = 0) const;
+ QModelIndex next(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = nullptr) const;
+ QModelIndex prev(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = nullptr) const;
QList<QModelIndex> addResults(const QList<SearchResultItem> &items, SearchResult::AddMode mode);
@@ -74,8 +74,8 @@ private:
QSet<SearchResultTreeItem *> addPath(const QStringList &path);
QVariant data(const SearchResultTreeItem *row, int role) const;
bool setCheckState(const QModelIndex &idx, Qt::CheckState checkState, bool firstCall = true);
- QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped = 0) const;
- QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped = 0) const;
+ QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
+ QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
SearchResultTreeItem *treeItemAtIndex(const QModelIndex &idx) const;
SearchResultTreeItem *m_rootItem;
diff --git a/src/plugins/coreplugin/find/searchresulttreeview.cpp b/src/plugins/coreplugin/find/searchresulttreeview.cpp
index a8a3d3ba69..6a9b7067bf 100644
--- a/src/plugins/coreplugin/find/searchresulttreeview.cpp
+++ b/src/plugins/coreplugin/find/searchresulttreeview.cpp
@@ -89,7 +89,7 @@ void SearchResultTreeView::emitJumpToSearchResult(const QModelIndex &index)
void SearchResultTreeView::setTabWidth(int tabWidth)
{
- SearchResultTreeItemDelegate *delegate = static_cast<SearchResultTreeItemDelegate *>(itemDelegate());
+ auto delegate = static_cast<SearchResultTreeItemDelegate *>(itemDelegate());
delegate->setTabWidth(tabWidth);
doItemsLayout();
}
diff --git a/src/plugins/coreplugin/find/searchresulttreeview.h b/src/plugins/coreplugin/find/searchresulttreeview.h
index bf80cba1ad..961940fe01 100644
--- a/src/plugins/coreplugin/find/searchresulttreeview.h
+++ b/src/plugins/coreplugin/find/searchresulttreeview.h
@@ -40,7 +40,7 @@ class SearchResultTreeView : public Utils::TreeView
Q_OBJECT
public:
- explicit SearchResultTreeView(QWidget *parent = 0);
+ explicit SearchResultTreeView(QWidget *parent = nullptr);
void setAutoExpandResults(bool expand);
void setTextEditorFont(const QFont &font, const SearchResultColor &color);
diff --git a/src/plugins/coreplugin/find/searchresultwidget.cpp b/src/plugins/coreplugin/find/searchresultwidget.cpp
index d22531954d..9428a31a1d 100644
--- a/src/plugins/coreplugin/find/searchresultwidget.cpp
+++ b/src/plugins/coreplugin/find/searchresultwidget.cpp
@@ -69,7 +69,7 @@ public:
}
- QSize sizeHint() const
+ QSize sizeHint() const override
{
QSize sh = QLineEdit::minimumSizeHint();
sh.rwidth() += qMax(25 * fontMetrics().width(QLatin1Char('x')),
@@ -81,7 +81,7 @@ public:
SearchResultWidget::SearchResultWidget(QWidget *parent) :
QWidget(parent)
{
- QVBoxLayout *layout = new QVBoxLayout(this);
+ auto layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
setLayout(layout);
@@ -122,7 +122,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
m_messageWidget->setLineWidth(1);
}
m_messageWidget->setAutoFillBackground(true);
- QHBoxLayout *messageLayout = new QHBoxLayout(m_messageWidget);
+ auto messageLayout = new QHBoxLayout(m_messageWidget);
messageLayout->setMargin(2);
m_messageWidget->setLayout(messageLayout);
QLabel *messageLabel = new QLabel(tr("Search was canceled."));
@@ -134,7 +134,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
m_searchResultTreeView = new SearchResultTreeView(this);
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
- Aggregation::Aggregate * agg = new Aggregation::Aggregate;
+ auto agg = new Aggregation::Aggregate;
agg->add(m_searchResultTreeView);
agg->add(new ItemViewFind(m_searchResultTreeView,
ItemDataRoles::ResultLineRole));
@@ -144,7 +144,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
m_infoBarDisplay.setInfoBar(&m_infoBar);
m_descriptionContainer = new QWidget(topFindWidget);
- QHBoxLayout *descriptionLayout = new QHBoxLayout(m_descriptionContainer);
+ auto descriptionLayout = new QHBoxLayout(m_descriptionContainer);
m_descriptionContainer->setLayout(descriptionLayout);
descriptionLayout->setMargin(0);
m_descriptionContainer->setMinimumWidth(200);
@@ -282,7 +282,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
emit paused(true);
InfoBarEntry info(sizeWarningId,
tr("The search resulted in more than %n items, do you still want to continue?",
- 0, SEARCHRESULT_WARNING_LIMIT));
+ nullptr, SEARCHRESULT_WARNING_LIMIT));
info.setCancelButtonInfo(tr("Cancel"), [this]() { cancelAfterSizeWarning(); });
info.setCustomButtonInfo(tr("Continue"), [this]() { continueAfterSizeWarning(); });
m_infoBar.addInfo(info);
@@ -499,12 +499,12 @@ QList<SearchResultItem> SearchResultWidget::checkedItems() const
const int fileCount = model->rowCount();
for (int i = 0; i < fileCount; ++i) {
QModelIndex fileIndex = model->index(i, 0);
- SearchResultTreeItem *fileItem = static_cast<SearchResultTreeItem *>(fileIndex.internalPointer());
- QTC_ASSERT(fileItem != 0, continue);
+ auto fileItem = static_cast<SearchResultTreeItem *>(fileIndex.internalPointer());
+ QTC_ASSERT(fileItem != nullptr, continue);
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
QModelIndex textIndex = model->index(rowIndex, 0, fileIndex);
- SearchResultTreeItem *rowItem = static_cast<SearchResultTreeItem *>(textIndex.internalPointer());
- QTC_ASSERT(rowItem != 0, continue);
+ auto rowItem = static_cast<SearchResultTreeItem *>(textIndex.internalPointer());
+ QTC_ASSERT(rowItem != nullptr, continue);
if (rowItem->checkState())
result << rowItem->item;
}
@@ -517,7 +517,7 @@ void SearchResultWidget::updateMatchesFoundLabel()
if (m_count == 0)
m_matchesFoundLabel->setText(tr("No matches found."));
else
- m_matchesFoundLabel->setText(tr("%n matches found.", 0, m_count));
+ m_matchesFoundLabel->setText(tr("%n matches found.", nullptr, m_count));
}
} // namespace Internal
diff --git a/src/plugins/coreplugin/find/searchresultwidget.h b/src/plugins/coreplugin/find/searchresultwidget.h
index 5309ed69e1..22193a231e 100644
--- a/src/plugins/coreplugin/find/searchresultwidget.h
+++ b/src/plugins/coreplugin/find/searchresultwidget.h
@@ -49,8 +49,8 @@ class SearchResultWidget : public QWidget
{
Q_OBJECT
public:
- explicit SearchResultWidget(QWidget *parent = 0);
- ~SearchResultWidget();
+ explicit SearchResultWidget(QWidget *parent = nullptr);
+ ~SearchResultWidget() override;
void setInfo(const QString &label, const QString &toolTip, const QString &term);
QWidget *additionalReplaceWidget() const;
diff --git a/src/plugins/coreplugin/find/searchresultwindow.cpp b/src/plugins/coreplugin/find/searchresultwindow.cpp
index 7c790df2fa..7cea0166d1 100644
--- a/src/plugins/coreplugin/find/searchresultwindow.cpp
+++ b/src/plugins/coreplugin/find/searchresultwindow.cpp
@@ -67,7 +67,7 @@ namespace Internal {
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
}
- QSize sizeHint() const
+ QSize sizeHint() const override
{
if (widget())
return widget()->size();
@@ -109,7 +109,7 @@ namespace Internal {
SearchResultWindowPrivate::SearchResultWindowPrivate(SearchResultWindow *window, QWidget *nsp) :
q(window),
- m_expandCollapseButton(0),
+ m_expandCollapseButton(nullptr),
m_expandCollapseAction(new QAction(tr("Expand All"), window)),
m_spacer(new QWidget),
m_historyLabel(new QLabel(tr("History:"))),
@@ -178,7 +178,7 @@ namespace Internal {
void SearchResultWindowPrivate::moveWidgetToTop()
{
- SearchResultWidget *widget = qobject_cast<SearchResultWidget *>(sender());
+ auto widget = qobject_cast<SearchResultWidget *>(sender());
QTC_ASSERT(widget, return);
int index = m_searchResultWidgets.indexOf(widget);
if (index == 0)
@@ -212,7 +212,7 @@ namespace Internal {
void SearchResultWindowPrivate::popupRequested(bool focus)
{
- SearchResultWidget *widget = qobject_cast<SearchResultWidget *>(sender());
+ auto widget = qobject_cast<SearchResultWidget *>(sender());
QTC_ASSERT(widget, return);
int internalIndex = m_searchResultWidgets.indexOf(widget) + 1/*account for "new search" entry*/;
setCurrentIndex(internalIndex, focus);
@@ -297,7 +297,7 @@ using namespace Core::Internal;
\internal
*/
-SearchResultWindow *SearchResultWindow::m_instance = 0;
+SearchResultWindow *SearchResultWindow::m_instance = nullptr;
/*!
\internal
@@ -316,7 +316,7 @@ SearchResultWindow::~SearchResultWindow()
{
qDeleteAll(d->m_searchResults);
delete d->m_widget;
- d->m_widget = 0;
+ d->m_widget = nullptr;
delete d;
}