ProjectExplorer: Modernize

modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
modernize-use-transparent-functors

Change-Id: Iebed22caa2e733d292f334e956e3d16b844e14e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Alessandro Portale
2018-07-12 22:17:17 +02:00
parent af8bd12387
commit 8d19333075
66 changed files with 241 additions and 269 deletions

View File

@@ -88,7 +88,7 @@ static void insertIntoOsFlavorMap(const std::vector<Abi::OS> &oses, const Abi::O
static void registerOsFlavor(const Abi::OSFlavor &flavor, const QByteArray &flavorName,
const std::vector<Abi::OS> &oses)
{
const size_t pos = static_cast<size_t>(flavor);
const auto pos = static_cast<size_t>(flavor);
if (m_registeredOsFlavors.size() <= pos)
m_registeredOsFlavors.resize(pos + 1);
@@ -675,7 +675,7 @@ QString Abi::toString(const OS &o)
QString Abi::toString(const OSFlavor &of)
{
const size_t index = static_cast<size_t>(of);
const auto index = static_cast<size_t>(of);
const std::vector<QByteArray> &flavors = registeredOsFlavors();
QTC_ASSERT(index < flavors.size(),
return QString::fromUtf8(flavors.at(int(UnknownFlavor))));
@@ -845,7 +845,7 @@ Abi::OSFlavor Abi::registerOsFlavor(const std::vector<OS> &oses, const QString &
if (index < 0)
index = int(registeredOsFlavors().size());
OSFlavor toRegister = OSFlavor(index);
auto toRegister = OSFlavor(index);
ProjectExplorer::registerOsFlavor(toRegister, flavorBytes, oses);
return toRegister;
}
@@ -1030,7 +1030,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiRoundTrips()
for (const Abi::OSFlavor flavorIt : Abi::allOsFlavors()) {
const QString string = Abi::toString(flavorIt);
for (int os = 0; os <= Abi::UnknownOS; ++os) {
const Abi::OS osEnum = static_cast<Abi::OS>(os);
const auto osEnum = static_cast<Abi::OS>(os);
const Abi::OSFlavor flavor = Abi::osFlavorFromString(QStringRef(&string), osEnum);
if (isGenericFlavor(flavorIt) && flavor != Abi::UnknownFlavor)
QVERIFY(isGenericFlavor(flavor));

View File

@@ -77,7 +77,7 @@ public:
AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
d(new Internal::AbiWidgetPrivate)
{
QHBoxLayout *layout = new QHBoxLayout(this);
auto *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(2);

View File

@@ -437,7 +437,7 @@ bool AbstractMsvcToolChain::operator ==(const ToolChain &other) const
if (!ToolChain::operator ==(other))
return false;
const AbstractMsvcToolChain *msvcTc = static_cast<const AbstractMsvcToolChain *>(&other);
const auto *msvcTc = static_cast<const AbstractMsvcToolChain *>(&other);
return targetAbi() == msvcTc->targetAbi()
&& m_vcvarsBat == msvcTc->m_vcvarsBat;
}

View File

@@ -69,7 +69,7 @@ class ApplicationLauncherPrivate : public QObject
public:
enum State { Inactive, Run };
explicit ApplicationLauncherPrivate(ApplicationLauncher *parent);
~ApplicationLauncherPrivate() { setFinished(); }
~ApplicationLauncherPrivate() override { setFinished(); }
void start(const Runnable &runnable, const IDevice::ConstPtr &device, bool local);
void stop();
@@ -324,7 +324,7 @@ void ApplicationLauncherPrivate::readLocalStandardError()
void ApplicationLauncherPrivate::cannotRetrieveLocalDebugOutput()
{
#ifdef Q_OS_WIN
disconnect(WinDebugInterface::instance(), 0, this, 0);
disconnect(WinDebugInterface::instance(), nullptr, this, nullptr);
emit q->appendMessage(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput(), ErrorMessageFormat);
#endif
}
@@ -446,7 +446,7 @@ void ApplicationLauncherPrivate::setFinished()
if (m_deviceProcess) {
m_deviceProcess->disconnect(this);
m_deviceProcess->deleteLater();
m_deviceProcess = 0;
m_deviceProcess = nullptr;
}
m_state = Inactive;

View File

@@ -121,14 +121,14 @@ bool TabWidget::eventFilter(QObject *object, QEvent *event)
{
if (object == tabBar()) {
if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
auto *me = static_cast<QMouseEvent *>(event);
if (me->button() == Qt::MiddleButton) {
m_tabIndexForMiddleClick = tabBar()->tabAt(me->pos());
event->accept();
return true;
}
} else if (event->type() == QEvent::MouseButtonRelease) {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
auto *me = static_cast<QMouseEvent *>(event);
if (me->button() == Qt::MiddleButton) {
int tab = tabBar()->tabAt(me->pos());
if (tab != -1 && tab == m_tabIndexForMiddleClick)
@@ -221,7 +221,7 @@ AppOutputPane::AppOutputPane() :
// Spacer (?)
QVBoxLayout *layout = new QVBoxLayout;
auto *layout = new QVBoxLayout;
layout->setMargin(0);
m_tabWidget->setDocumentMode(true);
m_tabWidget->setTabsClosable(true);
@@ -353,7 +353,7 @@ int AppOutputPane::priorityInStatusBar() const
void AppOutputPane::clearContents()
{
Core::OutputWindow *currentWindow = qobject_cast<Core::OutputWindow *>(m_tabWidget->currentWidget());
auto *currentWindow = qobject_cast<Core::OutputWindow *>(m_tabWidget->currentWidget());
if (currentWindow)
currentWindow->clear();
}
@@ -458,7 +458,7 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc)
tab.window->setFontZoom(m_zoom);
});
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
auto *agg = new Aggregation::Aggregate;
agg->add(ow);
agg->add(new Core::BaseTextFind(ow));
m_runControlTabs.push_back(RunControlTab(rc, ow));
@@ -689,7 +689,7 @@ void AppOutputPane::tabChanged(int i)
void AppOutputPane::contextMenuRequested(const QPoint &pos, int index)
{
QList<QAction *> actions = QList<QAction *>() << m_closeCurrentTabAction << m_closeAllTabsAction << m_closeOtherTabsAction;
QAction *action = QMenu::exec(actions, m_tabWidget->mapToGlobal(pos), 0, m_tabWidget);
QAction *action = QMenu::exec(actions, m_tabWidget->mapToGlobal(pos), nullptr, m_tabWidget);
const int currentIdx = index != -1 ? index : currentIndex();
if (action == m_closeCurrentTabAction) {
if (currentIdx >= 0)
@@ -712,7 +712,7 @@ void AppOutputPane::slotRunControlChanged()
void AppOutputPane::slotRunControlFinished()
{
RunControl *rc = qobject_cast<RunControl *>(sender());
auto *rc = qobject_cast<RunControl *>(sender());
QTimer::singleShot(0, this, [this, rc]() { slotRunControlFinished2(rc); });
if (rc->outputFormatter())
rc->outputFormatter()->flush();

View File

@@ -358,7 +358,7 @@ int IBuildConfigurationFactory::priority(const Kit *k, const QString &projectPat
// setup
IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const QString &projectPath)
{
IBuildConfigurationFactory *factory = 0;
IBuildConfigurationFactory *factory = nullptr;
int priority = -1;
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
int iPriority = i->priority(k, projectPath);
@@ -373,7 +373,7 @@ IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const
// create
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
{
IBuildConfigurationFactory *factory = 0;
IBuildConfigurationFactory *factory = nullptr;
int priority = -1;
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
int iPriority = i->priority(parent);

View File

@@ -27,5 +27,4 @@
using namespace ProjectExplorer;
BuildInfo::~BuildInfo()
{ }
BuildInfo::~BuildInfo() = default;

View File

@@ -61,7 +61,7 @@ namespace ProjectExplorer {
static QString msgProgress(int progress, int total)
{
return BuildManager::tr("Finished %1 of %n steps", 0, total).arg(progress);
return BuildManager::tr("Finished %1 of %n steps", nullptr, total).arg(progress);
}
class BuildManagerPrivate
@@ -642,8 +642,8 @@ void BuildManager::decrementActiveBuildSteps(BuildStep *bs)
void BuildManager::disconnectOutput(BuildStep *bs)
{
disconnect(bs, &BuildStep::addTask, m_instance, 0);
disconnect(bs, &BuildStep::addOutput, m_instance, 0);
disconnect(bs, &BuildStep::addTask, m_instance, nullptr);
disconnect(bs, &BuildStep::addOutput, m_instance, nullptr);
}
} // namespace ProjectExplorer

View File

@@ -184,7 +184,7 @@ Target *BuildStepList::target() const
auto dc = qobject_cast<DeployConfiguration *>(parent());
if (dc)
return dc->target();
return 0;
return nullptr;
}
Project *BuildStepList::project() const

View File

@@ -50,8 +50,7 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
using namespace Utils;
ToolWidget::ToolWidget(QWidget *parent) : FadingPanel(parent),
m_targetOpacity(.999)
ToolWidget::ToolWidget(QWidget *parent) : FadingPanel(parent)
{
auto layout = new QHBoxLayout;
layout->setMargin(4);
@@ -169,7 +168,7 @@ void ToolWidget::setDownVisible(bool b)
}
BuildStepsWidgetData::BuildStepsWidgetData(BuildStep *s) :
step(s), widget(0), detailsWidget(0)
step(s), widget(nullptr), detailsWidget(nullptr)
{
widget = s->createConfigWidget();
Q_ASSERT(widget);

View File

@@ -52,8 +52,8 @@ class ToolWidget : public Utils::FadingPanel
public:
explicit ToolWidget(QWidget *parent = nullptr);
void fadeTo(qreal value);
void setOpacity(qreal value);
void fadeTo(qreal value) override;
void setOpacity(qreal value) override;
void setBuildStepEnabled(bool b);
void setUpEnabled(bool b);
@@ -77,7 +77,7 @@ private:
bool m_buildStepEnabled = true;
Utils::FadingWidget *m_firstWidget;
Utils::FadingWidget *m_secondWidget;
qreal m_targetOpacity;
qreal m_targetOpacity = .999;
};
class BuildStepsWidgetData
@@ -98,7 +98,7 @@ class BuildStepListWidget : public NamedWidget
public:
BuildStepListWidget(QWidget *parent = nullptr);
virtual ~BuildStepListWidget();
~BuildStepListWidget() override;
void init(BuildStepList *bsl);

View File

@@ -108,7 +108,7 @@ private:
}
protected:
void mouseMoveEvent(QMouseEvent *ev)
void mouseMoveEvent(QMouseEvent *ev) override
{
const int line = cursorForPosition(ev->pos()).block().blockNumber();
if (m_taskids.contains(line) && m_mousePressButton == Qt::NoButton)
@@ -118,14 +118,14 @@ protected:
QPlainTextEdit::mouseMoveEvent(ev);
}
void mousePressEvent(QMouseEvent *ev)
void mousePressEvent(QMouseEvent *ev) override
{
m_mousePressPosition = ev->pos();
m_mousePressButton = ev->button();
QPlainTextEdit::mousePressEvent(ev);
}
void mouseReleaseEvent(QMouseEvent *ev)
void mouseReleaseEvent(QMouseEvent *ev) override
{
if ((m_mousePressPosition - ev->pos()).manhattanLength() < 4
&& m_mousePressButton == Qt::LeftButton) {

View File

@@ -66,7 +66,7 @@ QString CurrentProjectFind::displayName() const
bool CurrentProjectFind::isEnabled() const
{
return ProjectTree::currentProject() != 0 && BaseFileFind::isEnabled();
return ProjectTree::currentProject() != nullptr && BaseFileFind::isEnabled();
}
QVariant CurrentProjectFind::additionalParameters() const

View File

@@ -152,7 +152,7 @@ void CustomExecutableDialog::accept()
bool CustomExecutableDialog::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
auto *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
ke->accept();
return true;

View File

@@ -160,7 +160,7 @@ void CustomWizard::setParameters(const CustomWizardParametersPtr &p)
Core::BaseFileWizard *CustomWizard::create(QWidget *parent, const Core::WizardDialogParameters &p) const
{
QTC_ASSERT(!d->m_parameters.isNull(), return 0);
QTC_ASSERT(!d->m_parameters.isNull(), return nullptr);
auto wizard = new Core::BaseFileWizard(this, p.extraValues(), parent);
d->m_context->reset();
@@ -213,7 +213,7 @@ static inline bool createFile(CustomWizardFile cwFile,
generatedFile.setContents(CustomWizardContext::processFile(fm, contentsIn));
}
Core::GeneratedFile::Attributes attributes = 0;
Core::GeneratedFile::Attributes attributes = {};
if (cwFile.openEditor)
attributes |= Core::GeneratedFile::OpenEditorAttribute;
if (cwFile.openProject)
@@ -230,7 +230,7 @@ template <class WizardPage>
foreach (int pageId, w->pageIds())
if (auto wp = qobject_cast<WizardPage *>(w->page(pageId)))
return wp;
return 0;
return nullptr;
}
// Determine where to run the generator script. The user may specify
@@ -362,7 +362,7 @@ CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizard
if (!rc) {
qWarning("Unable to create custom wizard for class %s.", qPrintable(p->klass));
return 0;
return nullptr;
}
rc->setParameters(p);
@@ -487,9 +487,7 @@ QList<Core::IWizardFactory *> CustomWizard::createWizards()
for QLineEdit-type fields' default text.
*/
CustomProjectWizard::CustomProjectWizard()
{
}
CustomProjectWizard::CustomProjectWizard() = default;
/*!
Can be reimplemented to create custom project wizards.
@@ -540,7 +538,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
Core::GeneratedFiles CustomProjectWizard::generateFiles(const QWizard *w, QString *errorMessage) const
{
const BaseProjectWizardDialog *dialog = qobject_cast<const BaseProjectWizardDialog *>(w);
const auto *dialog = qobject_cast<const BaseProjectWizardDialog *>(w);
QTC_ASSERT(dialog, return Core::GeneratedFiles());
// Add project name as macro. Path is here under project directory
CustomWizardContextPtr ctx = context();

View File

@@ -163,7 +163,7 @@ void CustomWizardFieldPage::addField(const CustomWizardField &field)\
static void comboChoices(const CustomWizardField::ControlAttributeMap &controlAttributes,
QStringList *values, QStringList *displayTexts)
{
typedef CustomWizardField::ControlAttributeMap::ConstIterator AttribMapConstIt;
using AttribMapConstIt = CustomWizardField::ControlAttributeMap::ConstIterator;
values->clear();
displayTexts->clear();
@@ -260,7 +260,7 @@ QWidget *CustomWizardFieldPage::registerCheckBox(const QString &fieldName,
const QString &fieldDescription,
const CustomWizardField &field)
{
typedef CustomWizardField::ControlAttributeMap::const_iterator AttributeMapConstIt;
using AttributeMapConstIt = CustomWizardField::ControlAttributeMap::const_iterator;
auto checkBox = new TextFieldCheckBox(fieldDescription);
const bool defaultValue = field.controlAttributes.value(QLatin1String("defaultvalue")) == QLatin1String("true");

View File

@@ -835,8 +835,8 @@ bool CustomWizardContext::replaceFields(const FieldReplacementMap &fm, QString *
// used for the arguments of a generator script.
class TemporaryFileTransform {
public:
typedef CustomWizardContext::TemporaryFilePtr TemporaryFilePtr;
typedef CustomWizardContext::TemporaryFilePtrList TemporaryFilePtrList;
using TemporaryFilePtr = CustomWizardContext::TemporaryFilePtr;
using TemporaryFilePtrList = CustomWizardContext::TemporaryFilePtrList;
explicit TemporaryFileTransform(TemporaryFilePtrList *f);

View File

@@ -230,7 +230,7 @@ bool runCustomWizardGeneratorScript(const QString &targetPath,
{
return runGenerationScriptHelper(targetPath, script, arguments,
false, fieldMap,
0, errorMessage);
nullptr, errorMessage);
}
} // namespace Internal

View File

@@ -60,9 +60,7 @@ DesktopDevice::DesktopDevice() : IDevice(Core::Id(DESKTOP_DEVICE_TYPE),
setFreePorts(Utils::PortList::fromString(portRange));
}
DesktopDevice::DesktopDevice(const DesktopDevice &other) :
IDevice(other)
{ }
DesktopDevice::DesktopDevice(const DesktopDevice &other) = default;
IDevice::DeviceInfo DesktopDevice::deviceInformation() const
{
@@ -76,7 +74,7 @@ QString DesktopDevice::displayType() const
IDeviceWidget *DesktopDevice::createWidget()
{
return 0;
return nullptr;
// DesktopDeviceConfigurationWidget currently has just one editable field viz. free ports.
// Querying for an available port is quite straightforward. Having a field for the port
// range can be confusing to the user. Hence, disabling the widget for now.
@@ -127,7 +125,7 @@ DeviceProcessSignalOperation::Ptr DesktopDevice::signalOperation() const
class DesktopDeviceEnvironmentFetcher : public DeviceEnvironmentFetcher
{
public:
DesktopDeviceEnvironmentFetcher() {}
DesktopDeviceEnvironmentFetcher() = default;
void start() override
{

View File

@@ -57,8 +57,7 @@ const char DefaultDevicesKey[] = "DefaultDevices";
class DeviceManagerPrivate
{
public:
DeviceManagerPrivate() : writer(0)
{ }
DeviceManagerPrivate() = default;
int indexForId(Core::Id id) const
{
@@ -74,15 +73,15 @@ public:
QHash<Core::Id, Core::Id> defaultDevices;
QSsh::SshHostKeyDatabasePtr hostKeyDatabase;
Utils::PersistentSettingsWriter *writer;
Utils::PersistentSettingsWriter *writer = nullptr;
};
DeviceManager *DeviceManagerPrivate::clonedInstance = 0;
DeviceManager *DeviceManagerPrivate::clonedInstance = nullptr;
} // namespace Internal
using namespace Internal;
DeviceManager *DeviceManager::m_instance = 0;
DeviceManager *DeviceManager::m_instance = nullptr;
DeviceManager *DeviceManager::instance()
{
@@ -104,12 +103,12 @@ void DeviceManager::replaceInstance()
void DeviceManager::removeClonedInstance()
{
delete DeviceManagerPrivate::clonedInstance;
DeviceManagerPrivate::clonedInstance = 0;
DeviceManagerPrivate::clonedInstance = nullptr;
}
DeviceManager *DeviceManager::cloneInstance()
{
QTC_ASSERT(!DeviceManagerPrivate::clonedInstance, return 0);
QTC_ASSERT(!DeviceManagerPrivate::clonedInstance, return nullptr);
DeviceManagerPrivate::clonedInstance = new DeviceManager(false);
copy(instance(), DeviceManagerPrivate::clonedInstance, true);
@@ -210,7 +209,7 @@ QVariantMap DeviceManager::toMap() const
{
QVariantMap map;
QVariantMap defaultDeviceMap;
typedef QHash<Core::Id, Core::Id> TypeIdHash;
using TypeIdHash = QHash<Core::Id, Core::Id>;
for (TypeIdHash::ConstIterator it = d->defaultDevices.constBegin();
it != d->defaultDevices.constEnd(); ++it) {
defaultDeviceMap.insert(it.key().toString(), it.value().toSetting());
@@ -370,7 +369,7 @@ DeviceManager::~DeviceManager()
if (d->clonedInstance != this)
delete d->writer;
if (m_instance == this)
m_instance = 0;
m_instance = nullptr;
delete d;
}
@@ -429,9 +428,9 @@ public:
static Core::Id testTypeId() { return "TestType"; }
private:
TestDevice(const TestDevice &other) : IDevice(other) {}
TestDevice(const TestDevice &other) = default;
QString displayType() const override { return QLatin1String("blubb"); }
IDeviceWidget *createWidget() override { return 0; }
IDeviceWidget *createWidget() override { return nullptr; }
QList<Core::Id> actionIds() const override { return QList<Core::Id>(); }
QString displayNameForActionId(Core::Id) const override { return QString(); }
void executeAction(Core::Id, QWidget *) override { }

View File

@@ -58,7 +58,7 @@ class ProcessListFilterModel : public QSortFilterProxyModel
{
public:
ProcessListFilterModel();
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
};
ProcessListFilterModel::ProcessListFilterModel()
@@ -120,14 +120,14 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser,
: q(parent)
, kitLabel(new QLabel(DeviceProcessesDialog::tr("Kit:"), parent))
, kitChooser(chooser)
, acceptButton(0)
, acceptButton(nullptr)
, buttonBox(new QDialogButtonBox(parent))
{
q->setWindowTitle(DeviceProcessesDialog::tr("List of Processes"));
q->setWindowFlags(q->windowFlags() & ~Qt::WindowContextHelpButtonHint);
q->setMinimumHeight(500);
processList = 0;
processList = nullptr;
processFilterLineEdit = new FancyLineEdit(q);
processFilterLineEdit->setPlaceholderText(DeviceProcessesDialog::tr("Filter"));
@@ -159,7 +159,7 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser,
buttonBox->addButton(updateListButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(killProcessButton, QDialogButtonBox::ActionRole);
QFormLayout *leftColumn = new QFormLayout();
auto *leftColumn = new QFormLayout();
leftColumn->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
leftColumn->addRow(kitLabel, kitChooser);
leftColumn->addRow(DeviceProcessesDialog::tr("&Filter:"), processFilterLineEdit);
@@ -173,7 +173,7 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser,
// horizontalLayout->addLayout(leftColumn);
// horizontalLayout->addLayout(rightColumn);
QVBoxLayout *mainLayout = new QVBoxLayout(q);
auto *mainLayout = new QVBoxLayout(q);
mainLayout->addLayout(leftColumn);
mainLayout->addWidget(procView);
mainLayout->addWidget(errorText);
@@ -212,8 +212,8 @@ DeviceProcessesDialogPrivate::DeviceProcessesDialogPrivate(KitChooser *chooser,
void DeviceProcessesDialogPrivate::setDevice(const IDevice::ConstPtr &device)
{
delete processList;
processList = 0;
proxyModel.setSourceModel(0);
processList = nullptr;
proxyModel.setSourceModel(nullptr);
if (!device)
return;

View File

@@ -58,14 +58,14 @@ const char LastDeviceIndexKey[] = "LastDisplayedMaemoDeviceConfig";
class NameValidator : public QValidator
{
public:
NameValidator(const DeviceManager *deviceManager, QWidget *parent = 0)
NameValidator(const DeviceManager *deviceManager, QWidget *parent = nullptr)
: QValidator(parent), m_deviceManager(deviceManager)
{
}
void setDisplayName(const QString &name) { m_oldName = name; }
virtual State validate(QString &input, int & /* pos */) const
State validate(QString &input, int & /* pos */) const override
{
if (input.trimmed().isEmpty()
|| (input != m_oldName && m_deviceManager->hasDevice(input)))
@@ -73,7 +73,7 @@ public:
return Acceptable;
}
virtual void fixup(QString &input) const
void fixup(QString &input) const override
{
int dummy = 0;
if (validate(input, dummy) != Acceptable)
@@ -91,7 +91,7 @@ DeviceSettingsWidget::DeviceSettingsWidget(QWidget *parent)
m_deviceManager(DeviceManager::cloneInstance()),
m_deviceManagerModel(new DeviceManagerModel(m_deviceManager, this)),
m_nameValidator(new NameValidator(m_deviceManager, this)),
m_configWidget(0)
m_configWidget(nullptr)
{
initGui();
connect(m_deviceManager, &DeviceManager::deviceUpdated,
@@ -270,7 +270,7 @@ void DeviceSettingsWidget::currentDeviceChanged(int index)
{
qDeleteAll(m_additionalActionButtons);
delete m_configWidget;
m_configWidget = 0;
m_configWidget = nullptr;
m_additionalActionButtons.clear();
const IDevice::ConstPtr device = m_deviceManagerModel->device(index);
if (device.isNull()) {

View File

@@ -93,7 +93,7 @@ void DeviceUsedPortsGatherer::stop()
d->remoteStdout.clear();
d->remoteStderr.clear();
if (d->process)
disconnect(d->process.data(), 0, this, 0);
disconnect(d->process.data(), nullptr, this, nullptr);
d->process.clear();
}
@@ -187,9 +187,7 @@ PortsGatherer::PortsGatherer(RunControl *runControl)
});
}
PortsGatherer::~PortsGatherer()
{
}
PortsGatherer::~PortsGatherer() = default;
void PortsGatherer::start()
{
@@ -353,9 +351,7 @@ ChannelProvider::ChannelProvider(RunControl *runControl, int requiredChannels)
}
}
ChannelProvider::~ChannelProvider()
{
}
ChannelProvider::~ChannelProvider() = default;
QUrl ChannelProvider::channel(int i) const
{

View File

@@ -128,7 +128,7 @@ const char SshOptionsKey[] = "SshOptions";
const char DebugServerKey[] = "DebugServerKey";
const char QmlsceneKey[] = "QmlsceneKey";
typedef QSsh::SshConnectionParameters::AuthenticationType AuthType;
using AuthType = QSsh::SshConnectionParameters::AuthenticationType;
const AuthType DefaultAuthType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
const IDevice::MachineType DefaultMachineType = IDevice::Hardware;
@@ -138,20 +138,15 @@ namespace Internal {
class IDevicePrivate
{
public:
IDevicePrivate() :
origin(IDevice::AutoDetected),
deviceState(IDevice::DeviceStateUnknown),
machineType(IDevice::Hardware),
version(0)
{ }
IDevicePrivate() = default;
QString displayName;
Core::Id type;
IDevice::Origin origin;
IDevice::Origin origin = IDevice::AutoDetected;
Core::Id id;
IDevice::DeviceState deviceState;
IDevice::MachineType machineType;
int version; // This is used by devices that have been added by the SDK.
IDevice::DeviceState deviceState = IDevice::DeviceStateUnknown;
IDevice::MachineType machineType = IDevice::Hardware;
int version = 0; // This is used by devices that have been added by the SDK.
QSsh::SshConnectionParameters sshParameters;
Utils::PortList freePorts;
@@ -270,14 +265,14 @@ PortsGatheringMethod::Ptr IDevice::portsGatheringMethod() const
DeviceProcessList *IDevice::createProcessListModel(QObject *parent) const
{
Q_UNUSED(parent);
QTC_ASSERT(false, qDebug("This should not have been called..."); return 0);
return 0;
QTC_ASSERT(false, qDebug("This should not have been called..."); return nullptr);
return nullptr;
}
DeviceTester *IDevice::createDeviceTester() const
{
QTC_ASSERT(false, qDebug("This should not have been called..."));
return 0;
return nullptr;
}
Utils::OsType IDevice::osType() const
@@ -288,7 +283,7 @@ Utils::OsType IDevice::osType() const
DeviceProcess *IDevice::createProcess(QObject * /* parent */) const
{
QTC_CHECK(false);
return 0;
return nullptr;
}
DeviceEnvironmentFetcher::Ptr IDevice::environmentFetcher() const
@@ -479,12 +474,8 @@ void DeviceProcessSignalOperation::setDebuggerCommand(const QString &cmd)
m_debuggerCommand = cmd;
}
DeviceProcessSignalOperation::DeviceProcessSignalOperation()
{
}
DeviceProcessSignalOperation::DeviceProcessSignalOperation() = default;
DeviceEnvironmentFetcher::DeviceEnvironmentFetcher()
{
}
DeviceEnvironmentFetcher::DeviceEnvironmentFetcher() = default;
} // namespace ProjectExplorer

View File

@@ -342,7 +342,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::setState(SshDeviceProcess::SshDe
if (connection) {
connection->disconnect(q);
QSsh::releaseConnection(connection);
connection = 0;
connection = nullptr;
}
}

View File

@@ -273,7 +273,7 @@ void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const
void EditorConfiguration::setUseGlobalSettings(bool use)
{
d->m_useGlobal = use;
d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0);
d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : nullptr);
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
Project *project = SessionManager::projectForFile(editor->document()->filePath());

View File

@@ -96,7 +96,7 @@ public:
: QStyledItemDelegate(view), m_model(model), m_view(view)
{}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
{
QWidget *w = QStyledItemDelegate::createEditor(parent, option, index);
if (index.column() != 0)

View File

@@ -51,7 +51,7 @@ class AbiFlavorUpgraderV0 : public VersionUpgrader
public:
AbiFlavorUpgraderV0() : VersionUpgrader(0, "") { }
virtual QVariantMap upgrade(const QVariantMap &data) { return data; }
QVariantMap upgrade(const QVariantMap &data) override { return data; }
};
class AbiFlavorAccessor : public UpgradingSettingsAccessor

View File

@@ -147,7 +147,7 @@ public:
FolderSortProxyModel(QObject *parent = nullptr);
protected:
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
};
FolderSortProxyModel::FolderSortProxyModel(QObject *parent)

View File

@@ -83,11 +83,11 @@ void GnuMakeParser::stdOutput(const QString &line)
class Result {
public:
Result() : isFatal(false), type(Task::Error) { }
Result() = default;
QString description;
bool isFatal;
Task::TaskType type;
bool isFatal = false;
Task::TaskType type = Task::Error;
};
static Result parseDescription(const QString &description)
@@ -401,8 +401,8 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
void ProjectExplorerPlugin::testGnuMakeParserParsing()
{
OutputParserTester testbench;
GnuMakeParser *childParser = new GnuMakeParser;
GnuMakeParserTester *tester = new GnuMakeParserTester(childParser);
auto *childParser = new GnuMakeParser;
auto *tester = new GnuMakeParserTester(childParser);
connect(&testbench, &OutputParserTester::aboutToDeleteParser,
tester, &GnuMakeParserTester::parserIsAboutToBeDeleted);
@@ -494,7 +494,7 @@ void ProjectExplorerPlugin::testGnuMakeParserTaskMangling_data()
void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
{
OutputParserTester testbench;
GnuMakeParser *childParser = new GnuMakeParser;
auto *childParser = new GnuMakeParser;
testbench.appendOutputParser(childParser);
QFETCH(QStringList, files);

View File

@@ -149,7 +149,7 @@ IOutputParser *IOutputParser::takeOutputParserChain()
IOutputParser *parser = m_parser;
disconnect(parser, &IOutputParser::addOutput, this, &IOutputParser::outputAdded);
disconnect(parser, &IOutputParser::addTask, this, &IOutputParser::taskAdded);
m_parser = 0;
m_parser = nullptr;
return parser;
}

View File

@@ -114,13 +114,13 @@ public:
m_fixupExpando = expando;
}
QValidator::State validate(QString &input, int &pos) const
QValidator::State validate(QString &input, int &pos) const override
{
fixup(input);
return QRegularExpressionValidator::validate(input, pos);
}
void fixup(QString &fixup) const
void fixup(QString &fixup) const override
{
if (m_fixupExpando.isEmpty())
return;
@@ -159,7 +159,7 @@ JsonFieldPage::Field *JsonFieldPage::Field::parse(const QVariant &input, QString
if (input.type() != QVariant::Map) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonFieldPage",
"Field is not an object.");
return 0;
return nullptr;
}
QVariantMap tmp = input.toMap();
@@ -167,13 +167,13 @@ JsonFieldPage::Field *JsonFieldPage::Field::parse(const QVariant &input, QString
if (name.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonFieldPage",
"Field has no name.");
return 0;
return nullptr;
}
const QString type = consumeValue(tmp, TYPE_KEY).toString();
if (type.isEmpty()) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonFieldPage",
"Field \"%1\" has no type.").arg(name);
return 0;
return nullptr;
}
Field *data = createFieldData(type);
@@ -181,7 +181,7 @@ JsonFieldPage::Field *JsonFieldPage::Field::parse(const QVariant &input, QString
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonFieldPage",
"Field \"%1\" has unsupported type \"%2\".")
.arg(name).arg(type);
return 0;
return nullptr;
}
data->setTexts(name,
JsonWizardFactory::localizedString(consumeValue(tmp, DISPLAY_NAME_KEY).toString()),
@@ -200,7 +200,7 @@ JsonFieldPage::Field *JsonFieldPage::Field::parse(const QVariant &input, QString
"When parsing Field \"%1\": %2")
.arg(name).arg(*errorMessage);
delete data;
return 0;
return nullptr;
}
warnAboutUnsupportedKeys(tmp, name);
@@ -927,7 +927,7 @@ void ListField::initializeData(MacroExpander *expander)
QString iconPath = expandedValuesItem->data(IconStringRole).toString();
if (!iconPath.isEmpty()) {
if (JsonFieldPage *page = qobject_cast<JsonFieldPage*>(widget()->parentWidget())) {
if (auto *page = qobject_cast<JsonFieldPage*>(widget()->parentWidget())) {
const QString wizardDirectory = page->value("WizardDir").toString();
iconPath = QDir::cleanPath(QDir(wizardDirectory).absoluteFilePath(iconPath));
if (QFileInfo::exists(iconPath)) {

View File

@@ -127,7 +127,7 @@ static JsonWizardFactory::Generator parseGenerator(const QVariant &value, QStrin
}
Core::Id typeId = Core::Id::fromString(QLatin1String(Constants::GENERATOR_ID_PREFIX) + strVal);
JsonWizardGeneratorFactory *factory
= Utils::findOr(s_generatorFactories, 0, [typeId](JsonWizardGeneratorFactory *f) { return f->canCreate(typeId); });
= Utils::findOr(s_generatorFactories, nullptr, [typeId](JsonWizardGeneratorFactory *f) { return f->canCreate(typeId); });
if (!factory) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizardFactory",
"TypeId \"%1\" of generator is unknown. Supported typeIds are: \"%2\".")
@@ -164,7 +164,7 @@ static JsonWizardFactory::Page parsePage(const QVariant &value, QString *errorMe
Core::Id typeId = Core::Id::fromString(QLatin1String(Constants::PAGE_ID_PREFIX) + strVal);
JsonWizardPageFactory *factory
= Utils::findOr(s_pageFactories, 0, [typeId](JsonWizardPageFactory *f) { return f->canCreate(typeId); });
= Utils::findOr(s_pageFactories, nullptr, [typeId](JsonWizardPageFactory *f) { return f->canCreate(typeId); });
if (!factory) {
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizardFactory",
"TypeId \"%1\" of page is unknown. Supported typeIds are: \"%2\".")
@@ -306,7 +306,7 @@ QList<Core::IWizardFactory *> JsonWizardFactory::createWizardFactories()
JsonWizardFactory *JsonWizardFactory::createWizardFactory(const QVariantMap &data, const QDir &baseDir,
QString *errorMessage)
{
JsonWizardFactory *factory = new JsonWizardFactory;
auto *factory = new JsonWizardFactory;
if (!factory->initialize(data, baseDir, errorMessage)) {
delete factory;
factory = nullptr;
@@ -404,7 +404,7 @@ Utils::Wizard *JsonWizardFactory::runWizardImpl(const QString &path, QWidget *pa
continue;
havePage = true;
JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, 0,
JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, nullptr,
[&data](JsonWizardPageFactory *f) {
return f->canCreate(data.typeId);
});
@@ -427,7 +427,7 @@ Utils::Wizard *JsonWizardFactory::runWizardImpl(const QString &path, QWidget *pa
foreach (const Generator &data, m_generators) {
QTC_ASSERT(data.isValid(), continue);
JsonWizardGeneratorFactory *factory = Utils::findOr(s_generatorFactories, 0,
JsonWizardGeneratorFactory *factory = Utils::findOr(s_generatorFactories, nullptr,
[&data](JsonWizardGeneratorFactory *f) {
return f->canCreate(data.typeId);
});
@@ -441,7 +441,7 @@ Utils::Wizard *JsonWizardFactory::runWizardImpl(const QString &path, QWidget *pa
if (!havePage) {
wizard->accept();
wizard->deleteLater();
return 0;
return nullptr;
}
wizard->show();
@@ -629,7 +629,7 @@ bool JsonWizardFactory::initialize(const QVariantMap &data, const QDir &baseDir,
return false;
}
WizardFlags flags = 0;
WizardFlags flags = {};
if (data.value(QLatin1String(PLATFORM_INDEPENDENT_KEY), false).toBool())
flags |= PlatformIndependent;
setFlags(flags);

View File

@@ -139,7 +139,7 @@ Core::GeneratedFile JsonWizardFileGenerator::generateFile(const File &file,
}
}
Core::GeneratedFile::Attributes attributes = 0;
Core::GeneratedFile::Attributes attributes = {};
if (JsonWizard::boolFromVariant(file.openInEditor, expander))
attributes |= Core::GeneratedFile::OpenEditorAttribute;
if (JsonWizard::boolFromVariant(file.openAsProject, expander))

View File

@@ -67,7 +67,7 @@ namespace ProjectExplorer {
static ICodeStylePreferences *codeStylePreferences(Project *project, Id languageId)
{
if (!languageId.isValid())
return 0;
return nullptr;
if (project)
return project->editorConfiguration()->codeStyle(languageId);
@@ -310,7 +310,7 @@ JsonWizardGenerator *FileGeneratorFactory::create(Id typeId, const QVariant &dat
Q_UNUSED(platform);
Q_UNUSED(variables);
QTC_ASSERT(canCreate(typeId), return 0);
QTC_ASSERT(canCreate(typeId), return nullptr);
auto gen = new JsonWizardFileGenerator;
QString errorMessage;
@@ -319,7 +319,7 @@ JsonWizardGenerator *FileGeneratorFactory::create(Id typeId, const QVariant &dat
if (!errorMessage.isEmpty()) {
qWarning() << "FileGeneratorFactory setup error:" << errorMessage;
delete gen;
return 0;
return nullptr;
}
return gen;
@@ -350,7 +350,7 @@ JsonWizardGenerator *ScannerGeneratorFactory::create(Id typeId, const QVariant &
Q_UNUSED(platform);
Q_UNUSED(variables);
QTC_ASSERT(canCreate(typeId), return 0);
QTC_ASSERT(canCreate(typeId), return nullptr);
auto gen = new JsonWizardScannerGenerator;
QString errorMessage;
@@ -359,7 +359,7 @@ JsonWizardGenerator *ScannerGeneratorFactory::create(Id typeId, const QVariant &
if (!errorMessage.isEmpty()) {
qWarning() << "ScannerGeneratorFactory setup error:" << errorMessage;
delete gen;
return 0;
return nullptr;
}
return gen;

View File

@@ -35,8 +35,7 @@ namespace ProjectExplorer {
// JsonWizardPageFactory:
// --------------------------------------------------------------------
JsonWizardPageFactory::~JsonWizardPageFactory()
{ }
JsonWizardPageFactory::~JsonWizardPageFactory() = default;
void JsonWizardPageFactory::setTypeIdsSuffixes(const QStringList &suffixes)
{

View File

@@ -472,7 +472,7 @@ bool Kit::isEqual(const Kit *other) const
QVariantMap Kit::toMap() const
{
typedef QHash<Id, QVariant>::ConstIterator IdVariantConstIt;
using IdVariantConstIt = QHash<Id, QVariant>::ConstIterator;
QVariantMap data;
data.insert(QLatin1String(ID_KEY), QString::fromLatin1(d->m_id.name()));

View File

@@ -324,7 +324,7 @@ KitManager::KitList KitManager::restoreKits(const FileName &fileName)
const QVariantMap stMap = data.value(key).toMap();
Kit *k = new Kit(stMap);
auto *k = new Kit(stMap);
if (k->id().isValid()) {
result.kits.append(k);
} else {
@@ -380,7 +380,7 @@ QList<KitInformation *> KitManager::kitInformation()
KitManagerConfigWidget *KitManager::createConfigWidget(Kit *k)
{
KitManagerConfigWidget *result = new KitManagerConfigWidget(k);
auto *result = new KitManagerConfigWidget(k);
foreach (KitInformation *ki, kitInformation())
result->addConfigWidget(ki->createConfigWidget(result->workingCopy()));

View File

@@ -218,7 +218,7 @@ void KitManagerConfigWidget::addConfigWidget(KitConfigWidget *widget)
QString name = widget->displayName();
QString toolTip = widget->toolTip();
auto action = new QAction(tr("Mark as Mutable"), 0);
auto action = new QAction(tr("Mark as Mutable"), nullptr);
action->setCheckable(true);
action->setChecked(widget->isMutable());
action->setEnabled(!widget->isSticky());

View File

@@ -54,12 +54,12 @@ public:
}
}
~KitNode()
~KitNode() override
{
delete widget;
}
QVariant data(int, int role) const
QVariant data(int, int role) const override
{
if (widget) {
if (role == Qt::FontRole) {
@@ -132,7 +132,7 @@ KitModel::KitModel(QBoxLayout *parentLayout, QObject *parent)
Kit *KitModel::kit(const QModelIndex &index)
{
KitNode *n = kitNode(index);
return n ? n->widget->workingCopy() : 0;
return n ? n->widget->workingCopy() : nullptr;
}
KitNode *KitModel::kitNode(const QModelIndex &index)
@@ -161,7 +161,7 @@ bool KitModel::isDefaultKit(Kit *k) const
KitManagerConfigWidget *KitModel::widget(const QModelIndex &index)
{
KitNode *n = kitNode(index);
return n ? n->widget : 0;
return n ? n->widget : nullptr;
}
void KitModel::isAutoDetectedChanged()
@@ -244,7 +244,7 @@ void KitModel::markForRemoval(Kit *k)
setDefaultNode(findItemAtLevel<2>([node](KitNode *kn) { return kn != node; }));
takeItem(node);
if (node->widget->configures(0))
if (node->widget->configures(nullptr))
delete node;
else
m_toRemoveList.append(node);
@@ -252,7 +252,7 @@ void KitModel::markForRemoval(Kit *k)
Kit *KitModel::markForAddition(Kit *baseKit)
{
KitNode *node = createNode(0);
KitNode *node = createNode(nullptr);
m_manualRoot->appendChild(node);
Kit *k = node->widget->workingCopy();
KitGuard g(k);
@@ -331,7 +331,7 @@ void KitModel::removeKit(Kit *k)
if (n->widget->configures(k)) {
m_toRemoveList.removeOne(n);
if (m_defaultNode == n)
m_defaultNode = 0;
m_defaultNode = nullptr;
delete n;
return;
}

View File

@@ -157,7 +157,7 @@ void KitOptionsPageWidget::kitSelectionChanged()
void KitOptionsPageWidget::addNewKit()
{
Kit *k = m_model->markForAddition(0);
Kit *k = m_model->markForAddition(nullptr);
QModelIndex newIdx = m_model->indexOf(k);
m_selectionModel->select(newIdx,

View File

@@ -66,7 +66,7 @@ static QIcon createCenteredIcon(const QIcon &icon, const QIcon &overlay)
{
QPixmap targetPixmap;
const qreal appDevicePixelRatio = qApp->devicePixelRatio();
const int deviceSpaceIconSize = static_cast<int>(Core::Constants::MODEBAR_ICON_SIZE * appDevicePixelRatio);
const auto deviceSpaceIconSize = static_cast<int>(Core::Constants::MODEBAR_ICON_SIZE * appDevicePixelRatio);
targetPixmap = QPixmap(deviceSpaceIconSize, deviceSpaceIconSize);
targetPixmap.setDevicePixelRatio(appDevicePixelRatio);
targetPixmap.fill(Qt::transparent);
@@ -107,10 +107,10 @@ class TargetSelectorDelegate : public QItemDelegate
public:
TargetSelectorDelegate(ListWidget *parent) : QItemDelegate(parent), m_listWidget(parent) { }
private:
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const;
const QModelIndex &index) const override;
ListWidget *m_listWidget;
};
@@ -227,8 +227,8 @@ void ListWidget::setOptimalWidth(int width)
int ListWidget::padding()
{
// there needs to be enough extra pixels to show a scrollbar
return 2 * style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, this)
+ style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, this)
return 2 * style()->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, this)
+ style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr, this)
+ 10;
}
@@ -272,7 +272,7 @@ void ProjectListWidget::addProject(Project *project)
int pos = count();
for (int i = 0; i < count(); ++i) {
Project *p = item(i)->data(Qt::UserRole).value<Project*>();
auto *p = item(i)->data(Qt::UserRole).value<Project*>();
if (projectLesserThan(project, p)) {
pos = i;
break;
@@ -281,7 +281,7 @@ void ProjectListWidget::addProject(Project *project)
bool useFullName = false;
for (int i = 0; i < count(); ++i) {
Project *p = item(i)->data(Qt::UserRole).value<Project*>();
auto *p = item(i)->data(Qt::UserRole).value<Project*>();
if (p->displayName() == project->displayName()) {
useFullName = true;
item(i)->setText(fullName(p));
@@ -289,7 +289,7 @@ void ProjectListWidget::addProject(Project *project)
}
QString displayName = useFullName ? fullName(project) : project->displayName();
QListWidgetItem *item = new QListWidgetItem();
auto *item = new QListWidgetItem();
item->setData(Qt::UserRole, QVariant::fromValue(project));
item->setText(displayName);
insertItem(pos, item);
@@ -317,14 +317,14 @@ void ProjectListWidget::removeProject(Project *project)
int countDisplayName = 0;
int otherIndex = -1;
for (int i = 0; i < count(); ++i) {
Project *p = item(i)->data(Qt::UserRole).value<Project *>();
auto *p = item(i)->data(Qt::UserRole).value<Project *>();
if (p->displayName() == name) {
++countDisplayName;
otherIndex = i;
}
}
if (countDisplayName == 1) {
Project *p = item(otherIndex)->data(Qt::UserRole).value<Project *>();
auto *p = item(otherIndex)->data(Qt::UserRole).value<Project *>();
item(otherIndex)->setText(p->displayName());
}
@@ -346,7 +346,7 @@ void ProjectListWidget::projectDisplayNameChanged(Project *project)
int oldPos = 0;
bool useFullName = false;
for (int i = 0; i < count(); ++i) {
Project *p = item(i)->data(Qt::UserRole).value<Project*>();
auto *p = item(i)->data(Qt::UserRole).value<Project*>();
if (p == project) {
oldPos = i;
} else if (p->displayName() == project->displayName()) {
@@ -360,7 +360,7 @@ void ProjectListWidget::projectDisplayNameChanged(Project *project)
int pos = count();
for (int i = 0; i < count(); ++i) {
Project *p = item(i)->data(Qt::UserRole).value<Project*>();
auto *p = item(i)->data(Qt::UserRole).value<Project*>();
if (projectLesserThan(project, p)) {
pos = i;
break;
@@ -389,7 +389,7 @@ void ProjectListWidget::setProject(int index)
return;
if (index < 0)
return;
Project *p = item(index)->data(Qt::UserRole).value<Project *>();
auto *p = item(index)->data(Qt::UserRole).value<Project *>();
SessionManager::setStartupProject(p);
}
@@ -415,7 +415,7 @@ void GenericListWidget::setProjectConfigurations(const QList<ProjectConfiguratio
clear();
for (int i = 0; i < count(); ++i) {
ProjectConfiguration *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
disconnect(p, &ProjectConfiguration::displayNameChanged,
this, &GenericListWidget::displayNameChanged);
}
@@ -450,7 +450,7 @@ void GenericListWidget::addProjectConfiguration(ProjectConfiguration *pc)
// Figure out pos
int pos = count();
for (int i = 0; i < count(); ++i) {
ProjectConfiguration *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
if (caseFriendlyCompare(pc->displayName(), p->displayName()) < 0) {
pos = i;
break;
@@ -480,7 +480,7 @@ void GenericListWidget::removeProjectConfiguration(ProjectConfiguration *pc)
QFontMetrics fn(font());
int width = 0;
for (int i = 0; i < count(); ++i) {
ProjectConfiguration *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
width = qMax(width, fn.width(p->displayName()) + padding());
}
setOptimalWidth(width);
@@ -504,7 +504,7 @@ void GenericListWidget::displayNameChanged()
if (currentItem())
activeProjectConfiguration = currentItem()->data(Qt::UserRole).value<ProjectConfiguration *>();
ProjectConfiguration *pc = qobject_cast<ProjectConfiguration *>(sender());
auto *pc = qobject_cast<ProjectConfiguration *>(sender());
int index = -1;
int i = 0;
for (; i < count(); ++i) {
@@ -520,7 +520,7 @@ void GenericListWidget::displayNameChanged()
lwi->setText(pc->displayName());
int pos = count();
for (int i = 0; i < count(); ++i) {
ProjectConfiguration *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
if (caseFriendlyCompare(pc->displayName(), p->displayName()) < 0) {
pos = i;
break;
@@ -533,7 +533,7 @@ void GenericListWidget::displayNameChanged()
QFontMetrics fn(font());
int width = 0;
for (int i = 0; i < count(); ++i) {
ProjectConfiguration *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
auto *p = item(i)->data(Qt::UserRole).value<ProjectConfiguration *>();
width = qMax(width, fn.width(p->displayName()) + padding());
}
setOptimalWidth(width);
@@ -543,7 +543,7 @@ void GenericListWidget::displayNameChanged()
void GenericListWidget::toolTipChanged()
{
ProjectConfiguration *pc = qobject_cast<ProjectConfiguration *>(sender());
auto *pc = qobject_cast<ProjectConfiguration *>(sender());
if (QListWidgetItem *lwi = itemForProjectConfiguration(pc)) {
lwi->setData(Qt::ToolTipRole, pc->toolTip());
lwi->setData(Qt::UserRole + 1, pc->toolTip());
@@ -646,9 +646,9 @@ void KitAreaWidget::updateKit(Kit *k)
QWidget *MiniProjectTargetSelector::createTitleLabel(const QString &text)
{
StyledBar *bar = new StyledBar(this);
auto *bar = new StyledBar(this);
bar->setSingleRow(true);
QVBoxLayout *toolLayout = new QVBoxLayout(bar);
auto *toolLayout = new QVBoxLayout(bar);
toolLayout->setContentsMargins(6, 0, 6, 0);
toolLayout->setSpacing(0);
@@ -864,7 +864,7 @@ void MiniProjectTargetSelector::doLayout(bool keepSize)
// if there's a configured project in the seesion
// that could be improved
static QStatusBar *statusBar = Core::ICore::statusBar();
static QWidget *actionBar = Core::ICore::mainWindow()->findChild<QWidget*>(QLatin1String("actionbar"));
static auto *actionBar = Core::ICore::mainWindow()->findChild<QWidget*>(QLatin1String("actionbar"));
Q_ASSERT(actionBar);
m_kitAreaWidget->move(0, 0);
@@ -1407,7 +1407,7 @@ void MiniProjectTargetSelector::nextOrShow()
} else {
m_hideOnRelease = true;
m_earliestHidetime = QDateTime::currentDateTime().addMSecs(800);
if (ListWidget *lw = qobject_cast<ListWidget *>(focusWidget())) {
if (auto *lw = qobject_cast<ListWidget *>(focusWidget())) {
if (lw->currentRow() < lw->count() -1)
lw->setCurrentRow(lw->currentRow() + 1);
else

View File

@@ -389,10 +389,10 @@ static QByteArray msvcCompilationFile()
"_WIN64",
"_WINRT_DLL",
"_Wp64",
0
nullptr
};
QByteArray file = "#define __PPOUT__(x) V##x=x\n\n";
for (int i = 0; macros[i] != 0; ++i)
for (int i = 0; macros[i] != nullptr; ++i)
file += msvcCompilationDefine(macros[i]);
file += "\nvoid main(){}\n\n";
return file;
@@ -778,7 +778,7 @@ MsvcBasedToolChainConfigWidget::MsvcBasedToolChainConfigWidget(ToolChain *tc) :
void MsvcBasedToolChainConfigWidget::setFromMsvcToolChain()
{
const MsvcToolChain *tc = static_cast<const MsvcToolChain *>(toolChain());
const auto *tc = static_cast<const MsvcToolChain *>(toolChain());
QTC_ASSERT(tc, return);
m_nameDisplayLabel->setText(tc->displayName());
QString varsBatDisplay = QDir::toNativeSeparators(tc->varsBat());
@@ -1251,7 +1251,7 @@ bool MsvcToolChain::operator ==(const ToolChain &other) const
{
if (!AbstractMsvcToolChain::operator ==(other))
return false;
const MsvcToolChain *msvcTc = static_cast<const MsvcToolChain *>(&other);
const auto *msvcTc = static_cast<const MsvcToolChain *>(&other);
return m_varsBatArg == msvcTc->m_varsBatArg;
}

View File

@@ -38,8 +38,7 @@ static inline QByteArray msgFileComparisonFail(const Utils::FileName &f1, const
return result.toLocal8Bit();
}
OutputParserTester::OutputParserTester()
{ }
OutputParserTester::OutputParserTester() = default;
// test functions:
void OutputParserTester::testParsing(const QString &lines,

View File

@@ -62,7 +62,7 @@ public:
setMinimumHeight(1);
setMaximumHeight(1);
}
void paintEvent(QPaintEvent *e)
void paintEvent(QPaintEvent *e) override
{
Q_UNUSED(e);
QPainter p(this);
@@ -77,7 +77,7 @@ public:
RootWidget(QWidget *parent) : QWidget(parent) {
setFocusPolicy(Qt::NoFocus);
}
void paintEvent(QPaintEvent *);
void paintEvent(QPaintEvent *) override;
};
void RootWidget::paintEvent(QPaintEvent *e)
@@ -153,9 +153,7 @@ PanelsWidget::PanelsWidget(const QString &displayName, const QIcon &icon, QWidge
addPropertiesPanel(displayName, icon, widget);
}
PanelsWidget::~PanelsWidget()
{
}
PanelsWidget::~PanelsWidget() = default;
/*
* Add a widget with heading information into the grid

View File

@@ -2447,7 +2447,7 @@ void ProjectExplorerPluginPrivate::runProjectContextMenu()
auto act = qobject_cast<QAction *>(sender());
if (!act)
return;
RunConfiguration *rc = act->data().value<RunConfiguration *>();
auto *rc = act->data().value<RunConfiguration *>();
if (!rc)
return;
m_instance->runRunConfiguration(rc, Constants::NORMAL_RUN_MODE);
@@ -2877,7 +2877,7 @@ void ProjectExplorerPluginPrivate::updateUnloadProjectMenu()
void ProjectExplorerPluginPrivate::updateRecentProjectMenu()
{
typedef QList<QPair<QString, QString> >::const_iterator StringPairListConstIterator;
using StringPairListConstIterator = QList<QPair<QString, QString> >::const_iterator;
ActionContainer *aci = ActionManager::actionContainer(Constants::M_RECENTPROJECTS);
QMenu *menu = aci->menu();
menu->clear();
@@ -2994,7 +2994,7 @@ void ProjectExplorerPluginPrivate::updateContextMenuActions()
} else if (runConfigs.count() > 1) {
runMenu->menu()->menuAction()->setVisible(true);
foreach (RunConfiguration *rc, runConfigs) {
QAction *act = new QAction(runMenu->menu());
auto *act = new QAction(runMenu->menu());
act->setData(QVariant::fromValue(rc));
act->setText(tr("Run %1").arg(rc->displayName()));
runMenu->menu()->addAction(act);
@@ -3099,7 +3099,7 @@ void ProjectExplorerPluginPrivate::updateLocationSubMenus()
for (const FolderNode::LocationInfo &li : locations) {
const int line = li.line;
const Utils::FileName path = li.path;
QAction *action = new QAction(li.displayName, nullptr);
auto *action = new QAction(li.displayName, nullptr);
connect(action, &QAction::triggered, this, [line, path]() {
Core::EditorManager::openEditorAt(path.toString(), line);
});
@@ -3442,7 +3442,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()
m_sessionMenu->clear();
dd->m_sessionMenu->addAction(dd->m_sessionManagerAction);
dd->m_sessionMenu->addSeparator();
QActionGroup *ag = new QActionGroup(m_sessionMenu);
auto *ag = new QActionGroup(m_sessionMenu);
connect(ag, &QActionGroup::triggered, this, &ProjectExplorerPluginPrivate::setSession);
const QString activeSession = SessionManager::activeSession();

View File

@@ -178,7 +178,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return nullptr;
// We claim that everything is editable
// That's slightly wrong
// We control the only view, and that one does the checks

View File

@@ -202,7 +202,7 @@ public:
NavigationTreeView::setModel(newModel);
}
~ProjectTreeView()
~ProjectTreeView() override
{
ICore::removeContextObject(m_context);
delete m_context;
@@ -423,7 +423,7 @@ void ProjectTreeWidget::editCurrentItem()
const Node *node = m_model->nodeForIndex(currentIndex);
if (!node)
return;
QLineEdit *editor = qobject_cast<QLineEdit*>(m_view->indexWidget(currentIndex));
auto *editor = qobject_cast<QLineEdit*>(m_view->indexWidget(currentIndex));
if (!editor)
return;

View File

@@ -78,7 +78,7 @@ public:
: m_factory(factory), m_project(project)
{}
~MiscSettingsPanelItem() { delete m_widget; }
~MiscSettingsPanelItem() override { delete m_widget; }
QVariant data(int column, int role) const override;
Qt::ItemFlags flags(int column) const override;
@@ -174,7 +174,7 @@ public:
Q_UNUSED(column)
if (role == ItemActivatedFromBelowRole) {
TreeItem *item = data.value<TreeItem *>();
auto *item = data.value<TreeItem *>();
QTC_ASSERT(item, return false);
m_currentPanelIndex = indexOf(item);
QTC_ASSERT(m_currentPanelIndex != -1, return false);
@@ -198,7 +198,7 @@ private:
class ProjectItem : public TreeItem
{
public:
ProjectItem() {}
ProjectItem() = default;
ProjectItem(Project *project, const std::function<void()> &changeListener)
: m_project(project), m_changeListener(changeListener)
@@ -279,7 +279,7 @@ public:
QModelIndex activeIndex() const
{
TreeItem *activeItem = data(0, ActiveItemRole).value<TreeItem *>();
auto *activeItem = data(0, ActiveItemRole).value<TreeItem *>();
return activeItem ? activeItem->index() : QModelIndex();
}
@@ -295,7 +295,7 @@ private:
class SelectorDelegate : public QStyledItemDelegate
{
public:
SelectorDelegate() {}
SelectorDelegate() = default;
QSize sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const final;
@@ -538,8 +538,8 @@ public:
void handleImportBuild()
{
ProjectItem *projectItem = m_projectsModel.rootItem()->childAt(0);
Project *project = projectItem ? projectItem->project() : 0;
ProjectImporter *projectImporter = project ? project->projectImporter() : 0;
Project *project = projectItem ? projectItem->project() : nullptr;
ProjectImporter *projectImporter = project ? project->projectImporter() : nullptr;
QTC_ASSERT(projectImporter, return);
QString dir = project->projectDirectory().toString();

View File

@@ -68,8 +68,8 @@ public:
AddNewTree(FolderNode *node, QList<AddNewTree *> children, const QString &displayName);
AddNewTree(FolderNode *node, QList<AddNewTree *> children, const FolderNode::AddNewInformation &info);
QVariant data(int column, int role) const;
Qt::ItemFlags flags(int column) const;
QVariant data(int column, int role) const override;
Qt::ItemFlags flags(int column) const override;
QString displayName() const { return m_displayName; }
FolderNode *node() const { return m_node; }
@@ -202,7 +202,7 @@ void BestNodeSelector::inspect(AddNewTree *tree, bool isContextNode)
AddNewTree *BestNodeSelector::bestChoice() const
{
if (m_deploys)
return 0;
return nullptr;
return m_bestChoice;
}

View File

@@ -890,7 +890,7 @@ public:
}
}
~RunControlPrivate()
~RunControlPrivate() override
{
QTC_CHECK(state == RunControlState::Finished || state == RunControlState::Initialized);
disconnect();
@@ -1048,7 +1048,7 @@ RunWorkerFactory::WorkerCreator RunControl::producer(RunConfiguration *runConfig
if (candidates.empty())
return {};
const auto higherPriority = std::bind(std::greater<int>(),
const auto higherPriority = std::bind(std::greater<>(),
std::bind(&RunWorkerFactory::priority, std::placeholders::_1),
std::bind(&RunWorkerFactory::priority, std::placeholders::_2));
const auto bestFactory = std::max_element(candidates.begin(), candidates.end(), higherPriority);

View File

@@ -700,7 +700,7 @@ void SelectableFilesWidget::parsingFinished()
const Utils::FileNameList preservedFiles = m_model->preservedFiles();
m_preservedFilesLabel->setText(tr("Not showing %n files that are outside of the base directory.\n"
"These files are preserved.", 0, preservedFiles.count()));
"These files are preserved.", nullptr, preservedFiles.count()));
enableWidgets(true);
}

View File

@@ -39,8 +39,8 @@ class SessionValidator : public QValidator
{
public:
SessionValidator(QObject *parent, const QStringList &sessions);
void fixup(QString & input) const;
QValidator::State validate(QString & input, int & pos) const;
void fixup(QString & input) const override;
QValidator::State validate(QString & input, int & pos) const override;
private:
QStringList m_sessions;
};

View File

@@ -42,7 +42,7 @@ public:
}
protected:
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
};
void RemoveItemFocusDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const

View File

@@ -208,7 +208,7 @@ class TargetGroupItemPrivate : public QObject
public:
TargetGroupItemPrivate(TargetGroupItem *q, Project *project);
~TargetGroupItemPrivate();
~TargetGroupItemPrivate() override;
void handleRemovedKit(Kit *kit);
void handleAddedKit(Kit *kit);
@@ -302,7 +302,7 @@ public:
Qt::ItemFlags flags(int column) const override
{
Q_UNUSED(column)
return m_kitErrorsForProject ? Qt::ItemFlags(0)
return m_kitErrorsForProject ? Qt::ItemFlags({})
: Qt::ItemFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
@@ -375,7 +375,7 @@ public:
Q_UNUSED(column)
if (role == ContextMenuItemAdderRole) {
QMenu *menu = data.value<QMenu *>();
auto *menu = data.value<QMenu *>();
addToContextMenu(menu);
return true;
}
@@ -663,7 +663,7 @@ public:
{
Q_UNUSED(column)
if (role == ContextMenuItemAdderRole) {
QMenu *menu = data.value<QMenu *>();
auto *menu = data.value<QMenu *>();
auto enableAction = menu->addAction(tr("Enable Kit"));
enableAction->setEnabled(!isEnabled());
QObject::connect(enableAction, &QAction::triggered, [this] {

View File

@@ -529,13 +529,13 @@ TargetSetupWidget *TargetSetupPage::addWidget(Kit *k)
if (factory)
return factory->availableSetups(k, m_projectPath);
BuildInfo *info = new BuildInfo(nullptr);
auto *info = new BuildInfo(nullptr);
info->kitId = k->id();
return QList<BuildInfo *>({info});
}();
// Not all projects have BuildConfigurations, that is perfectly fine.
TargetSetupWidget *widget = new TargetSetupWidget(k, m_projectPath);
auto *widget = new TargetSetupWidget(k, m_projectPath);
m_baseLayout->removeWidget(m_importWidget);
foreach (QWidget *potentialWidget, m_potentialWidgets)

View File

@@ -149,7 +149,7 @@ void TargetSetupWidget::addBuildInfo(BuildInfo *info, bool isImport)
m_haveImported = true;
}
const int pos = static_cast<int>(m_infoStore.size());
const auto pos = static_cast<int>(m_infoStore.size());
BuildInfoStore store;
store.buildInfo = info;
@@ -233,7 +233,7 @@ QList<BuildInfo *> TargetSetupWidget::buildInfoList(const Kit *k, const QString
if (factory)
return factory->availableSetups(k, projectPath);
BuildInfo *info = new BuildInfo(nullptr);
auto *info = new BuildInfo(nullptr);
info->kitId = k->id();
return QList<BuildInfo *>({info});
}
@@ -303,7 +303,7 @@ void TargetSetupWidget::pathChanged()
void TargetSetupWidget::reportIssues(int index)
{
const int size = static_cast<int>(m_infoStore.size());
const auto size = static_cast<int>(m_infoStore.size());
QTC_ASSERT(index >= 0 && index < size, return);
BuildInfoStore &store = m_infoStore[static_cast<size_t>(index)];

View File

@@ -76,12 +76,12 @@ public:
setVisible(!task.icon.isNull());
}
bool isClickable() const;
void clicked();
bool isClickable() const override;
void clicked() override;
void updateFileName(const FileName &fileName);
void updateLineNumber(int lineNumber);
void removedFromEditor();
void updateFileName(const FileName &fileName) override;
void updateLineNumber(int lineNumber) override;
void removedFromEditor() override;
private:
unsigned int m_id;
};

View File

@@ -161,7 +161,7 @@ void TaskModel::updateTaskLineNumber(unsigned int id, int line)
void TaskModel::clearTasks(Core::Id categoryId)
{
typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt;
using IdCategoryConstIt = QHash<Core::Id,CategoryData>::ConstIterator;
if (!categoryId.isValid()) {
if (m_tasks.isEmpty())

View File

@@ -74,9 +74,9 @@ namespace Internal {
class TaskView : public Utils::ListView
{
public:
TaskView(QWidget *parent = 0);
~TaskView();
void resizeEvent(QResizeEvent *e);
TaskView(QWidget *parent = nullptr);
~TaskView() override;
void resizeEvent(QResizeEvent *e) override;
};
class TaskWindowContext : public Core::IContext
@@ -92,10 +92,10 @@ class TaskDelegate : public QStyledItemDelegate
friend class TaskView; // for using Positions::minimumSize()
public:
TaskDelegate(QObject * parent = 0);
~TaskDelegate();
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
TaskDelegate(QObject * parent = nullptr);
~TaskDelegate() override;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
// TaskView uses this method if the size of the taskview changes
void emitSizeHintChanged(const QModelIndex &index);
@@ -105,7 +105,7 @@ public:
private:
void generateGradientPixmap(int width, int height, QColor color, bool selected) const;
mutable int m_cachedHeight;
mutable int m_cachedHeight = 0;
mutable QFont m_cachedFont;
/*
@@ -194,8 +194,7 @@ TaskView::TaskView(QWidget *parent)
verticalScrollBar()->setSingleStep(vStepSize);
}
TaskView::~TaskView()
{ }
TaskView::~TaskView() = default;
void TaskView::resizeEvent(QResizeEvent *e)
{
@@ -253,7 +252,7 @@ TaskWindow::TaskWindow() : d(new TaskWindowPrivate)
d->m_listview->setFrameStyle(QFrame::NoFrame);
d->m_listview->setWindowTitle(displayName());
d->m_listview->setSelectionMode(QAbstractItemView::SingleSelection);
Internal::TaskDelegate *tld = new Internal::TaskDelegate(this);
auto *tld = new Internal::TaskDelegate(this);
d->m_listview->setItemDelegate(tld);
d->m_listview->setWindowIcon(Icons::WINDOW.icon());
d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
@@ -533,7 +532,7 @@ void TaskWindow::setShowWarnings(bool show)
void TaskWindow::updateCategoriesMenu()
{
typedef QMap<QString, Core::Id>::ConstIterator NameToIdsConstIt;
using NameToIdsConstIt = QMap<QString, Core::Id>::ConstIterator;
d->m_categoriesMenu->clear();
@@ -670,13 +669,10 @@ bool TaskWindow::canNavigate() const
/////
TaskDelegate::TaskDelegate(QObject *parent) :
QStyledItemDelegate(parent),
m_cachedHeight(0)
QStyledItemDelegate(parent)
{ }
TaskDelegate::~TaskDelegate()
{
}
TaskDelegate::~TaskDelegate() = default;
QSize TaskDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{

View File

@@ -53,7 +53,7 @@ namespace Internal {
class ToolChainPrivate
{
public:
typedef ToolChain::Detection Detection;
using Detection = ToolChain::Detection;
explicit ToolChainPrivate(Core::Id typeId, Detection d) :
m_id(QUuid::createUuid().toByteArray()),

View File

@@ -75,7 +75,7 @@ public:
}
}
QVariant data(int column, int role) const
QVariant data(int column, int role) const override
{
switch (role) {
case Qt::DisplayRole:

View File

@@ -287,7 +287,7 @@ QList<ToolChain *> ToolChainSettingsAccessor::toolChains(const QVariantMap &data
namespace ProjectExplorer {
typedef QList<ToolChain *> TCList;
using TCList = QList<ToolChain *>;
class TTC : public ToolChain
{

View File

@@ -59,7 +59,7 @@ class UserFileVersion1Upgrader : public VersionUpgrader
{
public:
UserFileVersion1Upgrader(UserFileAccessor *a) : VersionUpgrader(1, "1.3+git"), m_accessor(a) { }
QVariantMap upgrade(const QVariantMap &map);
QVariantMap upgrade(const QVariantMap &map) override;
private:
struct TargetDescription
@@ -433,7 +433,7 @@ public:
FileNameList UserFileBackUpStrategy::readFileCandidates(const FileName &baseFileName) const
{
const UserFileAccessor *const ac = static_cast<const UserFileAccessor *>(accessor());
const auto *const ac = static_cast<const UserFileAccessor *>(accessor());
const FileName externalUser = ac->externalUserFile();
const FileName projectUser = ac->projectUserFile();
QTC_CHECK(!baseFileName.isEmpty());
@@ -1203,9 +1203,9 @@ static const char * const envExpandedKeys[] = {
"Qt4ProjectManager.S60DeviceRunConfiguration.CommandLineArguments",
"CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory",
"CMakeProjectManager.CMakeRunConfiguration.Arguments",
0,
0,
0
nullptr,
nullptr,
nullptr
};
static QString version8NewVar(const QString &old)
@@ -1314,11 +1314,11 @@ static const char * const varExpandedKeys[] = {
"GenericProjectManager.GenericMakeStep.MakeCommand",
"GenericProjectManager.GenericMakeStep.MakeArguments",
"GenericProjectManager.GenericMakeStep.BuildTargets",
0,
0,
0,
0,
0
nullptr,
nullptr,
nullptr,
nullptr,
nullptr
};
// Translate old-style ${} var expansions into new-style %{} ones
@@ -2238,7 +2238,7 @@ public:
TestUserFileAccessor(Project *project) : UserFileAccessor(project) { }
void storeSharedSettings(const QVariantMap &data) const { m_storedSettings = data; }
QVariant retrieveSharedSettings() const { return m_storedSettings; }
QVariant retrieveSharedSettings() const override { return m_storedSettings; }
using UserFileAccessor::preprocessReadSettings;
using UserFileAccessor::prepareToWriteSettings;

View File

@@ -81,31 +81,31 @@ WinDebugInterface::~WinDebugInterface()
void WinDebugInterface::run()
{
m_waitHandles[DataReadyEventHandle] = m_waitHandles[TerminateEventHandle] = 0;
m_bufferReadyEvent = 0;
m_sharedFile = 0;
m_sharedMem = 0;
m_waitHandles[DataReadyEventHandle] = m_waitHandles[TerminateEventHandle] = nullptr;
m_bufferReadyEvent = nullptr;
m_sharedFile = nullptr;
m_sharedMem = nullptr;
if (!runLoop())
emit cannotRetrieveDebugOutput();
if (m_sharedMem) {
UnmapViewOfFile(m_sharedMem);
m_sharedMem = 0;
m_sharedMem = nullptr;
}
if (m_sharedFile) {
CloseHandle(m_sharedFile);
m_sharedFile = 0;
m_sharedFile = nullptr;
}
if (m_waitHandles[TerminateEventHandle]) {
CloseHandle(m_waitHandles[TerminateEventHandle]);
m_waitHandles[TerminateEventHandle] = 0;
m_waitHandles[TerminateEventHandle] = nullptr;
}
if (m_waitHandles[DataReadyEventHandle]) {
CloseHandle(m_waitHandles[DataReadyEventHandle]);
m_waitHandles[DataReadyEventHandle] = 0;
m_waitHandles[DataReadyEventHandle] = nullptr;
}
if (m_bufferReadyEvent) {
CloseHandle(m_bufferReadyEvent);
m_bufferReadyEvent = 0;
m_bufferReadyEvent = nullptr;
}
}
@@ -130,7 +130,7 @@ bool WinDebugInterface::runLoop()
return false;
LPSTR message = reinterpret_cast<LPSTR>(m_sharedMem) + sizeof(DWORD);
LPDWORD processId = reinterpret_cast<LPDWORD>(m_sharedMem);
auto processId = reinterpret_cast<LPDWORD>(m_sharedMem);
SetEvent(m_bufferReadyEvent);

View File

@@ -270,8 +270,8 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
void ProjectExplorerPlugin::testXcodebuildParserParsing()
{
OutputParserTester testbench;
XcodebuildParser *childParser = new XcodebuildParser;
XcodebuildParserTester *tester = new XcodebuildParserTester(childParser);
auto *childParser = new XcodebuildParser;
auto *tester = new XcodebuildParserTester(childParser);
connect(&testbench, &OutputParserTester::aboutToDeleteParser,
tester, &XcodebuildParserTester::onAboutToDeleteParser);