diff --git a/cgview/main.cpp b/cgview/main.cpp --- a/cgview/main.cpp +++ b/cgview/main.cpp @@ -118,7 +118,7 @@ return 1; } } - Q_ASSERT( et!=0 ); + Q_ASSERT( et!=nullptr ); out << "Sorted by: " << (sortByExcl ? "Exclusive ":"Inclusive ") << et->longName() << " (" << et->name() << ")" << endl; diff --git a/kcachegrind/configdlg.h b/kcachegrind/configdlg.h --- a/kcachegrind/configdlg.h +++ b/kcachegrind/configdlg.h @@ -44,8 +44,8 @@ public: ConfigDlg(GlobalGUIConfig*, TraceData*, - QWidget* parent = 0); - ~ConfigDlg(); + QWidget* parent = nullptr); + ~ConfigDlg() override; static bool configure(GlobalGUIConfig*, TraceData*, QWidget*); diff --git a/kcachegrind/configdlg.cpp b/kcachegrind/configdlg.cpp --- a/kcachegrind/configdlg.cpp +++ b/kcachegrind/configdlg.cpp @@ -39,9 +39,9 @@ { _config = c; _data = data; - _objectCS = 0; - _classCS = 0; - _fileCS = 0; + _objectCS = nullptr; + _classCS = nullptr; + _fileCS = nullptr; connect(objectCombo, SIGNAL(activated(const QString &)), this, SLOT(objectActivated(const QString &))); @@ -206,7 +206,7 @@ { // qDebug("objectActivated: %s", s.ascii()); - if (s.isEmpty()) { _objectCS=0; return; } + if (s.isEmpty()) { _objectCS=nullptr; return; } QString n = ProfileContext::typeName(ProfileContext::Object) + '-' + s; @@ -250,7 +250,7 @@ { // qDebug("classActivated: %s", s.ascii()); - if (s.isEmpty()) { _classCS=0; return; } + if (s.isEmpty()) { _classCS=nullptr; return; } QString n = ProfileContext::typeName(ProfileContext::Class) + '-' + s; @@ -281,7 +281,7 @@ { // qDebug("fileActivated: %s", s.ascii()); - if (s.isEmpty()) { _fileCS=0; return; } + if (s.isEmpty()) { _fileCS=nullptr; return; } QString n = ProfileContext::typeName(ProfileContext::File) + '-' + s; @@ -309,20 +309,20 @@ QTreeWidgetItem *ConfigDlg::getSelectedDirItem() { const QList selectedItems = dirList->selectedItems(); - return selectedItems.count() ? selectedItems[0] : NULL; + return selectedItems.count() ? selectedItems[0] : nullptr; } void ConfigDlg::dirsItemChanged() { QTreeWidgetItem *dirItem = getSelectedDirItem(); - deleteDirButton->setEnabled(dirItem && dirItem->parent() != NULL); - addDirButton->setEnabled(dirItem && dirItem->parent() == NULL); + deleteDirButton->setEnabled(dirItem && dirItem->parent() != nullptr); + addDirButton->setEnabled(dirItem && dirItem->parent() == nullptr); } void ConfigDlg::dirsDeletePressed() { QTreeWidgetItem *dirItem = getSelectedDirItem(); - if (!dirItem || (dirItem->parent() == 0)) return; + if (!dirItem || (dirItem->parent() == nullptr)) return; QTreeWidgetItem* p = dirItem->parent(); if (!p) return; @@ -343,7 +343,7 @@ void ConfigDlg::dirsAddPressed() { QTreeWidgetItem *dirItem = getSelectedDirItem(); - if (!dirItem || (dirItem->parent() != 0)) return; + if (!dirItem || (dirItem->parent() != nullptr)) return; QString objName = dirItem->text(0); diff --git a/kcachegrind/kdeconfig.h b/kcachegrind/kdeconfig.h --- a/kcachegrind/kdeconfig.h +++ b/kcachegrind/kdeconfig.h @@ -34,11 +34,11 @@ friend class KDEConfigStorage; public: - ~KDEConfigGroup(); + ~KDEConfigGroup() override; void setValue(const QString& key, const QVariant& value, - const QVariant& defaultValue = QVariant()); - QVariant value(const QString& key, const QVariant& defaultValue) const; + const QVariant& defaultValue = QVariant()) override; + QVariant value(const QString& key, const QVariant& defaultValue) const override; private: KDEConfigGroup(KConfigGroup*, bool); @@ -55,7 +55,7 @@ private: ConfigGroup* getGroup(const QString& group, - const QString& optSuffix); + const QString& optSuffix) override; KConfig* _kconfig; }; diff --git a/kcachegrind/kdeconfig.cpp b/kcachegrind/kdeconfig.cpp --- a/kcachegrind/kdeconfig.cpp +++ b/kcachegrind/kdeconfig.cpp @@ -47,7 +47,7 @@ void KDEConfigGroup::setValue(const QString& key, const QVariant& value, const QVariant& defaultValue) { - if ((_kgroup == 0) || _readOnly) return; + if ((_kgroup == nullptr) || _readOnly) return; if (value == defaultValue) { _kgroup->deleteEntry(key); @@ -82,7 +82,7 @@ QVariant KDEConfigGroup::value(const QString& key, const QVariant& defaultValue) const { - if (_kgroup == 0) return defaultValue; + if (_kgroup == nullptr) return defaultValue; switch(defaultValue.type()) { case QVariant::Bool: @@ -135,7 +135,7 @@ else if (gList.contains(group)) g = new KConfigGroup(_kconfig, group); else - g = 0; + g = nullptr; } else { readOnly = false; diff --git a/kcachegrind/toplevel.h b/kcachegrind/toplevel.h --- a/kcachegrind/toplevel.h +++ b/kcachegrind/toplevel.h @@ -63,38 +63,38 @@ Q_CLASSINFO("D-Bus Interface", "org.kde.kcachegrind") public: TopLevel(); - ~TopLevel(); + ~TopLevel() override; TraceData* data() { return _data; } void setData(TraceData*); - virtual void saveProperties(KConfigGroup &); - virtual void readProperties(const KConfigGroup &); + void saveProperties(KConfigGroup &) override; + void readProperties(const KConfigGroup &) override; void createActions(); void createDocks(); ProfileContext::Type groupType() { return _groupType; } EventType* eventType() { return _eventType; } EventType* eventType2() { return _eventType2; } TracePartList activeParts() { return _activeParts; } - TracePartList hiddenParts() { return _hiddenParts; } + TracePartList hiddenParts() override { return _hiddenParts; } // current config bool showPercentage() const { return _showPercentage; } bool showExpanded() const { return _showExpanded; } bool showCycles() const { return _showCycles; } /* convenience functions for often used context menu items */ - void addEventTypeMenu(QMenu*,bool); - void addGoMenu(QMenu*); + void addEventTypeMenu(QMenu*,bool) override; + void addGoMenu(QMenu*) override; // Logger overwrites: notifications for file loading - virtual void loadStart(const QString& filename); - virtual void loadProgress(int progress); // 0 - 100 - virtual void loadWarning(int line, const QString& msg); - virtual void loadError(int line, const QString& msg); - virtual void loadFinished(const QString& msg); // msg could be error + void loadStart(const QString& filename) override; + void loadProgress(int progress) override; // 0 - 100 + void loadWarning(int line, const QString& msg) override; + void loadError(int line, const QString& msg) override; + void loadFinished(const QString& msg) override; // msg could be error public slots: void load(); @@ -130,9 +130,9 @@ void groupTypeSelected(int); void splitSlot(); void splitDirSlot(); - void configureToolbars(); + void configureToolbars() override; void configureKeys(); - bool queryClose(); + bool queryClose() override; void togglePartDock(); void toggleStackDock(); void toggleFunctionDock(); @@ -169,25 +169,25 @@ bool setGroup(QString); bool setFunction(TraceFunction*); bool setFunction(QString); - void activePartsChangedSlot(const TracePartList& list); + void activePartsChangedSlot(const TracePartList& list) override; void partsHideSelectedSlot(); void partsUnhideAllSlot(); /* These go back to mainloop first by using a timer. * So they can be called from event handlers that * are not allowed to delete list entries. */ - void setEventTypeDelayed(EventType*); - void setEventType2Delayed(EventType*); - void setGroupTypeDelayed(ProfileContext::Type); - void setGroupDelayed(TraceCostItem*); - void setTraceItemDelayed(CostItem*); + void setEventTypeDelayed(EventType*) override; + void setEventType2Delayed(EventType*) override; + void setGroupTypeDelayed(ProfileContext::Type) override; + void setGroupDelayed(TraceCostItem*) override; + void setTraceItemDelayed(CostItem*) override; void partsHideSelectedSlotDelayed(); void partsUnhideAllSlotDelayed(); void goBack(); void goForward(); void goUp(); - void setDirectionDelayed(TraceItemView::Direction); + void setDirectionDelayed(TraceItemView::Direction) override; /* SingleShot Slots (without parameters) for the delayed versions */ void setEventTypeDelayed(); @@ -199,15 +199,15 @@ void setDirectionDelayed(); // configuration has changed - void configChanged(); + void configChanged() override; //void refresh(); void slotShowTipOnStart(); void slotShowTip(); // progress in status bar, empty message disables progress display void showStatus(const QString& msg, int progress); - void showMessage(const QString&, int msec); + void showMessage(const QString&, int msec) override; // for running callgrind_control in the background void ccReadOutput(); diff --git a/kcachegrind/toplevel.cpp b/kcachegrind/toplevel.cpp --- a/kcachegrind/toplevel.cpp +++ b/kcachegrind/toplevel.cpp @@ -79,15 +79,15 @@ #include "callgraphview.h" TopLevel::TopLevel() - : KXmlGuiWindow(0) + : KXmlGuiWindow(nullptr) { QDBusConnection::sessionBus().registerObject(QStringLiteral("/KCachegrind"), this, QDBusConnection::ExportScriptableSlots); - _progressBar = 0; + _progressBar = nullptr; _statusbar = statusBar(); _statusLabel = new QLabel(_statusbar); _statusbar->addWidget(_statusLabel, 1); - _ccProcess = 0; + _ccProcess = nullptr; _layoutCount = 1; _layoutCurrent = 0; @@ -157,21 +157,21 @@ _activeParts.clear(); _hiddenParts.clear(); - _data = 0; - _function = 0; - _eventType = 0; - _eventType2 = 0; + _data = nullptr; + _function = nullptr; + _eventType = nullptr; + _eventType2 = nullptr; _groupType = ProfileContext::InvalidType; - _group = 0; + _group = nullptr; // for delayed slots - _traceItemDelayed = 0; - _eventTypeDelayed = 0; - _eventType2Delayed = 0; + _traceItemDelayed = nullptr; + _eventTypeDelayed = nullptr; + _eventType2Delayed = nullptr; _groupTypeDelayed = ProfileContext::InvalidType; - _groupDelayed = 0; + _groupDelayed = nullptr; _directionDelayed = TraceItemView::None; - _lastSender = 0; + _lastSender = nullptr; } @@ -1092,7 +1092,7 @@ { EventType* ct; - ct = (_data) ? _data->eventTypes()->type(s) : 0; + ct = (_data) ? _data->eventTypes()->type(s) : nullptr; // if costtype with given name not found, use first available if (!ct && _data) ct = _data->eventTypes()->type(0); @@ -1105,24 +1105,24 @@ EventType* ct; // Special type i18n("(Hidden)") gives 0 - ct = (_data) ? _data->eventTypes()->type(s) : 0; + ct = (_data) ? _data->eventTypes()->type(s) : nullptr; return setEventType2(ct); } void TopLevel::eventTypeSelected(const QString& s) { EventType* ct; - ct = (_data) ? _data->eventTypes()->typeForLong(s) : 0; + ct = (_data) ? _data->eventTypes()->typeForLong(s) : nullptr; setEventType(ct); } void TopLevel::eventType2Selected(const QString& s) { EventType* ct; - ct = (_data) ? _data->eventTypes()->typeForLong(s) : 0; + ct = (_data) ? _data->eventTypes()->typeForLong(s) : nullptr; setEventType2(ct); } @@ -1366,9 +1366,9 @@ case TraceItemView::Up: { - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; - TraceFunction* f = hi ? hi->function() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; + TraceFunction* f = hi ? hi->function() : nullptr; if (!f) break; f = hi->stack()->caller(f, false); @@ -1429,8 +1429,8 @@ default: break; } - _traceItemDelayed = 0; - _lastSender = 0; + _traceItemDelayed = nullptr; + _lastSender = nullptr; } /** @@ -1443,15 +1443,15 @@ { if (data == _data) return; - _lastSender = 0; + _lastSender = nullptr; saveTraceSettings(); if (_data) { - _partSelection->setData(0); - _stackSelection->setData(0); - _functionSelection->setData(0); - _multiView->setData(0); + _partSelection->setData(nullptr); + _stackSelection->setData(nullptr); + _functionSelection->setData(nullptr); + _multiView->setData(nullptr); _multiView->updateView(true); // we are the owner... @@ -1526,7 +1526,7 @@ void TopLevel::addEventTypeMenu(QMenu* popup, bool withCost2) { if (_data) { - QMenu *popup1, *popup2 = 0; + QMenu *popup1, *popup2 = nullptr; QAction* action; popup1 = popup->addMenu(i18n("Primary Event Type")); @@ -1591,10 +1591,10 @@ bool TopLevel::setEventType(QAction* action) { if (!_data) return false; - int id = action->data().toInt(0); + int id = action->data().toInt(nullptr); EventTypeSet* m = _data->eventTypes(); - EventType* ct=0; + EventType* ct=nullptr; if (id >=100 && id<199) ct = m->realType(id-100); if (id >=200 && id<299) ct = m->derivedType(id-200); @@ -1604,10 +1604,10 @@ bool TopLevel::setEventType2(QAction* action) { if (!_data) return false; - int id = action->data().toInt(0); + int id = action->data().toInt(nullptr); EventTypeSet* m = _data->eventTypes(); - EventType* ct=0; + EventType* ct=nullptr; if (id >=100 && id<199) ct = m->realType(id-100); if (id >=200 && id<299) ct = m->derivedType(id-200); @@ -2031,14 +2031,14 @@ qDebug("TopLevel::forceTrace: killing old callgrind_control"); _ccProcess->kill(); delete _ccProcess; - _ccProcess = 0; + _ccProcess = nullptr; _ccOutput = QString(); } if (!_taDump->isChecked()) return; // get PID of first loaded part int pid = 0; - TracePart* p = 0; + TracePart* p = nullptr; TracePartList pl; if (_data) pl = _data->parts(); if (!pl.isEmpty()) p = pl.first(); @@ -2088,7 +2088,7 @@ showMessage(i18n("Error running callgrind_control"), 5000); _ccProcess->deleteLater(); - _ccProcess = 0; + _ccProcess = nullptr; } void TopLevel::ccExit(int exitCode, QProcess::ExitStatus s) @@ -2101,7 +2101,7 @@ if (!_ccProcess) return; if (p != _ccProcess) return; _ccProcess->deleteLater(); - _ccProcess = 0; + _ccProcess = nullptr; _taDump->setChecked(false); // if not successful no need to reload @@ -2118,8 +2118,8 @@ QMenu *popup = _paForward->menu(); popup->clear(); - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; TraceFunction* f; QAction* action; @@ -2155,8 +2155,8 @@ QMenu *popup = _paBack->menu(); popup->clear(); - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; TraceFunction* f; QAction* action; @@ -2192,9 +2192,9 @@ QMenu *popup = _paUp->menu(); popup->clear(); - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; - TraceFunction* f = hi ? hi->function() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; + TraceFunction* f = hi ? hi->function() : nullptr; QAction* action; if (!f) { @@ -2222,12 +2222,12 @@ void TopLevel::forwardTriggered(QAction* action) { - int count = action->data().toInt(0); + int count = action->data().toInt(nullptr); //qDebug("forwardTriggered: %d", count); if( count <= 0) return; - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; if (!b) return; while (count>1) { @@ -2239,12 +2239,12 @@ void TopLevel::backTriggered(QAction* action) { - int count = action->data().toInt(0); + int count = action->data().toInt(nullptr); //qDebug("backTriggered: %d", count); if( count <= 0) return; - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; if (!b) return; while (count>1) { @@ -2256,13 +2256,13 @@ void TopLevel::upTriggered(QAction* action) { - int count = action->data().toInt(0); + int count = action->data().toInt(nullptr); //qDebug("upTriggered: %d", count); if( count <= 0) return; - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; if (!hi) return; TraceFunction* f = hi->function(); @@ -2294,7 +2294,7 @@ if (_progressBar) { _statusbar->removeWidget(_progressBar); delete _progressBar; - _progressBar = 0; + _progressBar = nullptr; } _statusbar->clearMessage(); _progressMsg = msg; diff --git a/libcore/cachegrindloader.cpp b/libcore/cachegrindloader.cpp --- a/libcore/cachegrindloader.cpp +++ b/libcore/cachegrindloader.cpp @@ -40,8 +40,8 @@ public: CachegrindLoader(); - bool canLoad(QIODevice* file); - int load(TraceData*, QIODevice* file, const QString& filename); + bool canLoad(QIODevice* file) override; + int load(TraceData*, QIODevice* file, const QString& filename) override; private: void error(QString); @@ -362,10 +362,10 @@ int p = name.indexOf(')'); if (p<2) { error(QStringLiteral("Invalid compressed ELF object ('%1')").arg(name)); - return 0; + return nullptr; } int index = name.midRef(1, p-1).toInt(); - TraceObject* o = 0; + TraceObject* o = nullptr; p++; while((name.length()>p) && name.at(p).isSpace()) p++; if (name.length()>p) { @@ -390,9 +390,9 @@ } else { if ((_objectVector.size() <= index) || - ( (o=(TraceObject*)_objectVector.at(index)) == 0)) { + ( (o=(TraceObject*)_objectVector.at(index)) == nullptr)) { error(QStringLiteral("Undefined compressed ELF object index %1").arg(index)); - return 0; + return nullptr; } } @@ -410,10 +410,10 @@ int p = name.indexOf(')'); if (p<2) { error(QStringLiteral("Invalid compressed file ('%1')").arg(name)); - return 0; + return nullptr; } int index = name.midRef(1, p-1).toUInt(); - TraceFile* f = 0; + TraceFile* f = nullptr; p++; while((name.length()>p) && name.at(p).isSpace()) p++; if (name.length()>p) { @@ -438,9 +438,9 @@ } else { if ((_fileVector.size() <= index) || - ( (f=(TraceFile*)_fileVector.at(index)) == 0)) { + ( (f=(TraceFile*)_fileVector.at(index)) == nullptr)) { error(QStringLiteral("Undefined compressed file index %1").arg(index)); - return 0; + return nullptr; } } @@ -461,12 +461,12 @@ int p = name.indexOf(')'); if (p<2) { error(QStringLiteral("Invalid compressed function ('%1')").arg(name)); - return 0; + return nullptr; } int index = name.midRef(1, p-1).toUInt(); - TraceFunction* f = 0; + TraceFunction* f = nullptr; p++; while((name.length()>p) && name.at(p).isSpace()) p++; if (name.length()>p) { @@ -499,9 +499,9 @@ } else { if ((_functionVector.size() <= index) || - ( (f=(TraceFunction*)_functionVector.at(index)) == 0)) { + ( (f=(TraceFunction*)_functionVector.at(index)) == nullptr)) { error(QStringLiteral("Undefined compressed function index %1").arg(index)); - return 0; + return nullptr; } // there was a check if the used function (returned from KCachegrinds @@ -533,8 +533,8 @@ } currentPartObject = currentObject->partObject(_part); - currentFunction = 0; - currentPartFunction = 0; + currentFunction = nullptr; + currentPartFunction = nullptr; } void CachegrindLoader::setCalledObject(const QString& name) @@ -571,8 +571,8 @@ } currentPartFile = currentFile->partFile(_part); - currentLine = 0; - currentPartLine = 0; + currentLine = nullptr; + currentPartLine = nullptr; } void CachegrindLoader::setCalledFile(const QString& name) @@ -627,9 +627,9 @@ currentPartFile, currentPartObject); - currentFunctionSource = 0; - currentLine = 0; - currentPartLine = 0; + currentFunctionSource = nullptr; + currentLine = nullptr; + currentPartLine = nullptr; } void CachegrindLoader::setCalledFunction(const QString& name) @@ -669,43 +669,43 @@ currentPos = PositionSpec(); // current function/line - currentFunction = 0; - currentPartFunction = 0; - currentFunctionSource = 0; - currentFile = 0; - currentFunctionFile = 0; - currentPartFile = 0; - currentObject = 0; - currentPartObject = 0; - currentLine = 0; - currentPartLine = 0; - currentInstr = 0; - currentPartInstr = 0; + currentFunction = nullptr; + currentPartFunction = nullptr; + currentFunctionSource = nullptr; + currentFile = nullptr; + currentFunctionFile = nullptr; + currentPartFile = nullptr; + currentObject = nullptr; + currentPartObject = nullptr; + currentLine = nullptr; + currentPartLine = nullptr; + currentInstr = nullptr; + currentPartInstr = nullptr; // current call - currentCalledObject = 0; - currentCalledPartObject = 0; - currentCalledFile = 0; - currentCalledPartFile = 0; - currentCalledFunction = 0; - currentCalledPartFunction = 0; + currentCalledObject = nullptr; + currentCalledPartObject = nullptr; + currentCalledFile = nullptr; + currentCalledPartFile = nullptr; + currentCalledFunction = nullptr; + currentCalledPartFunction = nullptr; currentCallCount = 0; // current jump - currentJumpToFile = 0; - currentJumpToFunction = 0; + currentJumpToFile = nullptr; + currentJumpToFunction = nullptr; targetPos = PositionSpec(); jumpsFollowed = 0; jumpsExecuted = 0; - mapping = 0; + mapping = nullptr; } void CachegrindLoader::prepareNewPart() { if (_part) { // really new part needed? - if (mapping == 0) return; + if (mapping == nullptr) return; // yes _part->invalidate(); @@ -749,7 +749,7 @@ FixPool* pool = _data->fixPool(); #endif - _part = 0; + _part = nullptr; partsAdded = 0; prepareNewPart(); @@ -1265,10 +1265,10 @@ _data->updateMaxCallCount(partLineCall->callCount()); } #endif - currentCalledFile = 0; - currentCalledPartFile = 0; - currentCalledObject = 0; - currentCalledPartObject = 0; + currentCalledFile = nullptr; + currentCalledPartFile = nullptr; + currentCalledObject = nullptr; + currentCalledPartObject = nullptr; currentCallCount = 0; if (!line.isEmpty()) { @@ -1347,8 +1347,8 @@ } nextLineType = SelfCost; - currentJumpToFunction = 0; - currentJumpToFile = 0; + currentJumpToFunction = nullptr; + currentJumpToFile = nullptr; if (!line.isEmpty()) { error(QStringLiteral("Garbage at end of jump cost line ('%1')").arg(line)); diff --git a/libcore/config.cpp b/libcore/config.cpp --- a/libcore/config.cpp +++ b/libcore/config.cpp @@ -67,20 +67,20 @@ // ConfigStorage // -ConfigStorage* ConfigStorage::_storage = 0; +ConfigStorage* ConfigStorage::_storage = nullptr; ConfigStorage::ConfigStorage() { - _storage = 0; + _storage = nullptr; } ConfigStorage::~ConfigStorage() {} ConfigGroup* ConfigStorage::group(const QString& group, const QString& optSuffix) { - Q_ASSERT(_storage != 0); + Q_ASSERT(_storage != nullptr); return _storage->getGroup(group, optSuffix); } diff --git a/libcore/context.cpp b/libcore/context.cpp --- a/libcore/context.cpp +++ b/libcore/context.cpp @@ -23,9 +23,9 @@ //--------------------------------------------------- // ProfileContext -ProfileContext* ProfileContext::_contexts = 0; -QString* ProfileContext::_typeName = 0; -QString* ProfileContext::_i18nTypeName = 0; +ProfileContext* ProfileContext::_contexts = nullptr; +QString* ProfileContext::_typeName = nullptr; +QString* ProfileContext::_i18nTypeName = nullptr; ProfileContext::ProfileContext(ProfileContext::Type t) @@ -47,15 +47,15 @@ { if (_typeName) { delete [] _typeName; - _typeName = 0; + _typeName = nullptr; } if (_i18nTypeName) { delete [] _i18nTypeName; - _i18nTypeName = 0; + _i18nTypeName = nullptr; } if (_contexts) { delete [] _contexts; - _contexts = 0; + _contexts = nullptr; } } diff --git a/libcore/costitem.h b/libcore/costitem.h --- a/libcore/costitem.h +++ b/libcore/costitem.h @@ -153,11 +153,11 @@ explicit ProfileCostArray(ProfileContext*); ProfileCostArray(); - virtual ~ProfileCostArray(); + ~ProfileCostArray() override; - virtual QString costString(EventTypeSet*); + QString costString(EventTypeSet*) override; - virtual void clear(); + void clear() override; // reserve space for cost void reserve(int); @@ -178,7 +178,7 @@ void maxCost(int index, SubCost value); ProfileCostArray diff(ProfileCostArray* item); - virtual void invalidate(); + void invalidate() override; /** Returns a sub cost. This automatically triggers * a call to update() if needed. @@ -193,7 +193,7 @@ QString prettySubCostPerCall(EventType* t, uint64 calls); protected: - virtual void update(); + void update() override; private: // Only used by friend class EventType: return subcost by index diff --git a/libcore/costitem.cpp b/libcore/costitem.cpp --- a/libcore/costitem.cpp +++ b/libcore/costitem.cpp @@ -32,8 +32,8 @@ CostItem::CostItem(ProfileContext* c) { - _position = 0; - _dep = 0; + _position = nullptr; + _dep = nullptr; _dirty = true; _context = c; @@ -85,7 +85,7 @@ QString CostItem::toString() { - return QStringLiteral("%1\n [%3]").arg(fullName()).arg(costString(0)); + return QStringLiteral("%1\n [%3]").arg(fullName()).arg(costString(nullptr)); } void CostItem::invalidate() @@ -104,22 +104,22 @@ TracePart* CostItem::part() { - return _position ? _position->part() : 0; + return _position ? _position->part() : nullptr; } const TracePart* CostItem::part() const { - return _position ? _position->part() : 0; + return _position ? _position->part() : nullptr; } TraceData* CostItem::data() { - return _position ? _position->data() : 0; + return _position ? _position->data() : nullptr; } const TraceData* CostItem::data() const { - return _position ? _position->data() : 0; + return _position ? _position->data() : nullptr; } @@ -134,19 +134,19 @@ ProfileCostArray::ProfileCostArray(ProfileContext* context) : CostItem(context) { - _cachedType = 0; // no virtual value cached + _cachedType = nullptr; // no virtual value cached _allocCount = 0; _count = 0; - _cost = 0; + _cost = nullptr; } ProfileCostArray::ProfileCostArray() : CostItem(ProfileContext::context(ProfileContext::UnknownType)) { - _cachedType = 0; // no virtual value cached + _cachedType = nullptr; // no virtual value cached _allocCount = 0; _count = 0; - _cost = 0; + _cost = nullptr; } ProfileCostArray::~ProfileCostArray() @@ -567,7 +567,7 @@ { if (_dirty) return; _dirty = true; - _cachedType = 0; // cached value is invalid, too + _cachedType = nullptr; // cached value is invalid, too if (_dep) _dep->invalidate(); diff --git a/libcore/coverage.h b/libcore/coverage.h --- a/libcore/coverage.h +++ b/libcore/coverage.h @@ -47,7 +47,7 @@ Coverage(); - virtual int rtti() { return Rtti; } + int rtti() override { return Rtti; } void init(); TraceFunction* function() { return _function; } diff --git a/libcore/eventtype.cpp b/libcore/eventtype.cpp --- a/libcore/eventtype.cpp +++ b/libcore/eventtype.cpp @@ -26,16 +26,16 @@ //--------------------------------------------------- // EventType -QList* EventType::_knownTypes = 0; +QList* EventType::_knownTypes = nullptr; EventType::EventType(const QString& name, const QString& longName, const QString& formula) { _name = name; _longName = longName; _formula = formula; _isReal = formula.isEmpty(); - _set = 0; + _set = nullptr; _realIndex = ProfileCostArray::InvalidIndex; _parsed = false; _inParsing = false; @@ -255,37 +255,37 @@ EventType* EventType::cloneKnownRealType(const QString& n) { - if (!_knownTypes) return 0; + if (!_knownTypes) return nullptr; foreach (EventType* t, *_knownTypes) if (t->isReal() && (t->name() == n)) { EventType* type = new EventType(*t); return type; } - return 0; + return nullptr; } EventType* EventType::cloneKnownDerivedType(const QString& n) { - if (!_knownTypes) return 0; + if (!_knownTypes) return nullptr; foreach (EventType* t, *_knownTypes) if (!t->isReal() && (t->name() == n)) { EventType* type = new EventType(*t); return type; } - return 0; + return nullptr; } // we take ownership void EventType::add(EventType* t, bool overwriteExisting) { if (!t) return; - t->setEventTypeSet(0); + t->setEventTypeSet(nullptr); if (!_knownTypes) _knownTypes = new QList; @@ -332,8 +332,8 @@ EventType* EventType::knownType(int i) { - if (!_knownTypes) return 0; - if (i<0 || i>=(int)_knownTypes->count()) return 0; + if (!_knownTypes) return nullptr; + if (i<0 || i>=(int)_knownTypes->count()) return nullptr; return _knownTypes->at(i); } @@ -346,8 +346,8 @@ { _realCount = 0; _derivedCount = 0; - for (int i=0;iname()); // delete this type - _derived[i] = 0; + _derived[i] = nullptr; delete t; if (i+1 == _derivedCount) { // we can reuse the last index @@ -482,27 +482,27 @@ EventType* EventTypeSet::realType(int t) { - if (t<0 || t>=_realCount) return 0; + if (t<0 || t>=_realCount) return nullptr; return _real[t]; } EventType* EventTypeSet::derivedType(int t) { - if (t<0 || t>=_derivedCount) return 0; + if (t<0 || t>=_derivedCount) return nullptr; return _derived[t]; } EventType* EventTypeSet::type(int t) { - if (t<0) return 0; + if (t<0) return nullptr; if (t<_realCount) return _real[t]; t -= ProfileCostArray::MaxRealIndex; - if (t<0) return 0; + if (t<0) return nullptr; if (t<_derivedCount) return _derived[t]; - return 0; + return nullptr; } EventType* EventTypeSet::type(const QString& name) @@ -515,7 +515,7 @@ if (_derived[i] && (_derived[i]->name() == name)) return _derived[i]; - return 0; + return nullptr; } EventType* EventTypeSet::typeForLong(const QString& name) @@ -528,7 +528,7 @@ if (_derived[i] && (_derived[i]->longName() == name)) return _derived[i]; - return 0; + return nullptr; } @@ -571,7 +571,7 @@ addDiff++; add(new EventType(t->name(), t->longName(), t->formula())); } - t->setEventTypeSet(0); + t->setEventTypeSet(nullptr); } if (addDiff == 0) break; addCount += addDiff; diff --git a/libcore/fixcost.cpp b/libcore/fixcost.cpp --- a/libcore/fixcost.cpp +++ b/libcore/fixcost.cpp @@ -47,7 +47,7 @@ _count = 0; _nextCostOfPartFunction = partFunction ? - partFunction->setFirstFixCost(this) : 0; + partFunction->setFirstFixCost(this) : nullptr; } void* FixCost::operator new(size_t size, FixPool* pool) @@ -103,7 +103,7 @@ else _cost[_count] = callCount; - _nextCostOfPartCall = partCall ? partCall->setFirstFixCallCost(this) : 0; + _nextCostOfPartCall = partCall ? partCall->setFirstFixCallCost(this) : nullptr; } void* FixCallCost::operator new(size_t size, FixPool* pool) @@ -171,7 +171,7 @@ if (isCondJump) _cost[1] = followed; _nextJumpOfPartFunction = partFunction ? - partFunction->setFirstFixJump(this) : 0; + partFunction->setFirstFixJump(this) : nullptr; } void* FixJump::operator new(size_t size, FixPool* pool) diff --git a/libcore/globalconfig.h b/libcore/globalconfig.h --- a/libcore/globalconfig.h +++ b/libcore/globalconfig.h @@ -48,7 +48,7 @@ virtual void saveOptions(); virtual void readOptions(); - static QStringList sourceDirs(TraceData*, TraceObject* o = 0); + static QStringList sourceDirs(TraceData*, TraceObject* o = nullptr); static bool showPercentage(); static bool showExpanded(); static bool showCycles(); diff --git a/libcore/globalconfig.cpp b/libcore/globalconfig.cpp --- a/libcore/globalconfig.cpp +++ b/libcore/globalconfig.cpp @@ -114,11 +114,11 @@ } -GlobalConfig* GlobalConfig::_config = 0; +GlobalConfig* GlobalConfig::_config = nullptr; GlobalConfig::GlobalConfig() { - _config = 0; + _config = nullptr; // general presentation options _showPercentage = DEFAULT_SHOWPERCENTAGE; @@ -144,7 +144,7 @@ GlobalConfig* GlobalConfig::config() { - if (_config == 0) + if (_config == nullptr) _config = new GlobalConfig(); return _config; diff --git a/libcore/loader.cpp b/libcore/loader.cpp --- a/libcore/loader.cpp +++ b/libcore/loader.cpp @@ -33,7 +33,7 @@ _name = name; _description = desc; - _logger = 0; + _logger = nullptr; } Loader::~Loader() @@ -55,16 +55,16 @@ if (l->canLoad(file)) return l; - return 0; + return nullptr; } Loader* Loader::loader(const QString& name) { foreach (Loader* l, _loaderList) if (l->name() == name) return l; - return 0; + return nullptr; } // factories of available loaders diff --git a/libcore/pool.cpp b/libcore/pool.cpp --- a/libcore/pool.cpp +++ b/libcore/pool.cpp @@ -35,7 +35,7 @@ FixPool::FixPool() { - _first = _last = 0; + _first = _last = nullptr; _reservation = 0; _count = 0; _size = 0; @@ -57,7 +57,7 @@ void* FixPool::allocate(unsigned int size) { - if (!ensureSpace(size)) return 0; + if (!ensureSpace(size)) return nullptr; _reservation = 0; void* result = _last->space + _last->used; @@ -71,7 +71,7 @@ void* FixPool::reserve(unsigned int size) { - if (!ensureSpace(size)) return 0; + if (!ensureSpace(size)) return nullptr; _reservation = size; return _last->space + _last->used; @@ -108,7 +108,7 @@ "this system. You could try loading this file on a 64-bit OS."); exit(1); } - newChunk->next = 0; + newChunk->next = nullptr; newChunk->used = 0; if (!_last) { @@ -171,8 +171,8 @@ (*(char**)(*ptr - 4)) != (char*)ptr ) qFatal("Chaining error in DynPool::free"); - (*(char**)(*ptr - 4)) = 0; - *ptr = 0; + (*(char**)(*ptr - 4)) = nullptr; + *ptr = nullptr; } bool DynPool::ensureSpace(unsigned int size) @@ -198,7 +198,7 @@ p, len, p[1], freed, pnew); /* skip freed space ? */ - if (p[1] == 0) { + if (p[1] == nullptr) { freed += len; p = pnext; continue; @@ -224,7 +224,7 @@ pnew = (char**) pnew[0]; p = pnext; } - pnew[0] = 0; + pnew[0] = nullptr; unsigned int newused = (char*)pnew - (char*)newdata; qDebug("DynPool::ensureSpace size: %d => %d, used %d => %d (%d freed)", diff --git a/libcore/stackbrowser.cpp b/libcore/stackbrowser.cpp --- a/libcore/stackbrowser.cpp +++ b/libcore/stackbrowser.cpp @@ -55,15 +55,15 @@ // event type to use for the "most probable" call stack // we simply take the first real event type - if ((_top->data() == 0) || + if ((_top->data() == nullptr) || (_top->data()->eventTypes()->realCount() <1)) return; EventType* e = _top->data()->eventTypes()->realType(0); int max = 30; // try to extend to lower stack frames while (f && (max-- >0)) { - TraceCall* call = 0; + TraceCall* call = nullptr; most = 0; foreach(TraceCall* c, f->callings()) { // no cycle calls in stack: could be deleted without notice @@ -100,13 +100,13 @@ // event type to use for the "most probable" call stack // we simply take the first real event type - if ((_top->data() == 0) || + if ((_top->data() == nullptr) || (_top->data()->eventTypes()->realCount() <1)) return; EventType* e = _top->data()->eventTypes()->realType(0); // try to extend to upper stack frames while (_top && (max-- >0)) { - TraceCall* call = 0; + TraceCall* call = nullptr; most = 0; foreach(TraceCall* c, _top->callers()) { // no cycle calls in stack: could be deleted without notice @@ -146,7 +146,7 @@ if (f == fn) return c->caller(); } - return 0; + return nullptr; } TraceFunction* Stack::called(TraceFunction* fn, bool extend) @@ -171,7 +171,7 @@ } } - return 0; + return nullptr; } bool Stack::contains(TraceFunction* fn) @@ -223,8 +223,8 @@ TraceCallList calls = _calls; // cycles are listed on there own - if (f->cycle() == f) return 0; - if (_top->cycle() == _top) return 0; + if (f->cycle() == f) return nullptr; + if (_top->cycle() == _top) return nullptr; foreach(TraceCall* c, calls) { foreach(TraceCall* c2, c->called()->callings()) { @@ -239,7 +239,7 @@ return new Stack(_top, calls); } } - return 0; + return nullptr; } QString Stack::toString() @@ -261,8 +261,8 @@ if (_stack) _stack->ref(); - _last = 0; - _next = 0; + _last = nullptr; + _next = nullptr; /* qDebug("New Stack History Item (sRef %d): %s\n %s", @@ -290,7 +290,7 @@ StackBrowser::StackBrowser() { - _current = 0; + _current = nullptr; } StackBrowser::~StackBrowser() @@ -309,7 +309,7 @@ HistoryItem* item = _current; if (item->next()) { item = item->next(); - item->last()->setNext(0); + item->last()->setNext(nullptr); while (item->next()) { item = item->next(); diff --git a/libcore/subcost.h b/libcore/subcost.h --- a/libcore/subcost.h +++ b/libcore/subcost.h @@ -89,7 +89,7 @@ int maxSize() { return _maxSize; } bool hasMore() { return _count > _maxSize; } ProfileCostArray* operator[] (int i) - { return (i>=0 && i<_count && i<_maxSize) ? _item[i] : 0; } + { return (i>=0 && i<_count && i<_maxSize) ? _item[i] : nullptr; } private: TraceCostList _list; diff --git a/libcore/subcost.cpp b/libcore/subcost.cpp --- a/libcore/subcost.cpp +++ b/libcore/subcost.cpp @@ -68,7 +68,7 @@ HighestCostList::HighestCostList() { - _costType = 0; + _costType = nullptr; clear(1); } diff --git a/libcore/tracedata.h b/libcore/tracedata.h --- a/libcore/tracedata.h +++ b/libcore/tracedata.h @@ -202,11 +202,11 @@ { public: explicit TraceJumpCost(ProfileContext*); - virtual ~TraceJumpCost(); + ~TraceJumpCost() override; // reimplementations for cost addition - virtual QString costString(EventTypeSet* m); - virtual void clear(); + QString costString(EventTypeSet* m) override; + void clear() override; void addCost(TraceJumpCost*); @@ -229,11 +229,11 @@ { public: explicit TraceCallCost(ProfileContext*); - virtual ~TraceCallCost(); + ~TraceCallCost() override; // reimplementations for cost addition - virtual QString costString(EventTypeSet* m); - virtual void clear(); + QString costString(EventTypeSet* m) override; + void clear() override; // additional cost metric SubCost callCount(); @@ -252,11 +252,11 @@ { public: explicit TraceInclusiveCost(ProfileContext*); - virtual ~TraceInclusiveCost(); + ~TraceInclusiveCost() override; // reimplementations for cost addition - virtual QString costString(EventTypeSet* m); - virtual void clear(); + QString costString(EventTypeSet* m) override; + void clear() override; // additional cost metric ProfileCostArray* inclusive(); @@ -275,10 +275,10 @@ { public: explicit TraceListCost(ProfileContext*); - virtual ~TraceListCost(); + ~TraceListCost() override; // reimplementation for dependency list - virtual void update(); + void update() override; TraceCostList& deps() { return _deps; } void addDep(ProfileCostArray*); @@ -304,10 +304,10 @@ { public: explicit TraceJumpListCost(ProfileContext*); - virtual ~TraceJumpListCost(); + ~TraceJumpListCost() override; // reimplementation for dependency list - virtual void update(); + void update() override; TraceJumpCostList deps() { return _deps; } void addDep(TraceJumpCost*); @@ -335,10 +335,10 @@ { public: explicit TraceCallListCost(ProfileContext*); - virtual ~TraceCallListCost(); + ~TraceCallListCost() override; // reimplementation for dependency list - virtual void update(); + void update() override; TraceCallCostList deps() { return _deps; } void addDep(TraceCallCost*); @@ -363,10 +363,10 @@ { public: explicit TraceInclusiveListCost(ProfileContext*); - virtual ~TraceInclusiveListCost(); + ~TraceInclusiveListCost() override; // reimplementation for dependency - virtual void update(); + void update() override; TraceInclusiveCostList deps() { return _deps; } void addDep(TraceInclusiveCost*); @@ -399,10 +399,10 @@ { public: TracePartInstrJump(TraceInstrJump*, TracePartInstrJump*); - virtual ~TracePartInstrJump(); + ~TracePartInstrJump() override; // fix cost item - virtual void update() {} + void update() override {} TraceInstrJump* instrJump() const { return (TraceInstrJump*) _dep; } TracePartInstrJump* next() const { return _next; } @@ -420,10 +420,10 @@ { public: explicit TracePartInstrCall(TraceInstrCall*); - virtual ~TracePartInstrCall(); + ~TracePartInstrCall() override; // fix cost item - virtual void update() {} + void update() override {} TraceInstrCall* instrCall() const { return (TraceInstrCall*) _dep; } }; @@ -436,10 +436,10 @@ { public: explicit TracePartInstr(TraceInstr*); - virtual ~TracePartInstr(); + ~TracePartInstr() override; // fix cost item - virtual void update() {} + void update() override {} TraceInstr* instr() const { return (TraceInstr*)_dep; } }; @@ -452,10 +452,10 @@ { public: explicit TracePartLineJump(TraceLineJump*); - virtual ~TracePartLineJump(); + ~TracePartLineJump() override; // fix cost item - virtual void update() {} + void update() override {} TraceLineJump* lineJump() const { return (TraceLineJump*) _dep; } }; @@ -468,10 +468,10 @@ { public: explicit TracePartLineCall(TraceLineCall*); - virtual ~TracePartLineCall(); + ~TracePartLineCall() override; // fix cost item - virtual void update() {} + void update() override {} TraceLineCall* lineCall() const { return (TraceLineCall*) _dep; } }; @@ -485,10 +485,10 @@ { public: explicit TracePartLine(TraceLine*); - virtual ~TracePartLine(); + ~TracePartLine() override; // fix cost item - virtual void update() {} + void update() override {} TraceLine* line() const { return (TraceLine*)_dep; } }; @@ -501,9 +501,9 @@ { public: explicit TracePartLineRegion(TraceLineRegion*); - virtual ~TracePartLineRegion(); + ~TracePartLineRegion() override; - virtual void update(); + void update() override; TraceLineRegion* region() const { return (TraceLineRegion*)_dep; } }; @@ -517,13 +517,13 @@ { public: explicit TracePartCall(TraceCall* call); - virtual ~TracePartCall(); + ~TracePartCall() override; // calls a function itself? bool isRecursion(); // reimplementation for dependency list - virtual void update(); + void update() override; TraceCall* call() const { return (TraceCall*)_dep; } @@ -545,10 +545,10 @@ public: TracePartFunction(TraceFunction*, TracePartObject*, TracePartFile*); - virtual ~TracePartFunction(); + ~TracePartFunction() override; - virtual void update(); - virtual QString costString(EventTypeSet* m); + void update() override; + QString costString(EventTypeSet* m) override; void addPartInstr(TracePartInstr*); void addPartLine(TracePartLine*); @@ -608,9 +608,9 @@ { public: explicit TracePartClass(TraceClass*); - virtual ~TracePartClass(); + ~TracePartClass() override; - QString prettyName() const; + QString prettyName() const override; TraceClass* cls() { return (TraceClass*)_dep; } void addPartFunction(TracePartFunction* f) { addDep(f); } @@ -625,7 +625,7 @@ { public: explicit TracePartFile(TraceFile*); - virtual ~TracePartFile(); + ~TracePartFile() override; TraceFile* file() { return (TraceFile*)_dep; } void addPartFunction(TracePartFunction* f) { addDep(f); } @@ -640,7 +640,7 @@ { public: explicit TracePartObject(TraceObject*); - virtual ~TracePartObject(); + ~TracePartObject() override; TraceObject* object() const { return (TraceObject*)_dep; } void addPartFunction(TracePartFunction* f) { addDep(f); } @@ -656,15 +656,15 @@ { public: explicit TracePart(TraceData*); - virtual ~TracePart(); + ~TracePart() override; - virtual TracePart* part() { return this; } - virtual const TracePart* part() const { return this; } + TracePart* part() override { return this; } + const TracePart* part() const override { return this; } QString shortName() const; - QString prettyName() const; + QString prettyName() const override; /// @return Name of the file this part was loaded from - QString name() const { return _name; } + QString name() const override { return _name; } QString description() const { return _descr; } QString trigger() const { return _trigger; } QString timeframe() const { return _timeframe; } @@ -726,11 +726,11 @@ public: TraceInstrJump(TraceInstr* instrFrom, TraceInstr* instrTo, bool isCondJump); - virtual ~TraceInstrJump(); + ~TraceInstrJump() override; - virtual QString name() const; + QString name() const override; - virtual void update(); + void update() override; TraceInstr* instrFrom() const { return _instrFrom; } TraceInstr* instrTo() const { return _instrTo; } @@ -755,9 +755,9 @@ public: TraceLineJump(TraceLine* lineFrom, TraceLine* lineTo, bool isCondJump); - virtual ~TraceLineJump(); + ~TraceLineJump() override; - virtual QString name() const; + QString name() const override; TraceLine* lineFrom() const { return _lineFrom; } TraceLine* lineTo() const { return _lineTo; } @@ -767,7 +767,7 @@ TracePartLineJump* partLineJump(TracePart*); protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } private: TraceLine *_lineFrom, *_lineTo; @@ -782,18 +782,18 @@ { public: TraceInstrCall(TraceCall* call, TraceInstr* instr); - virtual ~TraceInstrCall(); + ~TraceInstrCall() override; - virtual QString name() const; + QString name() const override; TraceInstr* instr() const { return _instr; } TraceCall* call() const { return _call; } // part factory TracePartInstrCall* partInstrCall(TracePart*, TracePartCall*); protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } private: TraceInstr* _instr; @@ -808,18 +808,18 @@ { public: TraceLineCall(TraceCall* call, TraceLine* line); - virtual ~TraceLineCall(); + ~TraceLineCall() override; - virtual QString name() const; + QString name() const override; TraceLine* line() const { return _line; } TraceCall* call() const { return _call; } // part factory TracePartLineCall* partLineCall(TracePart*, TracePartCall*); protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } private: TraceLine* _line; @@ -835,17 +835,17 @@ { public: TraceCall(TraceFunction* caller, TraceFunction* called); - virtual ~TraceCall(); + ~TraceCall() override; - virtual QString name() const; + QString name() const override; // calls a function itself? bool isRecursion() { return _caller == _called; } // return cycle number >0 if call is inside of a cycle int inCycle(); // we need some special handling for cycle calls - void update(); + void update() override; void invalidateDynamicCost(); @@ -866,7 +866,7 @@ { FixCallCost* t = _firstFixCost; _firstFixCost = fc; return t; } protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } private: TraceInstrCallList _instrCalls; @@ -887,10 +887,10 @@ { public: TraceInstr(); - virtual ~TraceInstr(); + ~TraceInstr() override; - virtual QString name() const; - QString prettyName() const; + QString name() const override; + QString prettyName() const override; bool isValid() { return _addr != Addr(0); } @@ -914,7 +914,7 @@ void setLine(TraceLine* l) { _line = l; } protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } private: Addr _addr; @@ -935,10 +935,10 @@ { public: TraceLine(); - virtual ~TraceLine(); + ~TraceLine() override; - virtual QString name() const; - QString prettyName() const; + QString name() const override; + QString prettyName() const override; // factories TracePartLine* partLine(TracePart* part, @@ -948,7 +948,7 @@ void addLineCall(TraceLineCall*); - bool isValid() { return _sourceFile != 0; } + bool isValid() { return _sourceFile != nullptr; } bool hasCost(EventType*); TraceFunctionSource* functionSource() const { return _sourceFile; } uint lineno() const { return _lineno; } @@ -960,7 +960,7 @@ void setLineno(uint lineno) { _lineno = lineno; } protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } private: TraceFunctionSource* _sourceFile; @@ -980,13 +980,13 @@ { public: explicit TraceCostItem(ProfileContext*); - virtual ~TraceCostItem(); + ~TraceCostItem() override; - virtual QString name() const { return _name; } + QString name() const override { return _name; } virtual void setName(const QString& name) { _name = name; } protected: - bool onlyActiveParts() { return true; } + bool onlyActiveParts() override { return true; } protected: QString _name; @@ -1000,13 +1000,13 @@ { public: TraceLineRegion(uint from, uint to, QString name); - virtual ~TraceLineRegion(); + ~TraceLineRegion() override; - virtual void update(); + void update() override; uint from() const { return _from; } uint to() const { return _to; } - QString name() const { return _name; } + QString name() const override { return _name; } // factories TracePartLine* partLineRegion(TracePart* part, @@ -1029,12 +1029,12 @@ { public: TraceFunctionSource(TraceFunction*, TraceFile*); - virtual ~TraceFunctionSource(); + ~TraceFunctionSource() override; - virtual QString name() const; + QString name() const override; // reimplementation for dependency map - virtual void update(); + void update() override; TraceFile* file() const { return _file; } TraceFunction* function() const { return _function; } @@ -1124,9 +1124,9 @@ TraceFunction(); TraceFunction(TraceData* data, const QString& name, TraceClass* cls, TraceFile* file, TraceObject* object); - virtual ~TraceFunction(); + ~TraceFunction() override; - virtual void update(); + void update() override; // this invalidate all subcosts of function depending on // active status of parts @@ -1149,8 +1149,8 @@ */ QString location(int maxFiles = 0) const; - QString prettyName() const; - QString formattedName() const; + QString prettyName() const override; + QString formattedName() const override; static QString prettyEmptyName(); QString prettyLocation(int maxFiles = 0) const; QString prettyNameWithLocation(int maxFiles = 1) const; @@ -1162,7 +1162,7 @@ TraceFile* file() const { return _file; } TraceObject* object() const { return _object; } // get the source file with lines from function declaration (not inlined) - TraceFunctionSource* sourceFile(TraceFile* file = 0, + TraceFunctionSource* sourceFile(TraceFile* file = nullptr, bool createNew = false); const TraceFunctionSourceList& sourceFiles() const { return _sourceFiles; } @@ -1271,9 +1271,9 @@ { public: TraceClass(); - virtual ~TraceClass(); + ~TraceClass() override; - virtual QString prettyName() const; + QString prettyName() const override; static QString prettyEmptyName(); void addFunction(TraceFunction*); @@ -1295,7 +1295,7 @@ { public: TraceFile(); - virtual ~TraceFile(); + ~TraceFile() override; void setDirectory(const QString& dir); void resetDirectory() { _dir = QString(); } @@ -1306,7 +1306,7 @@ // without path QString shortName() const; - QString prettyName() const; + QString prettyName() const override; QString prettyLongName() const; static QString prettyEmptyName(); const TraceFunctionList& functions() const { return _functions; } @@ -1331,16 +1331,16 @@ { public: TraceObject(); - virtual ~TraceObject(); + ~TraceObject() override; void setDirectory(const QString& dir); void resetDirectory() { _dir = QString(); } QString directory(); void addFunction(TraceFunction*); QString shortName() const; - QString prettyName() const; + QString prettyName() const override; static QString prettyEmptyName(); const TraceFunctionList& functions() const { return _functions; } @@ -1365,11 +1365,11 @@ // profiled architecture (must be same for every part) enum Arch { ArchUnknown, ArchARM }; - explicit TraceData(Logger* l = 0); - virtual ~TraceData(); + explicit TraceData(Logger* l = nullptr); + ~TraceData() override; - virtual TraceData* data() { return this; } - virtual const TraceData* data() const { return this; } + TraceData* data() override { return this; } + const TraceData* data() const override { return this; } /** * Loads profile data files. @@ -1430,7 +1430,7 @@ * is not needed. */ ProfileCostArray* search(ProfileContext::Type, QString, - EventType* ct = 0, ProfileCostArray* parent = 0); + EventType* ct = nullptr, ProfileCostArray* parent = nullptr); // for pretty function names without signature if unique... TraceFunctionMap::Iterator functionIterator(TraceFunction*); @@ -1461,7 +1461,7 @@ // reset all manually set directories for source files void resetSourceDirs(); - virtual void update(); + void update() override; // invalidates all cost items dependant on active state of parts void invalidateDynamicCost(); diff --git a/libcore/tracedata.cpp b/libcore/tracedata.cpp --- a/libcore/tracedata.cpp +++ b/libcore/tracedata.cpp @@ -181,7 +181,7 @@ TraceListCost::TraceListCost(ProfileContext* context) : ProfileCostArray(context) { - _lastDep = 0; + _lastDep = nullptr; } TraceListCost::~TraceListCost() @@ -219,7 +219,7 @@ return dep; } } - return 0; + return nullptr; } @@ -255,7 +255,7 @@ TraceJumpListCost::TraceJumpListCost(ProfileContext* context) : TraceJumpCost(context) { - _lastDep = 0; + _lastDep = nullptr; } TraceJumpListCost::~TraceJumpListCost() @@ -293,7 +293,7 @@ return dep; } } - return 0; + return nullptr; } @@ -329,7 +329,7 @@ TraceCallListCost::TraceCallListCost(ProfileContext* context) : TraceCallCost(context) { - _lastDep = 0; + _lastDep = nullptr; } TraceCallListCost::~TraceCallListCost() @@ -367,7 +367,7 @@ return dep; } } - return 0; + return nullptr; } @@ -407,7 +407,7 @@ TraceInclusiveListCost::TraceInclusiveListCost(ProfileContext* context) : TraceInclusiveCost(context) { - _lastDep = 0; + _lastDep = nullptr; } TraceInclusiveListCost::~TraceInclusiveListCost() @@ -446,7 +446,7 @@ return dep; } } - return 0; + return nullptr; } void TraceInclusiveListCost::update() @@ -568,7 +568,7 @@ { _dep = call; - _firstFixCallCost = 0; + _firstFixCallCost = nullptr; } TracePartCall::~TracePartCall() @@ -621,15 +621,15 @@ _dep = function; _partObject = partObject; _partFile = partFile; - _partClass = 0; + _partClass = nullptr; _calledCount = 0; _callingCount = 0; _calledContexts = 0; _callingContexts = 0; - _firstFixCost = 0; - _firstFixJump = 0; + _firstFixCost = nullptr; + _firstFixJump = nullptr; } TracePartFunction::~TracePartFunction() @@ -788,7 +788,7 @@ _callingContexts = 0; // To calculate context counts, we just use first real event type (FIXME?) - EventType* e = data() ? data()->eventTypes()->realType(0) : 0; + EventType* e = data() ? data()->eventTypes()->realType(0) : nullptr; // calculate additional cost metrics foreach(TracePartCall* caller, _partCallers) { @@ -928,7 +928,7 @@ bool isCondJump) : TraceJumpCost(ProfileContext::context(ProfileContext::InstrJump)) { - _first = 0; + _first = nullptr; _instrFrom = instrFrom; _instrTo = instrTo; @@ -948,7 +948,7 @@ TracePartInstrJump* TraceInstrJump::partInstrJump(TracePart* part) { - static TracePartInstrJump* item = 0; + static TracePartInstrJump* item = nullptr; // shortcut if recently used if (item && @@ -1270,7 +1270,7 @@ TraceFunctionCycle* c = _called->cycle(); if (c && _caller && (_caller->cycle() != c)) { // HACK to get rid of cycle postfix... - _called->setCycle(0); + _called->setCycle(nullptr); QString via = _called->prettyName(); _called->setCycle(c); return QObject::tr("%1 via %2").arg(c->name()).arg(via); @@ -1287,8 +1287,8 @@ : TraceListCost(ProfileContext::context(ProfileContext::Instr)) { _addr = 0; - _line = 0; - _function = 0; + _line = nullptr; + _function = nullptr; } TraceInstr::~TraceInstr() @@ -1381,7 +1381,7 @@ : TraceListCost(ProfileContext::context(ProfileContext::Line)) { _lineno = 0; - _sourceFile = 0; + _sourceFile = nullptr; } TraceLine::~TraceLine() @@ -1513,9 +1513,9 @@ // the function is dependent from our cost sum _dep = _function; - _lineMap = 0; + _lineMap = nullptr; _lineMapFilled = false; - _line0 = 0; + _line0 = nullptr; } TraceFunctionSource::~TraceFunctionSource() @@ -1555,18 +1555,18 @@ { if (lineno == 0) { if (!_line0) { - if (!createNew) return 0; + if (!createNew) return nullptr; _line0 = new TraceLine; _line0->setSourceFile(this); _line0->setLineno(0); } return _line0; } if (!createNew) { - if (!_lineMap) return 0; + if (!_lineMap) return nullptr; TraceLineMap::Iterator it = _lineMap->find(lineno); - if (it == _lineMap->end()) return 0; + if (it == _lineMap->end()) return nullptr; return &(it.value()); } @@ -1624,10 +1624,10 @@ if (!_lineMap) _lineMap = new TraceLineMap; - TraceLine* l = 0; - TracePartLine* pl = 0; - TraceLineCall* lc = 0; - TracePartLineCall* plc = 0; + TraceLine* l = nullptr; + TracePartLine* pl = nullptr; + TraceLineCall* lc = nullptr; + TracePartLineCall* plc = nullptr; /* go over all part objects for this function, and * - build TraceLines (the line map) using FixCost objects @@ -1651,14 +1651,14 @@ l->setSourceFile(this); l->setLineno(fc->line()); } - pl = 0; + pl = nullptr; } if (!pl || pl->part() != fc->part()) pl = l->partLine(fc->part(), pf); fc->addTo(pl); } - TraceLine* to = 0; + TraceLine* to = nullptr; TraceLineJump* lj; TracePartLineJump* plj; FixJump* fj = pf->firstFixJump(); @@ -1710,7 +1710,7 @@ } if (!lc || lc->call() != pc->call() || lc->line() != l) { lc = pc->call()->lineCall(l); - plc = 0; + plc = nullptr; } if (!plc || plc->part() != fcc->part()) plc = lc->partLineCall(fcc->part(), pc); @@ -1736,7 +1736,7 @@ TraceAssociation::TraceAssociation() { - _function = 0; + _function = nullptr; _valid = false; } @@ -1764,7 +1764,7 @@ } _function = f; - if (f && f->association(rtti()) == 0) { + if (f && f->association(rtti()) == nullptr) { f->addAssociation(this); return true; } @@ -1794,17 +1794,17 @@ TraceFunction::TraceFunction() : TraceCostItem(ProfileContext::context(ProfileContext::Function)) { - _object = 0; - _file = 0; - _cls = 0; - _cycle = 0; + _object = nullptr; + _file = nullptr; + _cls = nullptr; + _cycle = nullptr; _calledCount = 0; _callingCount = 0; _calledContexts = 0; _callingContexts = 0; - _instrMap = 0; + _instrMap = nullptr; _instrMapFilled = false; } @@ -1865,7 +1865,7 @@ if (a->rtti() == rtti) return a; } - return 0; + return nullptr; } #if 0 @@ -2100,13 +2100,13 @@ TraceInstr* TraceFunction::instr(Addr addr, bool createNew) { // address 0 not allowed - if (addr == Addr(0)) return 0; + if (addr == Addr(0)) return nullptr; if (!createNew) { - if (!_instrMap) return 0; + if (!_instrMap) return nullptr; TraceInstrMap::Iterator it = _instrMap->find(addr); if (it == _instrMap->end()) - return 0; + return nullptr; return &(it.value()); } @@ -2175,7 +2175,7 @@ if (sourceFile->file() == file) return sourceFile; - if (!createNew) return 0; + if (!createNew) return nullptr; TraceFunctionSource* sourceFile = new TraceFunctionSource(this, file); _sourceFiles.append(sourceFile); @@ -2194,11 +2194,11 @@ TraceLine* TraceFunction::line(TraceFile* file, uint lineno, bool createNew) { - Q_ASSERT(file!=0); + Q_ASSERT(file!=nullptr); TraceFunctionSource* sf = sourceFile(file, createNew); if (!sf) - return 0; + return nullptr; else return sf->line(lineno, createNew); } @@ -2227,7 +2227,7 @@ if (partObject) partObject->addPartFunction(item); } - else if (item->partObject()==0 && partObject) { + else if (item->partObject()==nullptr && partObject) { item->setPartObject(partObject); partObject->addPartFunction(item); } @@ -2339,7 +2339,7 @@ clear(); // To calculate context counts, we just use first real event type (FIXME?) - EventType* e = data() ? data()->eventTypes()->realType(0) : 0; + EventType* e = data() ? data()->eventTypes()->realType(0) : nullptr; // context count is NOT the sum of part contexts foreach(TraceCall *caller, _callers) { @@ -2411,8 +2411,8 @@ void TraceFunction::cycleReset() { - _cycle = 0; - _cycleStackDown = 0; + _cycle = nullptr; + _cycleStackDown = nullptr; _cycleLow = 0; } @@ -2435,7 +2435,7 @@ * percent of the cost of the function. * FIXME: Which cost type to use for this heuristic ?! */ - Q_ASSERT((data() != 0) && (data()->eventTypes()->realCount()>0)); + Q_ASSERT((data() != nullptr) && (data()->eventTypes()->realCount()>0)); EventType* e = data()->eventTypes()->realType(0); SubCost base = 0; @@ -2494,7 +2494,7 @@ if (*pTop == this) { *pTop = _cycleStackDown; - _cycleStackDown = 0; + _cycleStackDown = nullptr; } else { // a SCC with >1 members @@ -2508,7 +2508,7 @@ // remove from stack *pTop = top->_cycleStackDown; - top->_cycleStackDown = 0; + top->_cycleStackDown = nullptr; if (0) qDebug(" %s", qPrintable(top->prettyName())); if (top == this) break; @@ -2527,11 +2527,11 @@ if (!_instrMap) _instrMap = new TraceInstrMap; - TraceLine* l = 0; - TraceInstr* i = 0; - TracePartInstr* pi = 0; - TraceInstrCall* ic = 0; - TracePartInstrCall* pic = 0; + TraceLine* l = nullptr; + TraceInstr* i = nullptr; + TracePartInstr* pi = nullptr; + TraceInstrCall* ic = nullptr; + TracePartInstrCall* pic = nullptr; foreach(TraceInclusiveCost* icost, deps()) { TracePartFunction* pf = (TracePartFunction*) icost; @@ -2555,14 +2555,14 @@ i->setAddr(fc->addr()); i->setLine(l); } - pi = 0; + pi = nullptr; } if (!pi || pi->part() != fc->part()) pi = i->partInstr(fc->part(), pf); fc->addTo(pi); } - TraceInstr* to = 0; + TraceInstr* to = nullptr; TraceInstrJump* ij; TracePartInstrJump* pij; FixJump* fj = pf->firstFixJump(); @@ -2614,7 +2614,7 @@ } if (!ic || ic->call() != pc->call() || ic->instr() != i) { ic = pc->call()->instrCall(i); - pic = 0; + pic = nullptr; } if (!pic || pic->part() != fcc->part()) pic = ic->partInstrCall(fcc->part(), pc); @@ -2985,7 +2985,7 @@ _tid = 0; _pid = 0; - _eventTypeMapping = 0; + _eventTypeMapping = nullptr; } TracePart::~TracePart() @@ -3078,8 +3078,8 @@ _maxThreadID = 0; _maxPartNumber = 0; - _fixPool = 0; - _dynPool = 0; + _fixPool = nullptr; + _dynPool = nullptr; _arch = ArchUnknown; } @@ -3207,7 +3207,7 @@ int partsLoaded = l->load(this, device, filename); - l->setLogger(0); + l->setLogger(nullptr); return partsLoaded; } @@ -3276,7 +3276,7 @@ foreach(TracePart* part, _parts) if (part->name() == name) return part; - return 0; + return nullptr; } QString TraceData::activePartRange() @@ -3418,7 +3418,7 @@ if (!file || !object || !c) { qDebug("ERROR - no file/object/class for %s ?!", qPrintable(name)); - return 0; + return nullptr; } // Use object name and file name as part of key, to get distinct @@ -3530,7 +3530,7 @@ ProfileCostArray* TraceData::search(ProfileContext::Type t, QString name, EventType* ct, ProfileCostArray* parent) { - ProfileCostArray* result = 0; + ProfileCostArray* result = nullptr; ProfileContext::Type pt; SubCost sc, scTop = 0; @@ -3719,7 +3719,7 @@ } #endif - stackTop = 0; + stackTop = nullptr; (*it).cycleDFS(1, pNo, &stackTop); } diff --git a/libcore/utils.h b/libcore/utils.h --- a/libcore/utils.h +++ b/libcore/utils.h @@ -39,7 +39,7 @@ public: // constructor for an invalid string - FixString() { _len = 0; _str = 0; } + FixString() { _len = 0; _str = nullptr; } /** * FixString never does a deep copy! You have to make sure that @@ -51,7 +51,7 @@ int len() { return _len; } const char* ascii() { return _str; } bool isEmpty() { return _len == 0; } - bool isValid() { return _str != 0; } + bool isValid() { return _str != nullptr; } // sets to first character and returns true if length >0 bool first(char& c) diff --git a/libcore/utils.cpp b/libcore/utils.cpp --- a/libcore/utils.cpp +++ b/libcore/utils.cpp @@ -361,7 +361,7 @@ _openError = false; _used_mmap = false; - uchar* addr = 0; + uchar* addr = nullptr; #if QT_VERSION >= 0x040400 // QFile::map was introduced with Qt 4.4 diff --git a/libviews/callgraphview.h b/libviews/callgraphview.h --- a/libviews/callgraphview.h +++ b/libviews/callgraphview.h @@ -110,10 +110,10 @@ void setCaller(GraphEdge*); TraceFunction* nextVisible(); TraceFunction* priorVisible(); - TraceCall* nextVisibleCaller(GraphEdge* = 0); - TraceCall* nextVisibleCallee(GraphEdge* = 0); - TraceCall* priorVisibleCaller(GraphEdge* = 0); - TraceCall* priorVisibleCallee(GraphEdge* = 0); + TraceCall* nextVisibleCaller(GraphEdge* = nullptr); + TraceCall* nextVisibleCallee(GraphEdge* = nullptr); + TraceCall* priorVisibleCaller(GraphEdge* = nullptr); + TraceCall* priorVisibleCallee(GraphEdge* = nullptr); double self, incl; @@ -258,17 +258,17 @@ { public: StorableGraphOptions(); - virtual ~StorableGraphOptions(){} + ~StorableGraphOptions() override{} // implementation of getters - virtual double funcLimit() { return _funcLimit; } - virtual double callLimit() { return _callLimit; } - virtual int maxCallerDepth() { return _maxCallerDepth; } - virtual int maxCalleeDepth() { return _maxCalleeDepth; } - virtual bool showSkipped() { return _showSkipped; } - virtual bool expandCycles() { return _expandCycles; } - virtual bool clusterGroups() { return _clusterGroups; } - virtual int detailLevel() { return _detailLevel; } - virtual Layout layout() { return _layout; } + double funcLimit() override { return _funcLimit; } + double callLimit() override { return _callLimit; } + int maxCallerDepth() override { return _maxCallerDepth; } + int maxCalleeDepth() override { return _maxCalleeDepth; } + bool showSkipped() override { return _showSkipped; } + bool expandCycles() override { return _expandCycles; } + bool clusterGroups() override { return _clusterGroups; } + int detailLevel() override { return _detailLevel; } + Layout layout() override { return _layout; } // setters void setMaxCallerDepth(int d) { _maxCallerDepth = d; } @@ -302,7 +302,7 @@ GraphExporter(TraceData*, TraceFunction*, EventType*, ProfileContext::Type, QString filename = QString()); - virtual ~GraphExporter(); + ~GraphExporter() override; void reset(TraceData*, CostItem*, EventType*, ProfileContext::Type, @@ -325,13 +325,13 @@ // Set the object from which to get graph options for creation. // Default is this object itself (supply 0 for default) - void setGraphOptions(GraphOptions* go = 0); + void setGraphOptions(GraphOptions* go = nullptr); // Create a subgraph with given limits/maxDepths void createGraph(); // calls createGraph before dumping of not already created - void writeDot(QIODevice* = 0); + void writeDot(QIODevice* = nullptr); // to map back to structures when parsing a layouted graph @@ -379,19 +379,19 @@ Q_OBJECT public: - explicit PanningView(QWidget * parent = 0); + explicit PanningView(QWidget * parent = nullptr); void setZoomRect(const QRectF& r); signals: void zoomRectMoved(qreal dx, qreal dy); void zoomRectMoveFinished(); protected: - void mousePressEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - void drawForeground(QPainter * p, const QRectF&); + void mousePressEvent(QMouseEvent*) override; + void mouseMoveEvent(QMouseEvent*) override; + void mouseReleaseEvent(QMouseEvent*) override; + void drawForeground(QPainter * p, const QRectF&) override; QRectF _zoomRect; bool _movingZoomRect; @@ -421,14 +421,14 @@ void updateGroup(); void setSelected(bool); - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override; GraphNode* node() { return _node; } - int type() const + int type() const override { return CANVAS_NODE; } @@ -444,14 +444,14 @@ public: CanvasEdgeLabel(CallGraphView*, CanvasEdge*, int, int, int, int); - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override; CanvasEdge* canvasEdge() { return _ce; } - int type() const + int type() const override { return CANVAS_EDGELABEL; } @@ -474,14 +474,14 @@ public: explicit CanvasEdgeArrow(CanvasEdge*); - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override; CanvasEdge* canvasEdge() { return _ce; } - int type() const + int type() const override { return CANVAS_EDGEARROW; } @@ -496,7 +496,7 @@ public: explicit CanvasEdge(GraphEdge*); - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override; void setSelected(bool); @@ -526,7 +526,7 @@ return _edge; } - int type() const + int type() const override { return CANVAS_EDGE; } @@ -546,7 +546,7 @@ public: explicit CanvasFrame(CanvasNode*); - int type() const + int type() const override { return CANVAS_FRAME; } @@ -556,7 +556,7 @@ return false; } - void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); + void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override; private: static QPixmap* _p; @@ -580,17 +580,17 @@ explicit CallGraphView(TraceItemView* parentView, QWidget* parent, const QString& name); - ~CallGraphView(); + ~CallGraphView() override; - void restoreOptions(const QString& prefix, const QString& postfix); - void saveOptions(const QString& prefix, const QString& postfix); + void restoreOptions(const QString& prefix, const QString& postfix) override; + void saveOptions(const QString& prefix, const QString& postfix) override; - QWidget* widget() + QWidget* widget() override { return this; } - QString whatsThis() const; + QString whatsThis() const override; ZoomPosition zoomPos() const { @@ -620,21 +620,21 @@ void layoutTriggered(QAction*); protected: - void resizeEvent(QResizeEvent*); - void mousePressEvent(QMouseEvent*); - void mouseMoveEvent(QMouseEvent*); - void mouseReleaseEvent(QMouseEvent*); - void mouseDoubleClickEvent(QMouseEvent*); - void contextMenuEvent(QContextMenuEvent*); - void keyPressEvent(QKeyEvent*); - void focusInEvent(QFocusEvent*); - void focusOutEvent(QFocusEvent*); - void scrollContentsBy(int dx, int dy); + void resizeEvent(QResizeEvent*) override; + void mousePressEvent(QMouseEvent*) override; + void mouseMoveEvent(QMouseEvent*) override; + void mouseReleaseEvent(QMouseEvent*) override; + void mouseDoubleClickEvent(QMouseEvent*) override; + void contextMenuEvent(QContextMenuEvent*) override; + void keyPressEvent(QKeyEvent*) override; + void focusInEvent(QFocusEvent*) override; + void focusOutEvent(QFocusEvent*) override; + void scrollContentsBy(int dx, int dy) override; private: void updateSizes(QSize s = QSize(0,0)); - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; void refresh(); void makeFrame(CanvasNode*, bool active); void clear(); diff --git a/libviews/callgraphview.cpp b/libviews/callgraphview.cpp --- a/libviews/callgraphview.cpp +++ b/libviews/callgraphview.cpp @@ -131,9 +131,9 @@ GraphNode::GraphNode() { - _f=0; + _f=nullptr; self = incl = 0; - _cn = 0; + _cn = nullptr; _visible = false; _lastCallerIndex = _lastCalleeIndex = -1; @@ -236,10 +236,10 @@ // can not use at(): index can be -1 (out of bounds), result is 0 then GraphEdge* e = callers.value(_lastCallerIndex); if (e && !e->isVisible()) - e = 0; + e = nullptr; if (!e) { double maxCost = 0.0; - GraphEdge* maxEdge = 0; + GraphEdge* maxEdge = nullptr; for(int i = 0; iisVisible() && (e->cost > maxCost)) { @@ -250,7 +250,7 @@ } e = maxEdge; } - return e ? e->call() : 0; + return e ? e->call() : nullptr; } TraceCall* GraphNode::visibleCallee() @@ -261,11 +261,11 @@ GraphEdge* e = callees.value(_lastCalleeIndex); if (e && !e->isVisible()) - e = 0; + e = nullptr; if (!e) { double maxCost = 0.0; - GraphEdge* maxEdge = 0; + GraphEdge* maxEdge = nullptr; for(int i = 0; iisVisible() && (e->cost > maxCost)) { @@ -276,7 +276,7 @@ } e = maxEdge; } - return e ? e->call() : 0; + return e ? e->call() : nullptr; } void GraphNode::setCallee(GraphEdge* e) @@ -310,7 +310,7 @@ if (c) return c->called(true); } - return 0; + return nullptr; } TraceFunction* GraphNode::priorVisible() @@ -332,7 +332,7 @@ if (c) return c->called(true); } - return 0; + return nullptr; } TraceCall* GraphNode::nextVisibleCaller(GraphEdge* e) @@ -346,7 +346,7 @@ } idx++; } - return 0; + return nullptr; } TraceCall* GraphNode::nextVisibleCallee(GraphEdge* e) @@ -360,7 +360,7 @@ } idx++; } - return 0; + return nullptr; } TraceCall* GraphNode::priorVisibleCaller(GraphEdge* e) @@ -375,7 +375,7 @@ } idx--; } - return 0; + return nullptr; } TraceCall* GraphNode::priorVisibleCallee(GraphEdge* e) @@ -390,7 +390,7 @@ } idx--; } - return 0; + return nullptr; } @@ -400,11 +400,11 @@ GraphEdge::GraphEdge() { - _c=0; - _from = _to = 0; - _fromNode = _toNode = 0; + _c=nullptr; + _from = _to = nullptr; + _fromNode = _toNode = nullptr; cost = count = 0; - _ce = 0; + _ce = nullptr; _visible = false; _lastFromCaller = true; @@ -432,7 +432,7 @@ _fromNode->setCallee(this); return _from; } - return 0; + return nullptr; } TraceFunction* GraphEdge::visibleCallee() @@ -443,12 +443,12 @@ _toNode->setCaller(this); return _to; } - return 0; + return nullptr; } TraceCall* GraphEdge::nextVisible() { - TraceCall* res = 0; + TraceCall* res = nullptr; if (_lastFromCaller && _fromNode) { res = _fromNode->nextVisibleCallee(this); @@ -464,7 +464,7 @@ TraceCall* GraphEdge::priorVisible() { - TraceCall* res = 0; + TraceCall* res = nullptr; if (_lastFromCaller && _fromNode) { res = _fromNode->priorVisibleCallee(this); @@ -530,18 +530,18 @@ GraphExporter::GraphExporter() { _go = this; - _tmpFile = 0; - _item = 0; - reset(0, 0, 0, ProfileContext::InvalidType, QString()); + _tmpFile = nullptr; + _item = nullptr; + reset(nullptr, nullptr, nullptr, ProfileContext::InvalidType, QString()); } GraphExporter::GraphExporter(TraceData* d, TraceFunction* f, EventType* ct, ProfileContext::Type gt, QString filename) { _go = this; - _tmpFile = 0; - _item = 0; + _tmpFile = nullptr; + _item = nullptr; reset(d, f, ct, gt, filename); } @@ -575,7 +575,7 @@ case ProfileContext::Call: break; default: - i = 0; + i = nullptr; } } @@ -593,7 +593,7 @@ _dotName = _tmpFile->fileName(); _useBox = true; } else { - _tmpFile = 0; + _tmpFile = nullptr; _dotName = filename; _useBox = false; } @@ -603,7 +603,7 @@ void GraphExporter::setGraphOptions(GraphOptions* go) { - if (go == 0) + if (go == nullptr) go = this; _go = go; } @@ -663,8 +663,8 @@ if (!_item) return; - QFile* file = 0; - QTextStream* stream = 0; + QFile* file = nullptr; + QTextStream* stream = nullptr; if (device) stream = new QTextStream(device); @@ -696,7 +696,7 @@ if (_go->layout() == LeftRight) { *stream << QStringLiteral(" rankdir=LR;\n"); } else if (_go->layout() == Circular) { - TraceFunction *f = 0; + TraceFunction *f = nullptr; switch (_item->type()) { case ProfileContext::Function: case ProfileContext::FunctionCycle: @@ -740,7 +740,7 @@ g = f->cycle(); break; default: - g = 0; + g = nullptr; break; } nLists[g].append(&n); @@ -843,7 +843,7 @@ countSum = n.callerCountSum(); if (costSum > _realCallLimit) { - QPair p(0, n.function()); + QPair p(nullptr, n.function()); e = &(_edgeMap[p]); e->setCallee(p.second); e->cost = costSum; @@ -864,7 +864,7 @@ countSum = n.calleeCountSum(); if (costSum > _realCallLimit) { - QPair p(n.function(), 0); + QPair p(n.function(), nullptr); e = &(_edgeMap[p]); e->setCaller(p.first); e->cost = costSum; @@ -915,32 +915,32 @@ TraceFunction* GraphExporter::toFunc(QString s) { if (s[0] != 'F') - return 0; + return nullptr; bool ok; TraceFunction* f = (TraceFunction*) s.midRef(1).toULongLong(&ok, 16); if (!ok) - return 0; + return nullptr; return f; } GraphNode* GraphExporter::node(TraceFunction* f) { if (!f) - return 0; + return nullptr; GraphNodeMap::Iterator it = _nodeMap.find(f); if (it == _nodeMap.end()) - return 0; + return nullptr; return &(*it); } GraphEdge* GraphExporter::edge(TraceFunction* f1, TraceFunction* f2) { GraphEdgeMap::Iterator it = _edgeMap.find(qMakePair(f1, f2)); if (it == _edgeMap.end()) - return 0; + return nullptr; return &(*it); } @@ -964,7 +964,7 @@ double oldIncl = 0.0; GraphNode& n = _nodeMap[f]; - if (n.function() == 0) { + if (n.function() == nullptr) { n.setFunction(f); } else oldIncl = n.incl; @@ -1029,7 +1029,7 @@ QPair p(toCallees ? f : f2, toCallees ? f2 : f); GraphEdge& e = _edgeMap[p]; - if (e.call() == 0) { + if (e.call() == nullptr) { e.setCall(call); e.setCaller(p.first); e.setCallee(p.second); @@ -1049,7 +1049,7 @@ QPair realP(toCallees ? f : realF, toCallees ? realF : f); GraphEdge& e = _edgeMap[realP]; - if (e.call() == 0) { + if (e.call() == nullptr) { e.setCall(call); e.setCaller(realP.first); e.setCallee(realP.second); @@ -1356,8 +1356,8 @@ CanvasEdge::CanvasEdge(GraphEdge* e) : _edge(e) { - _label = 0; - _arrow = 0; + _label = nullptr; + _arrow = nullptr; _thickness = 0; setFlag(QGraphicsItem::ItemIsSelectable); @@ -1435,7 +1435,7 @@ // CanvasFrame // -QPixmap* CanvasFrame::_p = 0; +QPixmap* CanvasFrame::_p = nullptr; CanvasFrame::CanvasFrame(CanvasNode* n) { @@ -1512,12 +1512,12 @@ _zoomPosition = DEFAULT_ZOOMPOS; _lastAutoPosition = TopLeft; - _scene = 0; + _scene = nullptr; _xMargin = _yMargin = 0; _panningView = new PanningView(this); _panningZoom = 1; - _selectedNode = 0; - _selectedEdge = 0; + _selectedNode = nullptr; + _selectedEdge = nullptr; _isMoving = false; _exporter.setGraphOptions(this); @@ -1538,8 +1538,8 @@ // tooltips... //_tip = new CallGraphTip(this); - _renderProcess = 0; - _prevSelectedNode = 0; + _renderProcess = nullptr; + _prevSelectedNode = nullptr; connect(&_renderTimer, &QTimer::timeout, this, &CallGraphView::showRenderWarning); } @@ -1739,8 +1739,8 @@ ||(e->key() == Qt::Key_Down)||(e->key() == Qt::Key_Left)||(e->key() == Qt::Key_Right))) { - TraceFunction* f = 0; - TraceCall* c = 0; + TraceFunction* f = nullptr; + TraceCall* c = nullptr; // rotate arrow key meaning for LeftRight layout int key = e->key(); @@ -1837,7 +1837,7 @@ break; } } - return 0; + return nullptr; } void CallGraphView::doUpdate(int changeType, bool) @@ -1853,8 +1853,8 @@ if (!_selectedItem) return; - GraphNode* n = 0; - GraphEdge* e = 0; + GraphNode* n = nullptr; + GraphEdge* e = nullptr; if ((_selectedItem->type() == ProfileContext::Function) ||(_selectedItem->type() == ProfileContext::FunctionCycle)) { n = _exporter.node((TraceFunction*)_selectedItem); @@ -1871,14 +1871,14 @@ if (_selectedNode && _selectedNode->canvasNode()) { _selectedNode->canvasNode()->setSelected(false); } - _selectedNode = 0; + _selectedNode = nullptr; if (_selectedEdge && _selectedEdge->canvasEdge()) { _selectedEdge->canvasEdge()->setSelected(false); } - _selectedEdge = 0; + _selectedEdge = nullptr; // select - CanvasNode* sNode = 0; + CanvasNode* sNode = nullptr; if (n && n->canvasNode()) { _selectedNode = n; _selectedNode->canvasNode()->setSelected(true); @@ -1927,8 +1927,8 @@ if (changeType & dataChanged) { // invalidate old selection and graph part _exporter.reset(_data, _activeItem, _eventType, _groupType); - _selectedNode = 0; - _selectedEdge = 0; + _selectedNode = nullptr; + _selectedEdge = nullptr; } refresh(); @@ -1939,10 +1939,10 @@ if (!_scene) return; - _panningView->setScene(0); - setScene(0); + _panningView->setScene(nullptr); + setScene(nullptr); delete _scene; - _scene = 0; + _scene = nullptr; } void CallGraphView::showText(QString s) @@ -2002,7 +2002,7 @@ // forget about this process, not interesting any longer _renderProcess->deleteLater(); - _renderProcess = 0; + _renderProcess = nullptr; _unparsedOutput = QString(); _renderTimer.setSingleShot(true); @@ -2044,8 +2044,8 @@ if (1) qDebug() << "CallGraphView::refresh"; - _selectedNode = 0; - _selectedEdge = 0; + _selectedNode = nullptr; + _selectedEdge = nullptr; /* * Call 'dot' asynchronoulsy in the background with the aim to @@ -2103,7 +2103,7 @@ qDebug("CallGraphView::readDotOutput: QProcess %p", p); // signal from old/uninteresting process? - if ((_renderProcess == 0) || (p != _renderProcess)) { + if ((_renderProcess == nullptr) || (p != _renderProcess)) { p->deleteLater(); return; } @@ -2118,16 +2118,16 @@ p->error(), p); // signal from old/uninteresting process? - if ((_renderProcess == 0) || (p != _renderProcess)) { + if ((_renderProcess == nullptr) || (p != _renderProcess)) { p->deleteLater(); return; } showRenderError(QString::fromLocal8Bit(_renderProcess->readAllStandardError())); // not interesting any longer _renderProcess->deleteLater(); - _renderProcess = 0; + _renderProcess = nullptr; } @@ -2137,14 +2137,14 @@ qDebug("CallGraphView::dotExited: QProcess %p", p); // signal from old/uninteresting process? - if ((_renderProcess == 0) || (p != _renderProcess)) { + if ((_renderProcess == nullptr) || (p != _renderProcess)) { p->deleteLater(); return; } _unparsedOutput.append(QString::fromLocal8Bit(_renderProcess->readAllStandardOutput())); _renderProcess->deleteLater(); - _renderProcess = 0; + _renderProcess = nullptr; QString line, cmd; CanvasNode *rItem; @@ -2154,8 +2154,8 @@ QTextStream* dotStream; double scale = 1.0, scaleX = 1.0, scaleY = 1.0; double dotWidth = 0, dotHeight = 0; - GraphNode* activeNode = 0; - GraphEdge* activeEdge = 0; + GraphNode* activeNode = nullptr; + GraphEdge* activeEdge = nullptr; _renderTimer.stop(); viewport()->setUpdatesEnabled(false); @@ -2248,7 +2248,7 @@ continue; } - if (_scene == 0) { + if (_scene == nullptr) { qDebug() << "Ignoring '"<< cmd << "' without 'graph' from dot ("<< _exporter.filename() << ":"<< lineno << ")"; @@ -2369,8 +2369,8 @@ // calls into/out of cycles are special: make them blue QColor arrowColor = Qt::black; - TraceFunction* caller = e->fromNode() ? e->fromNode()->function() : 0; - TraceFunction* called = e->toNode() ? e->toNode()->function() : 0; + TraceFunction* caller = e->fromNode() ? e->fromNode()->function() : nullptr; + TraceFunction* called = e->toNode() ? e->toNode()->function() : nullptr; if ( (caller && (caller->cycle() == caller)) || (called && (called->cycle() == called)) ) arrowColor = Qt::blue; @@ -2395,7 +2395,7 @@ // check if head is at start of spline... // this is needed because dot always gives points from top to bottom - CanvasNode* fromNode = e->fromNode() ? e->fromNode()->canvasNode() : 0; + CanvasNode* fromNode = e->fromNode() ? e->fromNode()->canvasNode() : nullptr; if (fromNode) { QPointF toCenter = fromNode->rect().center(); qreal dx0 = poly.point(0).x() - toCenter.x(); @@ -2527,7 +2527,7 @@ } } - CanvasNode* sNode = 0; + CanvasNode* sNode = nullptr; if (_selectedNode) sNode = _selectedNode->canvasNode(); else if (_selectedEdge) { @@ -2566,7 +2566,7 @@ viewport()->setUpdatesEnabled(true); delete _renderProcess; - _renderProcess = 0; + _renderProcess = nullptr; } @@ -2667,7 +2667,7 @@ void CallGraphView::mouseDoubleClickEvent(QMouseEvent* e) { QGraphicsItem* i = itemAt(e->pos()); - if (i == 0) + if (i == nullptr) return; if (i->type() == CANVAS_NODE) { @@ -2736,7 +2736,7 @@ void CallGraphView::callerDepthTriggered(QAction* a) { - _maxCallerDepth = a->data().toInt(0); + _maxCallerDepth = a->data().toInt(nullptr); refresh(); } @@ -2776,7 +2776,7 @@ void CallGraphView::calleeDepthTriggered(QAction* a) { - _maxCalleeDepth = a->data().toInt(0); + _maxCalleeDepth = a->data().toInt(nullptr); refresh(); } @@ -2819,7 +2819,7 @@ void CallGraphView::nodeLimitTriggered(QAction* a) { - _funcLimit = a->data().toDouble(0); + _funcLimit = a->data().toDouble(nullptr); refresh(); } @@ -2856,7 +2856,7 @@ void CallGraphView::callLimitTriggered(QAction* a) { - _callLimit = a->data().toDouble(0); + _callLimit = a->data().toDouble(nullptr); refresh(); } @@ -2892,7 +2892,7 @@ void CallGraphView::zoomPosTriggered(QAction* a) { - _zoomPosition = (ZoomPosition) a->data().toInt(0); + _zoomPosition = (ZoomPosition) a->data().toInt(nullptr); updateSizes(); } @@ -2925,7 +2925,7 @@ void CallGraphView::layoutTriggered(QAction* a) { - _layout = (Layout) a->data().toInt(0); + _layout = (Layout) a->data().toInt(nullptr); refresh(); } @@ -2937,12 +2937,12 @@ QGraphicsItem* i = itemAt(e->pos()); QMenu popup; - TraceFunction *f = 0, *cycle = 0; - TraceCall* c = 0; + TraceFunction *f = nullptr, *cycle = nullptr; + TraceCall* c = nullptr; - QAction* activateFunction = 0; - QAction* activateCycle = 0; - QAction* activateCall = 0; + QAction* activateFunction = nullptr; + QAction* activateCycle = nullptr; + QAction* activateCall = nullptr; if (i) { if (i->type() == CANVAS_NODE) { GraphNode* n = ((CanvasNode*)i)->node(); @@ -2988,7 +2988,7 @@ } } - QAction* stopLayout = 0; + QAction* stopLayout = nullptr; if (_renderProcess) { stopLayout = popup.addAction(tr("Stop Layouting")); popup.addSeparator(); diff --git a/libviews/callitem.h b/libviews/callitem.h --- a/libviews/callitem.h +++ b/libviews/callitem.h @@ -33,7 +33,7 @@ public: CallItem(CallView*, QTreeWidget*, TraceCall* c); - bool operator<(const QTreeWidgetItem& other) const; + bool operator<(const QTreeWidgetItem& other) const override; TraceCall* call() { return _call; } CallView* view() { return _view; } void updateCost(); diff --git a/libviews/callmapview.h b/libviews/callmapview.h --- a/libviews/callmapview.h +++ b/libviews/callmapview.h @@ -41,16 +41,16 @@ CallMapView(bool showCallers, TraceItemView* parentView, QWidget* parent, const QString& name); - QWidget* widget() { return this; } - QString whatsThis() const; - void setData(TraceData*); + QWidget* widget() override { return this; } + QString whatsThis() const override; + void setData(TraceData*) override; - void restoreOptions(const QString& prefix, const QString& postfix); - void saveOptions(const QString& prefix, const QString& postfix); + void restoreOptions(const QString& prefix, const QString& postfix) override; + void saveOptions(const QString& prefix, const QString& postfix) override; bool showCallers() const { return _showCallers; } ProfileCostArray* totalCost(); - QString tipString(TreeMapItem*) const; + QString tipString(TreeMapItem*) const override; QColor groupColor(TraceFunction*) const; private slots: @@ -64,8 +64,8 @@ void borderWidthTriggered(QAction*); private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; // context menu builders void addItemListMenu(QMenu*,TreeMapItem*); @@ -94,10 +94,10 @@ class CallMapItemBase: public TreeMapItem { public: - int maxLines(int) const; - bool allowBreak(int) const; - bool allowTruncation(int) const; - Position position(int) const; + int maxLines(int) const override; + bool allowBreak(int) const override; + bool allowTruncation(int) const override; + Position position(int) const override; }; class CallMapRootItem: public CallMapItemBase @@ -107,14 +107,14 @@ void setFunction(TraceFunction* f); TraceFunction* function() { return _f; } - int rtti() const { return 1; } - double sum() const; - double value() const; - bool isMarked(int) const; - QString text(int) const; - QPixmap pixmap(int) const; - TreeMapItemList* children(); - QColor backColor() const; + int rtti() const override { return 1; } + double sum() const override; + double value() const override; + bool isMarked(int) const override; + QString text(int) const override; + QPixmap pixmap(int) const override; + TreeMapItemList* children() override; + QColor backColor() const override; private: TraceFunction* _f; @@ -126,16 +126,16 @@ public: CallMapCallingItem(double factor, TraceCall* c); void init(); - int rtti() const { return 2; } - int borderWidth() const { return widget()->borderWidth(); } + int rtti() const override { return 2; } + int borderWidth() const override { return widget()->borderWidth(); } TraceFunction* function() { return _c->called(); } - double value() const; - double sum() const; - bool isMarked(int) const; - QString text(int) const; - QPixmap pixmap(int) const; - TreeMapItemList* children(); - QColor backColor() const; + double value() const override; + double sum() const override; + bool isMarked(int) const override; + QString text(int) const override; + QPixmap pixmap(int) const override; + TreeMapItemList* children() override; + QColor backColor() const override; private: TraceCall* _c; @@ -146,15 +146,15 @@ { public: CallMapCallerItem(double factor, TraceCall* c); - int rtti() const { return 3; } - int borderWidth() const { return widget()->borderWidth(); } + int rtti() const override { return 3; } + int borderWidth() const override { return widget()->borderWidth(); } TraceFunction* function() { return _c->caller(); } - double value() const; - bool isMarked(int) const; - QString text(int i) const; - QPixmap pixmap(int) const; - TreeMapItemList* children(); - QColor backColor() const; + double value() const override; + bool isMarked(int) const override; + QString text(int i) const override; + QPixmap pixmap(int) const override; + TreeMapItemList* children() override; + QColor backColor() const override; private: TraceCall* _c; diff --git a/libviews/callmapview.cpp b/libviews/callmapview.cpp --- a/libviews/callmapview.cpp +++ b/libviews/callmapview.cpp @@ -139,7 +139,7 @@ { TraceItemView::setData(d); - ((CallMapRootItem*)base())->setFunction(0); + ((CallMapRootItem*)base())->setFunction(nullptr); } void CallMapView::addItemListMenu(QMenu* menu, TreeMapItem* item) @@ -440,7 +440,7 @@ _topLevel->showMessage(msg, 5000); } - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (item->rtti() == 1) { CallMapRootItem* bi = (CallMapRootItem*)item; @@ -472,16 +472,16 @@ default: break; } - return 0; + return nullptr; } void CallMapView::doUpdate(int changeType, bool) { if (changeType == eventType2Changed) return; // if there is a selected item, always draw marking... if (changeType & selectedItemChanged) { - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (_selectedItem) { switch(_selectedItem->type()) { @@ -503,7 +503,7 @@ if (changeType & activeItemChanged) { - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (_activeItem) { switch(_activeItem->type()) { @@ -573,7 +573,7 @@ ProfileCostArray* CallMapView::totalCost() { TraceFunction* f = ((CallMapRootItem*)base())->function(); - if (!f) return 0; + if (!f) return nullptr; return GlobalConfig::showExpanded() ? f->inclusive() : f->data(); } @@ -612,7 +612,7 @@ CallMapRootItem::CallMapRootItem() { - _f = 0; + _f = nullptr; } void CallMapRootItem::setFunction(TraceFunction* f) diff --git a/libviews/callview.h b/libviews/callview.h --- a/libviews/callview.h +++ b/libviews/callview.h @@ -33,10 +33,10 @@ public: CallView(bool showCallers, TraceItemView* parentView, - QWidget* parent=0); + QWidget* parent=nullptr); - virtual QWidget* widget() { return this; } - QString whatsThis() const; + QWidget* widget() override { return this; } + QString whatsThis() const override; bool showCallers() const { return _showCallers; } protected slots: @@ -46,11 +46,11 @@ void headerClicked(int); protected: - void keyPressEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event) override; private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; void refresh(); void setCostColumnWidths(); diff --git a/libviews/callview.cpp b/libviews/callview.cpp --- a/libviews/callview.cpp +++ b/libviews/callview.cpp @@ -115,11 +115,11 @@ // p is in local coordinates int col = columnAt(p.x()); QTreeWidgetItem* i = itemAt(p); - TraceCall* c = i ? ((CallItem*) i)->call() : 0; - TraceFunction *f = 0, *cycle = 0; + TraceCall* c = i ? ((CallItem*) i)->call() : nullptr; + TraceFunction *f = nullptr, *cycle = nullptr; - QAction* activateFunctionAction = 0; - QAction* activateCycleAction = 0; + QAction* activateFunctionAction = nullptr; + QAction* activateCycleAction = nullptr; if (c) { QString name = _showCallers ? c->callerName(true) : c->calledName(true); f = _showCallers ? c->caller(true) : c->called(true); @@ -207,7 +207,7 @@ default: break; } - return 0; + return nullptr; } void CallView::doUpdate(int changeType, bool) @@ -229,7 +229,7 @@ if (ti == _selectedItem) return; } - QTreeWidgetItem *item = 0; + QTreeWidgetItem *item = nullptr; for (int i=0; icall(); @@ -281,7 +281,7 @@ QList items; foreach(TraceCall* call, l) if (call->subCost(_eventType)>0) - items.append(new CallItem(this, 0, call)); + items.append(new CallItem(this, nullptr, call)); // when inserting, switch off sorting for performance reason setSortingEnabled(false); diff --git a/libviews/costlistitem.h b/libviews/costlistitem.h --- a/libviews/costlistitem.h +++ b/libviews/costlistitem.h @@ -32,8 +32,8 @@ CostListItem(QTreeWidget* parent, int skipped, TraceCostItem* cost, EventType* et); - bool operator< ( const QTreeWidgetItem & other ) const; - TraceCostItem* costItem() { return (_skipped) ? 0 : _costItem; } + bool operator< ( const QTreeWidgetItem & other ) const override; + TraceCostItem* costItem() { return (_skipped) ? nullptr : _costItem; } void setEventType(EventType* et); void update(); void setSize(int s); diff --git a/libviews/coverageitem.h b/libviews/coverageitem.h --- a/libviews/coverageitem.h +++ b/libviews/coverageitem.h @@ -38,8 +38,8 @@ TraceFunction* base, EventType* ct, ProfileContext::Type gt); - bool operator< ( const QTreeWidgetItem & other ) const; - TraceFunction* function() { return (_skipped) ? 0 : _function; } + bool operator< ( const QTreeWidgetItem & other ) const override; + TraceFunction* function() { return (_skipped) ? nullptr : _function; } void setCostType(EventType* ct); void setGroupType(ProfileContext::Type); void update(); @@ -66,8 +66,8 @@ TraceFunction* base, EventType* ct, ProfileContext::Type gt); - bool operator< ( const QTreeWidgetItem & other ) const; - TraceFunction* function() { return (_skipped) ? 0 : _function; } + bool operator< ( const QTreeWidgetItem & other ) const override; + TraceFunction* function() { return (_skipped) ? nullptr : _function; } void setCostType(EventType* ct); void setGroupType(ProfileContext::Type); void update(); diff --git a/libviews/coverageitem.cpp b/libviews/coverageitem.cpp --- a/libviews/coverageitem.cpp +++ b/libviews/coverageitem.cpp @@ -112,7 +112,7 @@ } setText(0, str); - setIcon(0, partitionPixmap(25, 10, _coverage->inclusiveHistogram(), 0, + setIcon(0, partitionPixmap(25, 10, _coverage->inclusiveHistogram(), nullptr, Coverage::maxHistogramDepth, false)); // call count @@ -174,7 +174,7 @@ { _skipped = 0; _coverage = c; - _function = c ? c->function() : 0; + _function = c ? c->function() : nullptr; _base = base; _groupType = ProfileContext::InvalidType; @@ -198,7 +198,7 @@ { _skipped = skipped; _coverage = c; - _function = c ? c->function() : 0; + _function = c ? c->function() : nullptr; _base = base; _groupType = ProfileContext::InvalidType; @@ -270,9 +270,9 @@ setText(1, _self.pretty()); } - setIcon(0, partitionPixmap(25, 10, _coverage->inclusiveHistogram(), 0, + setIcon(0, partitionPixmap(25, 10, _coverage->inclusiveHistogram(), nullptr, Coverage::maxHistogramDepth, false)); - setIcon(1, partitionPixmap(25, 10, _coverage->selfHistogram(), 0, + setIcon(1, partitionPixmap(25, 10, _coverage->selfHistogram(), nullptr, Coverage::maxHistogramDepth, false)); diff --git a/libviews/coverageview.h b/libviews/coverageview.h --- a/libviews/coverageview.h +++ b/libviews/coverageview.h @@ -35,23 +35,23 @@ public: CoverageView(bool showCallers, TraceItemView* parentView, - QWidget* parent = 0); + QWidget* parent = nullptr); - virtual QWidget* widget() { return this; } - QString whatsThis() const; + QWidget* widget() override { return this; } + QString whatsThis() const override; protected slots: void context(const QPoint &); void selectedSlot(QTreeWidgetItem*, QTreeWidgetItem*); void activatedSlot(QTreeWidgetItem*, int); void headerClicked(int); protected: - void keyPressEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event) override; private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; void refresh(); HighestCostList _hc; diff --git a/libviews/coverageview.cpp b/libviews/coverageview.cpp --- a/libviews/coverageview.cpp +++ b/libviews/coverageview.cpp @@ -158,14 +158,14 @@ QTreeWidgetItem* i = itemAt(p); QMenu popup; - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (i) { f = _showCallers ? ((CallerCoverageItem*)i)->function() : ((CalleeCoverageItem*)i)->function(); } - QAction* activateFunctionAction = 0; + QAction* activateFunctionAction = nullptr; if (f) { QString menuText = tr("Go to '%1'").arg(GlobalConfig::shortenSymbol(f->prettyName())); activateFunctionAction = popup.addAction(menuText); @@ -185,7 +185,7 @@ void CoverageView::selectedSlot(QTreeWidgetItem* i, QTreeWidgetItem*) { - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (i) { f = _showCallers ? ((CallerCoverageItem*)i)->function() : @@ -200,7 +200,7 @@ void CoverageView::activatedSlot(QTreeWidgetItem* i, int) { - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (i) { f = _showCallers ? ((CallerCoverageItem*)i)->function() : @@ -250,7 +250,7 @@ default: break; } - return 0; + return nullptr; } void CoverageView::doUpdate(int changeType, bool) @@ -263,7 +263,7 @@ return; } - TraceFunction* f = 0; + TraceFunction* f = nullptr; QTreeWidgetItem* i = currentItem(); if (i) { f = _showCallers ? @@ -309,7 +309,7 @@ if (!_data || !_activeItem) return; ProfileContext::Type t = _activeItem->type(); - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (t == ProfileContext::Function) f = (TraceFunction*) _activeItem; if (t == ProfileContext::FunctionCycle) f = (TraceFunction*) _activeItem; if (!f) return; @@ -338,20 +338,20 @@ ff = (TraceFunction*) _hc[i]; Coverage* c = (Coverage*) ff->association(Coverage::Rtti); if (_showCallers) - item = new CallerCoverageItem(0, c, f, _eventType, _groupType); + item = new CallerCoverageItem(nullptr, c, f, _eventType, _groupType); else - item = new CalleeCoverageItem(0, c, f, _eventType, _groupType); + item = new CalleeCoverageItem(nullptr, c, f, _eventType, _groupType); items.append(item); } if (_hc.hasMore()) { // a placeholder for all the functions skipped ... ff = (TraceFunction*) _hc[_hc.maxSize()-1]; Coverage* c = (Coverage*) ff->association(Coverage::Rtti); if (_showCallers) - item = new CallerCoverageItem(0, _hc.count() - _hc.maxSize(), + item = new CallerCoverageItem(nullptr, _hc.count() - _hc.maxSize(), c, f, _eventType, _groupType); else - item = new CalleeCoverageItem(0, _hc.count() - _hc.maxSize(), + item = new CalleeCoverageItem(nullptr, _hc.count() - _hc.maxSize(), c, f, _eventType, _groupType); items.append(item); } diff --git a/libviews/eventtypeitem.h b/libviews/eventtypeitem.h --- a/libviews/eventtypeitem.h +++ b/libviews/eventtypeitem.h @@ -33,13 +33,13 @@ EventTypeItem(TraceCostItem* costItem, EventType* ct, ProfileContext::Type gt); - bool operator<(const QTreeWidgetItem &other) const; + bool operator<(const QTreeWidgetItem &other) const override; void setGroupType(ProfileContext::Type); TraceCostItem* costItem() { return _costItem; } EventType* eventType() { return _eventType; } void update(); - QVariant data(int column, int role) const; + QVariant data(int column, int role) const override; private: SubCost _sum, _pure; diff --git a/libviews/eventtypeitem.cpp b/libviews/eventtypeitem.cpp --- a/libviews/eventtypeitem.cpp +++ b/libviews/eventtypeitem.cpp @@ -70,7 +70,7 @@ void EventTypeItem::update() { - TraceData* d = _costItem ? _costItem->data() : 0; + TraceData* d = _costItem ? _costItem->data() : nullptr; double total = d ? ((double)d->subCost(_eventType)) : 0.0; if (total == 0.0) { @@ -82,11 +82,11 @@ } TraceFunction* f = (_costItem && _costItem->type()==ProfileContext::Function) ? - (TraceFunction*)_costItem : 0; + (TraceFunction*)_costItem : nullptr; ProfileCostArray* selfTotalCost = f ? f->data() : d; if (f && GlobalConfig::showExpanded()) { - ProfileCostArray* parent = 0; + ProfileCostArray* parent = nullptr; switch(_groupType) { case ProfileContext::Object: parent = f->object(); break; case ProfileContext::Class: parent = f->cls(); break; diff --git a/libviews/eventtypeview.h b/libviews/eventtypeview.h --- a/libviews/eventtypeview.h +++ b/libviews/eventtypeview.h @@ -36,18 +36,18 @@ explicit EventTypeView(TraceItemView* parentView, QWidget* parent, const QString& name); - virtual QWidget* widget() { return this; } - QString whatsThis() const; + QWidget* widget() override { return this; } + QString whatsThis() const override; private slots: void context(const QPoint&); void currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*); void itemDoubleClicked(QTreeWidgetItem*, int); void itemChanged(QTreeWidgetItem*, int); private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; void refresh(); }; diff --git a/libviews/eventtypeview.cpp b/libviews/eventtypeview.cpp --- a/libviews/eventtypeview.cpp +++ b/libviews/eventtypeview.cpp @@ -98,21 +98,21 @@ QMenu popup; QTreeWidgetItem* i = itemAt(p); - EventType* ct = i ? ((EventTypeItem*) i)->eventType() : 0; + EventType* ct = i ? ((EventTypeItem*) i)->eventType() : nullptr; - QAction* selectType2Action = 0; - QAction* hideType2Action = 0; + QAction* selectType2Action = nullptr; + QAction* hideType2Action = nullptr; if (ct) selectType2Action = popup.addAction(tr("Set as Secondary Event Type")); if (_eventType2) hideType2Action = popup.addAction(tr("Hide Secondary Event Type")); if (!popup.isEmpty()) popup.addSeparator(); - QAction* editLongNameAction = 0; - QAction* editShortNameAction = 0; - QAction* editFormulaAction = 0; - QAction* removeTypeAction = 0; + QAction* editLongNameAction = nullptr; + QAction* editShortNameAction = nullptr; + QAction* editFormulaAction = nullptr; + QAction* removeTypeAction = nullptr; if (ct && !ct->isReal()) { editLongNameAction = popup.addAction(tr("Edit Long Name")); editShortNameAction = popup.addAction(tr("Edit Short Name")); @@ -123,22 +123,22 @@ addGoMenu(&popup); - QAction* newTypeAction = 0; + QAction* newTypeAction = nullptr; if( _data) { popup.addSeparator(); newTypeAction = popup.addAction(tr("New Event Type...")); } QAction* a = popup.exec(viewport()->mapToGlobal(p)); - if (a == hideType2Action) selectedEventType2(0); + if (a == hideType2Action) selectedEventType2(nullptr); else if (a == selectType2Action) selectedEventType2(ct); else if (a == editLongNameAction) editItem(i, 0); else if (a == editShortNameAction) editItem(i, 3); else if (a == editFormulaAction) editItem(i, 5); else if (a == removeTypeAction) { // search for a previous type - EventType* prev = 0, *ct = 0; + EventType* prev = nullptr, *ct = nullptr; EventTypeSet* m = _data->eventTypes(); for (int i=0;irealCount();i++) { ct = m->realType(i); @@ -183,21 +183,21 @@ void EventTypeView::currentItemChanged(QTreeWidgetItem* i, QTreeWidgetItem*) { - EventType* ct = i ? ((EventTypeItem*) i)->eventType() : 0; + EventType* ct = i ? ((EventTypeItem*) i)->eventType() : nullptr; if (ct) selectedEventType(ct); } void EventTypeView::itemDoubleClicked(QTreeWidgetItem* i, int) { - EventType* ct = i ? ((EventTypeItem*) i)->eventType() : 0; + EventType* ct = i ? ((EventTypeItem*) i)->eventType() : nullptr; if (ct) selectedEventType2(ct); } CostItem* EventTypeView::canShow(CostItem* i) { - if (!i) return 0; + if (!i) return nullptr; switch(i->type()) { case ProfileContext::Object: @@ -208,7 +208,7 @@ case ProfileContext::Function: break; default: - return 0; + return nullptr; } return i; } @@ -272,9 +272,9 @@ } TraceCostItem* c = (TraceCostItem*) _activeItem; - EventType* ct =0; - QTreeWidgetItem* item = 0; - QTreeWidgetItem* selected = 0; + EventType* ct =nullptr; + QTreeWidgetItem* item = nullptr; + QTreeWidgetItem* selected = nullptr; QList items; EventTypeSet* m = _data->eventTypes(); @@ -304,12 +304,12 @@ void EventTypeView::itemChanged(QTreeWidgetItem* item, int c) { - EventType* ct = item ? ((EventTypeItem*) item)->eventType() : 0; + EventType* ct = item ? ((EventTypeItem*) item)->eventType() : nullptr; if (!ct || ct->isReal()) return; // search for matching known Type int knownCount = EventType::knownTypeCount(); - EventType* known = 0; + EventType* known = nullptr; for (int i=0; iname() == ct->name()) break; diff --git a/libviews/functionlistmodel.h b/libviews/functionlistmodel.h --- a/libviews/functionlistmodel.h +++ b/libviews/functionlistmodel.h @@ -34,7 +34,7 @@ public: FunctionListModel(); - ~FunctionListModel(); + ~FunctionListModel() override; /* Data to show: all functions from * - which are part of function group @@ -44,16 +44,16 @@ EventType* eventType); // reimplemented from QAbstractItemModel - QVariant data(const QModelIndex&, int) const; - Qt::ItemFlags flags(const QModelIndex&) const; + QVariant data(const QModelIndex&, int) const override; + Qt::ItemFlags flags(const QModelIndex&) const override; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + int role = Qt::DisplayRole) const override; QModelIndex index(int row, int column = 0, - const QModelIndex &parent = QModelIndex()) const; - QModelIndex parent(const QModelIndex &index) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - void sort(int column, Qt::SortOrder order); + const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + void sort(int column, Qt::SortOrder order) override; void setFilter(QString filter); void setEventType(EventType*); diff --git a/libviews/functionlistmodel.cpp b/libviews/functionlistmodel.cpp --- a/libviews/functionlistmodel.cpp +++ b/libviews/functionlistmodel.cpp @@ -22,7 +22,7 @@ #include "listutils.h" FunctionListModel::FunctionListModel() - : QAbstractItemModel(0) + : QAbstractItemModel(nullptr) { _maxCount = 300; _sortColumn = 0; @@ -35,7 +35,7 @@ << tr("Function") << tr("Location"); - _max0 = _max1 = _max2 = 0; + _max0 = _max1 = _max2 = nullptr; } FunctionListModel::~FunctionListModel() @@ -58,7 +58,7 @@ TraceFunction* FunctionListModel::function(const QModelIndex& index) { - if (!index.isValid()) return 0; + if (!index.isValid()) return nullptr; return (TraceFunction*) index.internalPointer(); } @@ -77,7 +77,7 @@ } TraceFunction *f = (TraceFunction*) index.internalPointer(); - Q_ASSERT(f != 0); + Q_ASSERT(f != nullptr); switch(role) { case Qt::TextAlignmentRole: return (index.column()<3) ? Qt::AlignRight : Qt::AlignLeft; @@ -120,7 +120,7 @@ Qt::ItemFlags FunctionListModel::flags(const QModelIndex &index) const { if (!index.isValid()) - return 0; + return nullptr; return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } @@ -233,31 +233,31 @@ case ProfileContext::Object: { TraceObject* o = dynamic_cast(group); - Q_ASSERT(o != 0); + Q_ASSERT(o != nullptr); _list = o->functions(); } break; case ProfileContext::Class: { TraceClass* c = dynamic_cast(group); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); _list = c->functions(); } break; case ProfileContext::File: { TraceFile* f = dynamic_cast(group); - Q_ASSERT(f != 0); + Q_ASSERT(f != nullptr); _list = f->functions(); } break; case ProfileContext::FunctionCycle: { TraceFunctionCycle* c = dynamic_cast(group); - Q_ASSERT(c != 0); + Q_ASSERT(c != nullptr); _list = c->members(); } break; @@ -282,9 +282,9 @@ FunctionLessThan lessThan2(2, Qt::AscendingOrder, _eventType); // reset max functions - _max0 = 0; - _max1 = 0; - _max2 = 0; + _max0 = nullptr; + _max1 = nullptr; + _max2 = nullptr; _filteredList.clear(); int index = 0; diff --git a/libviews/functionselection.h b/libviews/functionselection.h --- a/libviews/functionselection.h +++ b/libviews/functionselection.h @@ -48,17 +48,17 @@ Q_OBJECT public: - explicit FunctionSelection(TopLevelBase*, QWidget* parent = 0); + explicit FunctionSelection(TopLevelBase*, QWidget* parent = nullptr); TraceCostItem* group() { return _group; } TraceCostItem* group(QString); void setGroup(TraceCostItem*); void query(QString); bool selectTopFunction(); - QWidget* widget() { return this; } - QString whatsThis() const; - void setData(TraceData*); + QWidget* widget() override { return this; } + QString whatsThis() const override; + void setData(TraceData*) override; void updateGroupingMenu(QMenu*); @@ -79,8 +79,8 @@ void functionHeaderClicked(int); private: - CostItem* canShow(CostItem* i); - void doUpdate(int, bool); + CostItem* canShow(CostItem* i) override; + void doUpdate(int, bool) override; void selectFunction(); void refresh(); void setCostColumnWidths(); @@ -118,13 +118,13 @@ { Q_OBJECT public: - explicit AutoToolTipDelegate(QObject* parent = 0); - ~AutoToolTipDelegate(); + explicit AutoToolTipDelegate(QObject* parent = nullptr); + ~AutoToolTipDelegate() override; public slots: bool helpEvent( QHelpEvent* e, QAbstractItemView* view, const QStyleOptionViewItem& option, - const QModelIndex& index ); + const QModelIndex& index ) override; }; #endif diff --git a/libviews/functionselection.cpp b/libviews/functionselection.cpp --- a/libviews/functionselection.cpp +++ b/libviews/functionselection.cpp @@ -87,9 +87,9 @@ FunctionSelection::FunctionSelection( TopLevelBase* top, QWidget* parent) - : QWidget(parent), TraceItemView(0, top) + : QWidget(parent), TraceItemView(nullptr, top) { - _group = 0; + _group = nullptr; _inSetGroup = false; _inSetFunction = false; _functionListSortOrder = Qt::DescendingOrder; @@ -233,11 +233,11 @@ { TraceItemView::setData(d); - _group = 0; + _group = nullptr; _groupSize.clear(); _hc.clear(GlobalConfig::maxListCount()); groupList->clear(); - functionListModel->resetModelData(d, 0, QString(), 0); + functionListModel->resetModelData(d, nullptr, QString(), nullptr); } void FunctionSelection::searchReturnPressed() @@ -250,7 +250,7 @@ item = groupList->currentItem(); if (!item || item->isHidden()) { int i; - item = 0; + item = nullptr; for (i=0; itopLevelItemCount(); i++) { item = groupList->topLevelItem(i); if (!item->isHidden()) break; @@ -285,9 +285,9 @@ void FunctionSelection::functionContext(const QPoint & p) { QMenu popup; - TraceFunction* f = 0; + TraceFunction* f = nullptr; - QAction* activateFunctionAction = 0; + QAction* activateFunctionAction = nullptr; QModelIndex i = functionList->indexAt(p); if (i.isValid()) { f = functionListModel->function(i); @@ -406,7 +406,7 @@ break; default: - i = 0; + i = nullptr; break; } return i; @@ -468,7 +468,7 @@ } if (changeType == activeItemChanged) { - if (_activeItem ==0) { + if (_activeItem ==nullptr) { functionList->clearSelection(); return; } @@ -536,7 +536,7 @@ case ProfileContext::File: _group = f->file(); break; case ProfileContext::FunctionCycle: _group = f->cycle(); break; default: - _group = 0; + _group = nullptr; break; } } @@ -570,7 +570,7 @@ if (g == _group) return; _group = g; - QTreeWidgetItem* item = 0; + QTreeWidgetItem* item = nullptr; int i; for (i=0; i < groupList->topLevelItemCount(); i++) { item = groupList->topLevelItem(i); @@ -582,7 +582,7 @@ groupList->scrollToItem(item); // prohibit signalling of a group selection _inSetGroup = true; - _group = 0; + _group = nullptr; groupList->setCurrentItem(item); _inSetGroup = false; } @@ -603,7 +603,7 @@ functionListModel->setMaxCount(GlobalConfig::maxListCount()); if (!_data || _data->parts().count()==0) { - functionListModel->resetModelData(0, 0, QString(), 0); + functionListModel->resetModelData(nullptr, nullptr, QString(), nullptr); selectTopFunction(); return; } @@ -652,7 +652,7 @@ default: { - _group = 0; + _group = nullptr; functionListModel->resetModelData(_data, _group, _searchString, _eventType); selectFunction(dynamic_cast(_activeItem)); setCostColumnWidths(); @@ -664,7 +664,7 @@ if (_activeItem && (_activeItem->type() == _groupType)) _group = (TraceCostItem*) _activeItem; - QTreeWidgetItem *item = 0, *activeItem = 0; + QTreeWidgetItem *item = nullptr, *activeItem = nullptr; QList items; // we always put group of active item in list, even if @@ -708,7 +708,7 @@ if (activeItem) { groupList->scrollToItem(activeItem); _inSetGroup = true; - _group = 0; + _group = nullptr; groupList->setCurrentItem(activeItem); _inSetGroup = false; } @@ -765,7 +765,7 @@ return item->costItem(); } - return 0; + return nullptr; } @@ -811,7 +811,7 @@ QRegExp re(query, Qt::CaseInsensitive, QRegExp::Wildcard); _groupSize.clear(); - TraceFunction* f = 0; + TraceFunction* f = nullptr; TraceFunctionList list2; _hc.clear(GlobalConfig::maxListCount()); @@ -872,7 +872,7 @@ functionActivated(i); - return (f!=0); + return (f!=nullptr); } void FunctionSelection::setCostColumnWidths() diff --git a/libviews/globalguiconfig.h b/libviews/globalguiconfig.h --- a/libviews/globalguiconfig.h +++ b/libviews/globalguiconfig.h @@ -74,13 +74,13 @@ public: GlobalGUIConfig(); - ~GlobalGUIConfig(); + ~GlobalGUIConfig() override; // gets the singleton instance static GlobalGUIConfig* config(); - void saveOptions(); - void readOptions(); + void saveOptions() override; + void readOptions() override; // color for visualization of an object static QColor functionColor(ProfileContext::Type gt, TraceFunction*); diff --git a/libviews/globalguiconfig.cpp b/libviews/globalguiconfig.cpp --- a/libviews/globalguiconfig.cpp +++ b/libviews/globalguiconfig.cpp @@ -89,13 +89,13 @@ { GlobalGUIConfig* gc; - if (_config == 0) { + if (_config == nullptr) { gc = new GlobalGUIConfig(); _config = gc; } else { gc = dynamic_cast(_config); - if (gc == 0) + if (gc == nullptr) qFatal("Internal error: config object is not a GlobalGUIConfig."); } @@ -231,7 +231,7 @@ { // predefined ? GlobalGUIConfig* c = config(); - ConfigColorSetting* cs = c->_colors.value(n, 0); + ConfigColorSetting* cs = c->_colors.value(n, nullptr); if (cs || !createNew) return cs; cs = new ConfigColorSetting(n); diff --git a/libviews/instritem.h b/libviews/instritem.h --- a/libviews/instritem.h +++ b/libviews/instritem.h @@ -60,7 +60,7 @@ TraceInstrJump* instrJump() const { return _instrJump; } TraceInstrJump* jump(int i) const { return _jump[i]; } int jumpCount() const { return _jump.size(); } - bool operator< ( const QTreeWidgetItem & other ) const; + bool operator< ( const QTreeWidgetItem & other ) const override; void updateGroup(); void updateCost(); @@ -88,9 +88,9 @@ public: explicit InstrItemDelegate(InstrView *parent); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex & index ) const; + const QModelIndex & index ) const override; QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const override; protected: void paintArrows(QPainter *p, diff --git a/libviews/instritem.cpp b/libviews/instritem.cpp --- a/libviews/instritem.cpp +++ b/libviews/instritem.cpp @@ -41,9 +41,9 @@ { _view = iv; _addr = addr; - _instr = 0; - _instrCall = 0; - _instrJump = 0; + _instr = nullptr; + _instrCall = nullptr; + _instrJump = nullptr; _inside = false; setTextAlignment(0, Qt::AlignRight); @@ -67,8 +67,8 @@ _view = iv; _addr = addr; _instr = instr; - _instrCall = 0; - _instrJump = 0; + _instrCall = nullptr; + _instrJump = nullptr; _inside = inside; setTextAlignment(0, Qt::AlignRight); @@ -100,7 +100,7 @@ _addr = addr; _instr = instr; _instrCall = instrCall; - _instrJump = 0; + _instrJump = nullptr; _inside = true; setTextAlignment(0, Qt::AlignRight); @@ -143,7 +143,7 @@ _addr = addr; _inside = true; _instr = instr; - _instrCall = 0; + _instrCall = nullptr; _instrJump = instrJump; setTextAlignment(0, Qt::AlignRight); @@ -380,7 +380,7 @@ // draw line borders, detect start/stop of a line for(int i=0; i< item->jumpCount(); i++) { TraceInstrJump* jump = item->jump(i); - if (jump == 0) continue; + if (jump == nullptr) continue; y1 = 0; y2 = height; @@ -455,7 +455,7 @@ // this overwrites borders of horizontal line for(int i=0; i< item->jumpCount(); i++) { TraceInstrJump* jump = item->jump(i); - if (jump == 0) continue; + if (jump == nullptr) continue; c = jump->isCondJump() ? Qt::red : Qt::blue; diff --git a/libviews/instrview.h b/libviews/instrview.h --- a/libviews/instrview.h +++ b/libviews/instrview.h @@ -37,27 +37,27 @@ public: explicit InstrView(TraceItemView* parentView, - QWidget* parent = 0); + QWidget* parent = nullptr); - virtual QWidget* widget() { return this; } - QString whatsThis() const; + QWidget* widget() override { return this; } + QString whatsThis() const override; int arrowLevels() { return _arrowLevels; } - void restoreOptions(const QString& prefix, const QString& postfix); - void saveOptions(const QString& prefix, const QString& postfix); + void restoreOptions(const QString& prefix, const QString& postfix) override; + void saveOptions(const QString& prefix, const QString& postfix) override; protected slots: void context(const QPoint &); void selectedSlot(QTreeWidgetItem*, QTreeWidgetItem*); void activatedSlot(QTreeWidgetItem*,int); void headerClicked(int); protected: - void keyPressEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event) override; private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; void refresh(); void setColumnWidths(); bool searchFile(QString&, TraceObject*); diff --git a/libviews/instrview.cpp b/libviews/instrview.cpp --- a/libviews/instrview.cpp +++ b/libviews/instrview.cpp @@ -254,13 +254,13 @@ int c = columnAt(p.x()); QTreeWidgetItem* i = itemAt(p); - TraceInstrCall* ic = i ? ((InstrItem*) i)->instrCall() : 0; - TraceInstrJump* ij = i ? ((InstrItem*) i)->instrJump() : 0; - TraceFunction* f = ic ? ic->call()->called() : 0; - TraceInstr* instr = ij ? ij->instrTo() : 0; + TraceInstrCall* ic = i ? ((InstrItem*) i)->instrCall() : nullptr; + TraceInstrJump* ij = i ? ((InstrItem*) i)->instrJump() : nullptr; + TraceFunction* f = ic ? ic->call()->called() : nullptr; + TraceInstr* instr = ij ? ij->instrTo() : nullptr; - QAction* activateFunctionAction = 0; - QAction* activateInstrAction = 0; + QAction* activateFunctionAction = nullptr; + QAction* activateInstrAction = nullptr; if (f) { QString menuText = tr("Go to '%1'").arg(GlobalConfig::shortenSymbol(f->prettyName())); activateFunctionAction = popup.addAction(menuText); @@ -375,7 +375,7 @@ break; } - return 0; + return nullptr; } @@ -390,15 +390,15 @@ } QList items = selectedItems(); - InstrItem* ii = (items.count() > 0) ? (InstrItem*)items[0] : 0; + InstrItem* ii = (items.count() > 0) ? (InstrItem*)items[0] : nullptr; if (ii) { if ((ii->instr() == _selectedItem) || (ii->instr() && (ii->instr()->line() == _selectedItem))) return; if (ii->instrCall() && (ii->instrCall()->call()->called() == _selectedItem)) return; } - TraceInstrJump* ij = 0; + TraceInstrJump* ij = nullptr; if (_selectedItem->type() == ProfileContext::InstrJump) ij = (TraceInstrJump*) _selectedItem; @@ -415,7 +415,7 @@ _inSelectionUpdate = false; break; } - item2 = 0; + item2 = nullptr; for (int j=0; ichildCount(); j++) { item2 = item->child(j); ii = (InstrItem*)item2; @@ -545,7 +545,7 @@ if (!_data || !_activeItem) return; ProfileContext::Type t = _activeItem->type(); - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (t == ProfileContext::Function) f = (TraceFunction*) _activeItem; if (t == ProfileContext::Instr) { f = ((TraceInstr*)_activeItem)->function(); @@ -692,7 +692,7 @@ if (iStart==_arrowLevels) { for(iStart=0; iStart<_arrowLevels; ++iStart) - if (_jump[iStart] == 0) break; + if (_jump[iStart] == nullptr) break; if (iStart==_arrowLevels) { _arrowLevels++; _jump.resize(_arrowLevels); @@ -741,11 +741,11 @@ if (highAddr > addr) break; else { - if (iEnd>=0) _jump[iEnd] = 0; + if (iEnd>=0) _jump[iEnd] = nullptr; iEnd = -1; } } - if (iEnd>=0) _jump[iEnd] = 0; + if (iEnd>=0) _jump[iEnd] = nullptr; } @@ -867,7 +867,7 @@ int objdumpLineno = 0, dumpedLines = 0, noAssLines = 0; SubCost most = 0; TraceInstr* currInstr; - InstrItem *ii, *ii2, *item = 0, *first = 0, *selected = 0; + InstrItem *ii, *ii2, *item = nullptr, *first = nullptr, *selected = nullptr; QString code, cmd, args; bool needObjAddr = true, needCostAddr = true; @@ -944,7 +944,7 @@ needCostAddr = true; } else - currInstr = 0; + currInstr = nullptr; needObjAddr = true; @@ -1005,7 +1005,7 @@ skipLineWritten = false; - ii = new InstrItem(this, 0, addr, inside, + ii = new InstrItem(this, nullptr, addr, inside, code, cmd, args, currInstr); items.append(ii); diff --git a/libviews/listutils.cpp b/libviews/listutils.cpp --- a/libviews/listutils.cpp +++ b/libviews/listutils.cpp @@ -36,7 +36,7 @@ static bool inited = false; if (!inited) { - for (int i=0;i<37;i++) pixs[i]=0; + for (int i=0;i<37;i++) pixs[i]=nullptr; inited = true; } int hash = (w+h+c.red()+c.green()+c.blue()) % 37; diff --git a/libviews/multiview.h b/libviews/multiview.h --- a/libviews/multiview.h +++ b/libviews/multiview.h @@ -38,30 +38,30 @@ Q_OBJECT public: - explicit MultiView(TopLevelBase* top, QWidget* parent = 0); + explicit MultiView(TopLevelBase* top, QWidget* parent = nullptr); - QWidget* widget() { return this; } + QWidget* widget() override { return this; } TabView* activeTabView() const { return _active; } - void setData(TraceData*); + void setData(TraceData*) override; void appendView(); void removeView(); void setChildCount(int); int childCount() { return _views.count(); } - void selected(TraceItemView*, CostItem*); - void activated(TraceItemView*, CostItem*); + void selected(TraceItemView*, CostItem*) override; + void activated(TraceItemView*, CostItem*) override; - void saveLayout(const QString& prefix, const QString& postfix); - void restoreLayout(const QString& prefix, const QString& postfix); - void saveOptions(const QString& prefix, const QString& postfix); - void restoreOptions(const QString& prefix, const QString& postfix); + void saveLayout(const QString& prefix, const QString& postfix) override; + void restoreLayout(const QString& prefix, const QString& postfix) override; + void saveOptions(const QString& prefix, const QString& postfix) override; + void restoreOptions(const QString& prefix, const QString& postfix) override; public slots: void tabActivated(TabView*); private: - void doUpdate(int, bool); + void doUpdate(int, bool) override; TabView* _active; QList _views; diff --git a/libviews/multiview.cpp b/libviews/multiview.cpp --- a/libviews/multiview.cpp +++ b/libviews/multiview.cpp @@ -36,7 +36,7 @@ // MultiView::MultiView(TopLevelBase* top, QWidget* parent) - : QSplitter(parent), TraceItemView(0, top) + : QSplitter(parent), TraceItemView(nullptr, top) { // default setOrientation(Qt::Horizontal); @@ -76,7 +76,7 @@ // set same attributes as in active view tv->set(0, _data, _eventType, _eventType2, - _groupType, _partList, _activeItem, 0); + _groupType, _partList, _activeItem, nullptr); if (0) qDebug() << "MultiView::appendView, now " << _views.count(); @@ -110,7 +110,7 @@ if (0) qDebug() << "MultiView::tabActivated " << newActiveTab->objectName(); - CostItem* oldActiveItem = 0; + CostItem* oldActiveItem = nullptr; if (_active) { oldActiveItem = _active->activeItem(); _active->setActive(false); @@ -183,7 +183,7 @@ } delete g; - TabView* activeTV = 0; + TabView* activeTV = nullptr; foreach(TabView* tv, _views) { if (tv->objectName() == active) activeTV=tv; tv->restoreLayout( QStringLiteral("%1-%2").arg(prefix).arg(tv->objectName()), diff --git a/libviews/partgraph.h b/libviews/partgraph.h --- a/libviews/partgraph.h +++ b/libviews/partgraph.h @@ -36,7 +36,7 @@ // Visualization inside of trace parts enum VisualizationMode { NoVisualization, Partitioning, Inclusive }; - explicit PartAreaWidget(QWidget* parent=0); + explicit PartAreaWidget(QWidget* parent=nullptr); void setData(TraceData* d); void setEventType(EventType* ct); @@ -54,7 +54,7 @@ int callLevels() const { return _callLevels; } QColor groupColor(TraceFunction*) const; - QString tipString(TreeMapItem*) const; + QString tipString(TreeMapItem*) const override; void changeHidden(const TracePartList& list); bool isHidden(TracePart*) const; @@ -80,12 +80,12 @@ void setData(TraceData* d); - int rtti() const { return 1; } - double value() const; - QString text(int) const; - int borderWidth() const { return 0; } - TreeMapItemList* children(); - QColor backColor() const; + int rtti() const override { return 1; } + double value() const override; + QString text(int) const override; + int borderWidth() const override { return 0; } + TreeMapItemList* children() override; + QColor backColor() const override; private: TraceData* _data; @@ -95,15 +95,15 @@ { public: explicit PartItem(TracePart* p); - int rtti() const { return 2; } + int rtti() const override { return 2; } TracePart* part() { return _p; } - double value() const; - double sum() const; - int borderWidth() const { return 0; } - QString text(int) const; - QPixmap pixmap(int) const; - TreeMapItemList* children(); - QColor backColor() const; + double value() const override; + double sum() const override; + int borderWidth() const override { return 0; } + QString text(int) const override; + QPixmap pixmap(int) const override; + TreeMapItemList* children() override; + QColor backColor() const override; private: TracePart* _p; @@ -114,15 +114,15 @@ { public: explicit SubPartItem(ProfileCostArray*); - int rtti() const { return 3; } + int rtti() const override { return 3; } ProfileCostArray* partCostItem() { return _partCostItem; } - double value() const; - double sum() const; - SplitMode splitMode() const { return Vertical; } - QString text(int) const; - QPixmap pixmap(int) const; - TreeMapItemList* children(); - QColor backColor() const; + double value() const override; + double sum() const override; + SplitMode splitMode() const override { return Vertical; } + QString text(int) const override; + QPixmap pixmap(int) const override; + TreeMapItemList* children() override; + QColor backColor() const override; private: ProfileCostArray* _partCostItem; diff --git a/libviews/partgraph.cpp b/libviews/partgraph.cpp --- a/libviews/partgraph.cpp +++ b/libviews/partgraph.cpp @@ -33,10 +33,10 @@ PartAreaWidget::PartAreaWidget(QWidget* parent) : TreeMapWidget(new BasePartItem(), parent) { - _data = 0; - _function = 0; + _data = nullptr; + _function = nullptr; - _eventType = 0; + _eventType = nullptr; _groupType = ProfileContext::InvalidType; _visualization = NoVisualization; _zoomFunction = false; @@ -48,7 +48,7 @@ if (data == _data) return; _data = data; - _function = 0; + _function = nullptr; _hiddenParts.clear(); ((BasePartItem*)base())->setData(data); @@ -186,7 +186,7 @@ BasePartItem::BasePartItem() : TreeMapItem() { - _data = 0; + _data = nullptr; setSorting(-1); } @@ -399,7 +399,7 @@ QColor PartItem::backColor() const { PartAreaWidget* w = (PartAreaWidget*)widget(); - return w->groupColor(0); + return w->groupColor(nullptr); } diff --git a/libviews/partlistitem.h b/libviews/partlistitem.h --- a/libviews/partlistitem.h +++ b/libviews/partlistitem.h @@ -36,7 +36,7 @@ PartListItem(QTreeWidget* parent, TraceCostItem* costItem, EventType* ct, ProfileContext::Type gt, TracePart* part); - bool operator<(const QTreeWidgetItem& other) const; + bool operator<(const QTreeWidgetItem& other) const override; ProfileCostArray* partCostItem() { return _partCostItem; } void setEventType(EventType* ct); void setGroupType(ProfileContext::Type); diff --git a/libviews/partlistitem.cpp b/libviews/partlistitem.cpp --- a/libviews/partlistitem.cpp +++ b/libviews/partlistitem.cpp @@ -72,9 +72,9 @@ void PartListItem::update() { TracePartFunction* pf; - pf = !_partCostItem ? 0 : + pf = !_partCostItem ? nullptr : (_partCostItem->type()==ProfileContext::PartFunction) ? - ((TracePartFunction*)_partCostItem) : 0; + ((TracePartFunction*)_partCostItem) : nullptr; double total = _part->subCost(_eventType); diff --git a/libviews/partselection.h b/libviews/partselection.h --- a/libviews/partselection.h +++ b/libviews/partselection.h @@ -40,16 +40,16 @@ Q_OBJECT public: - explicit PartSelection(TopLevelBase*, QWidget* parent = 0); + explicit PartSelection(TopLevelBase*, QWidget* parent = nullptr); - virtual QWidget* widget() { return this; } - QString whatsThis() const; - void setData(TraceData*); + QWidget* widget() override { return this; } + QString whatsThis() const override; + void setData(TraceData*) override; PartAreaWidget* graph() { return _partAreaWidget; } - void saveOptions(const QString& prefix, const QString& postfix); - void restoreOptions(const QString& prefix, const QString& postfix); + void saveOptions(const QString& prefix, const QString& postfix) override; + void restoreOptions(const QString& prefix, const QString& postfix) override; signals: void partsHideSelected(); @@ -67,8 +67,8 @@ private: // reimplementations of TraceItemView - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; // helper for doUpdate void selectParts(const TracePartList& list); diff --git a/libviews/partselection.cpp b/libviews/partselection.cpp --- a/libviews/partselection.cpp +++ b/libviews/partselection.cpp @@ -51,7 +51,7 @@ PartSelection::PartSelection( TopLevelBase* top, QWidget* parent) - : QWidget(parent), TraceItemView(0, top) + : QWidget(parent), TraceItemView(nullptr, top) { _inSelectionUpdate = false; @@ -145,7 +145,7 @@ default: break; } - return 0; + return nullptr; } /* Helper for doUpdate(), called on partsChanged event. @@ -201,7 +201,7 @@ _partAreaWidget->setGroupType(_groupType); if (changeType & activeItemChanged) { - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (_activeItem) { switch(_activeItem->type()) { @@ -252,7 +252,7 @@ if (!i || i->rtti() != 3) return; ProfileCostArray* c = ((SubPartItem*) i)->partCostItem(); - TraceCostItem* ci = 0; + TraceCostItem* ci = nullptr; switch(c->type()) { case ProfileContext::PartFunction: @@ -334,12 +334,12 @@ QAction* a; QString str; - TreeMapItem* s = 0; + TreeMapItem* s = nullptr; - QAction* selectPartAction = 0; - QAction* selectAllPartsAction = 0; - QAction* hidePartsAction = 0; - QAction* showPartsAction = 0; + QAction* selectPartAction = nullptr; + QAction* selectAllPartsAction = nullptr; + QAction* hidePartsAction = nullptr; + QAction* showPartsAction = nullptr; if (_data && (_data->parts().count()>1)) { s = _partAreaWidget->possibleSelection(i); if (!s->text(0).isEmpty()) { diff --git a/libviews/partview.h b/libviews/partview.h --- a/libviews/partview.h +++ b/libviews/partview.h @@ -33,10 +33,10 @@ Q_OBJECT public: - explicit PartView(TraceItemView* parentView, QWidget* parent=0); + explicit PartView(TraceItemView* parentView, QWidget* parent=nullptr); - virtual QWidget* widget() { return this; } - QString whatsThis() const; + QWidget* widget() override { return this; } + QString whatsThis() const override; void refresh(); @@ -46,8 +46,8 @@ void headerClicked(int); private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; bool _inSelectionUpdate; }; diff --git a/libviews/partview.cpp b/libviews/partview.cpp --- a/libviews/partview.cpp +++ b/libviews/partview.cpp @@ -137,9 +137,9 @@ CostItem* PartView::canShow(CostItem* i) { - if (!TraceItemView::data()) return 0; + if (!TraceItemView::data()) return nullptr; if (TraceItemView::data()->parts().count()>1) return i; - return 0; + return nullptr; } void PartView::doUpdate(int changeType, bool) @@ -220,7 +220,7 @@ } ProfileContext::Type t = _activeItem->type(); - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (t == ProfileContext::Function) f = (TraceFunction*) _activeItem; if (!f) return; @@ -235,7 +235,7 @@ QTreeWidgetItem* item; foreach(TracePart* part, _data->parts()) { if (hidden.contains(part)) continue; - item = new PartListItem(0, f, _eventType, _groupType, part); + item = new PartListItem(nullptr, f, _eventType, _groupType, part); items.append(item); } setSortingEnabled(false); diff --git a/libviews/sourceitem.h b/libviews/sourceitem.h --- a/libviews/sourceitem.h +++ b/libviews/sourceitem.h @@ -37,7 +37,7 @@ SourceItem(SourceView* sv, QTreeWidget* parent, int fileno, unsigned int lineno, bool inside, const QString& src, - TraceLine* line = 0); + TraceLine* line = nullptr); // for call lines SourceItem(SourceView* sv, QTreeWidgetItem* parent, @@ -57,7 +57,7 @@ TraceLineJump* lineJump() const { return _lineJump; } TraceLineJump* jump(int i) const { return _jump[i]; } int jumpCount() const { return _jump.size(); } - bool operator< ( const QTreeWidgetItem & other ) const; + bool operator< ( const QTreeWidgetItem & other ) const override; void updateGroup(); void updateCost(); @@ -87,12 +87,12 @@ public: explicit SourceItemDelegate(SourceView *parent); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex & index ) const; + const QModelIndex & index ) const override; QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const override; QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const; + const QModelIndex &index) const override; protected: void paintArrows(QPainter *p, diff --git a/libviews/sourceitem.cpp b/libviews/sourceitem.cpp --- a/libviews/sourceitem.cpp +++ b/libviews/sourceitem.cpp @@ -50,8 +50,8 @@ _fileno = fileno; _inside = inside; _line = line; - _lineCall = 0; - _lineJump = 0; + _lineCall = nullptr; + _lineJump = nullptr; setTextAlignment(0, Qt::AlignRight); setTextAlignment(1, Qt::AlignRight); @@ -84,7 +84,7 @@ _inside = true; _line = line; _lineCall = lineCall; - _lineJump = 0; + _lineJump = nullptr; setTextAlignment(0, Qt::AlignRight); setTextAlignment(1, Qt::AlignRight); @@ -126,7 +126,7 @@ _fileno = fileno; _inside = true; _line = line; - _lineCall = 0; + _lineCall = nullptr; _lineJump = lineJump; setTextAlignment(0, Qt::AlignRight); @@ -384,7 +384,7 @@ // draw line borders, detect start/stop of a line for(int i=0; i< item->jumpCount(); i++) { TraceLineJump* jump = item->jump(i); - if (jump == 0) continue; + if (jump == nullptr) continue; y1 = 0; y2 = height; @@ -459,7 +459,7 @@ // this overwrites borders of horizontal line for(int i=0;i< item->jumpCount();i++) { TraceLineJump* jump = item->jump(i); - if (jump == 0) continue; + if (jump == nullptr) continue; c = jump->isCondJump() ? Qt::red : Qt::blue; diff --git a/libviews/sourceview.h b/libviews/sourceview.h --- a/libviews/sourceview.h +++ b/libviews/sourceview.h @@ -36,10 +36,10 @@ public: explicit SourceView(TraceItemView* parentView, - QWidget* parent = 0); + QWidget* parent = nullptr); - QWidget* widget() { return this; } - QString whatsThis() const; + QWidget* widget() override { return this; } + QString whatsThis() const override; int arrowLevels() { return _arrowLevels; } protected slots: @@ -49,11 +49,11 @@ void headerClicked(int); protected: - void keyPressEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event) override; private: - CostItem* canShow(CostItem*); - void doUpdate(int, bool); + CostItem* canShow(CostItem*) override; + void doUpdate(int, bool) override; void refresh(); void updateJumpArray(uint,SourceItem*,bool,bool); bool searchFile(QString&, TraceFunctionSource*); diff --git a/libviews/sourceview.cpp b/libviews/sourceview.cpp --- a/libviews/sourceview.cpp +++ b/libviews/sourceview.cpp @@ -109,13 +109,13 @@ QTreeWidgetItem* i = itemAt(p); QMenu popup; - TraceLineCall* lc = i ? ((SourceItem*) i)->lineCall() : 0; - TraceLineJump* lj = i ? ((SourceItem*) i)->lineJump() : 0; - TraceFunction* f = lc ? lc->call()->called() : 0; - TraceLine* line = lj ? lj->lineTo() : 0; + TraceLineCall* lc = i ? ((SourceItem*) i)->lineCall() : nullptr; + TraceLineJump* lj = i ? ((SourceItem*) i)->lineJump() : nullptr; + TraceFunction* f = lc ? lc->call()->called() : nullptr; + TraceLine* line = lj ? lj->lineTo() : nullptr; - QAction* activateFunctionAction = 0; - QAction* activateLineAction = 0; + QAction* activateFunctionAction = nullptr; + QAction* activateLineAction = nullptr; if (f) { QString menuText = tr("Go to '%1'").arg(GlobalConfig::shortenSymbol(f->prettyName())); activateFunctionAction = popup.addAction(menuText); @@ -159,13 +159,13 @@ return; } - TraceFunction* f = lc ? lc->call()->called() : 0; + TraceFunction* f = lc ? lc->call()->called() : nullptr; if (f) { _selectedItem = f; selected(f); } else { - TraceLine* line = lj ? lj->lineTo() : 0; + TraceLine* line = lj ? lj->lineTo() : nullptr; if (line) { _selectedItem = line; selected(line); @@ -186,10 +186,10 @@ return; } - TraceFunction* f = lc ? lc->call()->called() : 0; + TraceFunction* f = lc ? lc->call()->called() : nullptr; if (f) TraceItemView::activated(f); else { - TraceLine* line = lj ? lj->lineTo() : 0; + TraceLine* line = lj ? lj->lineTo() : nullptr; if (line) TraceItemView::activated(line); } } @@ -219,7 +219,7 @@ break; } - return 0; + return nullptr; } void SourceView::doUpdate(int changeType, bool) @@ -232,16 +232,16 @@ return; } - TraceLine* sLine = 0; + TraceLine* sLine = nullptr; if (_selectedItem->type() == ProfileContext::Line) sLine = (TraceLine*) _selectedItem; if (_selectedItem->type() == ProfileContext::Instr) sLine = ((TraceInstr*)_selectedItem)->line(); - if ((_selectedItem->type() != ProfileContext::Function) && (sLine == 0)) + if ((_selectedItem->type() != ProfileContext::Function) && (sLine == nullptr)) return; QList items = selectedItems(); - SourceItem* si = (items.count() > 0) ? (SourceItem*)items[0] : 0; + SourceItem* si = (items.count() > 0) ? (SourceItem*)items[0] : nullptr; if (si) { if (sLine && (si->line() == sLine)) return; if (si->lineCall() && @@ -317,7 +317,7 @@ } ProfileContext::Type t = _activeItem->type(); - TraceFunction* f = 0; + TraceFunction* f = nullptr; if (t == ProfileContext::Function) f = (TraceFunction*) _activeItem; if (t == ProfileContext::Instr) { f = ((TraceInstr*)_activeItem)->function(); @@ -471,7 +471,7 @@ if (iStart == asize) { for(iStart=0; iStart lineno) break; else { - if (iEnd>=0) _jump[iEnd] = 0; + if (iEnd>=0) _jump[iEnd] = nullptr; iEnd = -1; } } - if (iEnd>=0) _jump[iEnd] = 0; + if (iEnd>=0) _jump[iEnd] = nullptr; } @@ -593,7 +593,7 @@ bool validSourceFile = (!sf->file()->name().isEmpty()); - TraceLine* sLine = 0; + TraceLine* sLine = nullptr; if (_selectedItem) { if (_selectedItem->type() == ProfileContext::Line) sLine = (TraceLine*) _selectedItem; @@ -740,7 +740,7 @@ QList items; TraceLine* currLine; - SourceItem *si, *si2, *item = 0, *first = 0, *selected = 0; + SourceItem *si, *si2, *item = nullptr, *first = nullptr, *selected = nullptr; QFile file(filename); bool fileEndReached = false; if (!file.open(QIODevice::ReadOnly)) return; @@ -794,7 +794,7 @@ nextCostLineno = (lineIt == lineItEnd) ? 0 : (*lineIt).lineno(); } else - currLine = 0; + currLine = nullptr; // update inside if (!inside) { @@ -827,7 +827,7 @@ QString s = QString(buf); if(s.size() > 0 && s.at(s.length()-1) == '\r') s = s.left(s.length()-1); - si = new SourceItem(this, 0, + si = new SourceItem(this, nullptr, fileno, fileLineno, inside, s, currLine); items.append(si); diff --git a/libviews/stackitem.cpp b/libviews/stackitem.cpp --- a/libviews/stackitem.cpp +++ b/libviews/stackitem.cpp @@ -37,7 +37,7 @@ { _view = ss; _function = f; - _call = 0; + _call = nullptr; setTextAlignment(0, Qt::AlignRight); setTextAlignment(1, Qt::AlignRight); diff --git a/libviews/stackselection.h b/libviews/stackselection.h --- a/libviews/stackselection.h +++ b/libviews/stackselection.h @@ -40,8 +40,8 @@ Q_OBJECT public: - explicit StackSelection(QWidget* parent = 0); - ~StackSelection(); + explicit StackSelection(QWidget* parent = nullptr); + ~StackSelection() override; TraceData* data() const { return _data; } void setData(TraceData*); diff --git a/libviews/stackselection.cpp b/libviews/stackselection.cpp --- a/libviews/stackselection.cpp +++ b/libviews/stackselection.cpp @@ -36,11 +36,11 @@ StackSelection::StackSelection(QWidget* parent) : QWidget(parent) { - _data = 0; + _data = nullptr; _browser = new StackBrowser(); - _function = 0; - _eventType = 0; - _eventType2 = 0; + _function = nullptr; + _eventType = nullptr; + _eventType2 = nullptr; _groupType = ProfileContext::Function; setWindowTitle(tr("Stack Selection")); @@ -85,7 +85,7 @@ _stackList->clear(); delete _browser; _browser = new StackBrowser(); - _function = 0; + _function = nullptr; } @@ -120,15 +120,15 @@ QList items; - QTreeWidgetItem* activeItem = 0; + QTreeWidgetItem* activeItem = nullptr; TraceCallList l = item->stack()->calls(); for(int i=l.count()-1; i>=0; i--) { - StackItem* si = new StackItem(this, 0, l.at(i)); + StackItem* si = new StackItem(this, nullptr, l.at(i)); if (si->function() == item->function()) activeItem = si; items.prepend(si); } - StackItem* si = new StackItem(this, 0, top); + StackItem* si = new StackItem(this, nullptr, top); if (si->function() == item->function()) activeItem = si; items.prepend(si); diff --git a/libviews/tabview.h b/libviews/tabview.h --- a/libviews/tabview.h +++ b/libviews/tabview.h @@ -51,7 +51,7 @@ public: TabBar(TabView*, QTabWidget* parent); protected: - void mousePressEvent(QMouseEvent *e); + void mousePressEvent(QMouseEvent *e) override; private: void context(QWidget*, const QPoint &); @@ -72,11 +72,11 @@ Q_OBJECT public: - explicit Splitter(Qt::Orientation o, QWidget* parent = 0); + explicit Splitter(Qt::Orientation o, QWidget* parent = nullptr); void checkVisiblity(); protected: - void moveEvent(QMoveEvent *); + void moveEvent(QMoveEvent *) override; }; @@ -92,19 +92,19 @@ public: - explicit TabWidget(TabView*, QWidget* parent = 0); + explicit TabWidget(TabView*, QWidget* parent = nullptr); bool hasVisibleRect() { return _hasVisibleRect; } void checkVisibility(); signals: void visibleRectChanged(TabWidget*); protected: - void resizeEvent(QResizeEvent *); - void showEvent(QShowEvent *); - void hideEvent(QHideEvent *); - void moveEvent(QMoveEvent *); + void resizeEvent(QResizeEvent *) override; + void showEvent(QShowEvent *) override; + void hideEvent(QHideEvent *) override; + void moveEvent(QMoveEvent *) override; private: bool _hasVisibleRect; @@ -119,13 +119,13 @@ public: explicit TabView( TraceItemView* parentView, - QWidget* parent = 0 ); + QWidget* parent = nullptr ); - virtual QWidget* widget() { return this; } - QString whatsThis() const; - void setData(TraceData*); - bool isViewVisible() { return !_isCollapsed; } - void selected(TraceItemView*, CostItem*); + QWidget* widget() override { return this; } + QString whatsThis() const override; + void setData(TraceData*) override; + bool isViewVisible() override { return !_isCollapsed; } + void selected(TraceItemView*, CostItem*) override; bool active() const { return _active; } void setActive(bool); @@ -139,10 +139,10 @@ int visibleTabs(); int visibleAreas(); - void saveLayout(const QString& prefix, const QString& postfix); - void restoreLayout(const QString& prefix, const QString& postfix); - void saveOptions(const QString& prefix, const QString& postfix); - void restoreOptions(const QString& prefix, const QString& postfix); + void saveLayout(const QString& prefix, const QString& postfix) override; + void restoreLayout(const QString& prefix, const QString& postfix) override; + void saveOptions(const QString& prefix, const QString& postfix) override; + void restoreOptions(const QString& prefix, const QString& postfix) override; public slots: void tabChanged(int); @@ -152,17 +152,17 @@ void tabActivated(TabView*); protected: - void resizeEvent(QResizeEvent *); - bool eventFilter(QObject*, QEvent*); - void mousePressEvent(QMouseEvent*); + void resizeEvent(QResizeEvent *) override; + bool eventFilter(QObject*, QEvent*) override; + void mousePressEvent(QMouseEvent*) override; private: TraceItemView* addTab(const QString&, TraceItemView*); void addTop(TraceItemView*); void addBottom(TraceItemView*); TabWidget* tabWidget(Position); void updateVisibility(); - void doUpdate(int, bool); + void doUpdate(int, bool) override; void updateNameLabel(const QString &n = QString()); void installFocusFilters(); void tabCounts(int&, int&, int&, int&); diff --git a/libviews/tabview.cpp b/libviews/tabview.cpp --- a/libviews/tabview.cpp +++ b/libviews/tabview.cpp @@ -78,7 +78,7 @@ { if (e->button() == Qt::RightButton) { int idx = tabAt(e->pos()); - QWidget* page = 0; + QWidget* page = nullptr; if (idx >=0) { setCurrentIndex(idx); page = _tabWidget->widget(idx); @@ -92,20 +92,20 @@ { QMenu popup, popup2, popup3; - QAction* pageToTopAction = 0; - QAction* areaToTopAction = 0; - QAction* showOnTopAction = 0; - QAction* pageToRightAction = 0; - QAction* areaToRightAction = 0; - QAction* showOnRightAction = 0; - QAction* pageToBottomAction = 0; - QAction* areaToBottomAction = 0; - QAction* showOnBottomAction = 0; - QAction* pageToLeftAction = 0; - QAction* areaToLeftAction = 0; - QAction* showOnLeftAction = 0; - QAction* hidePageAction = 0; - QAction* hideAreaAction = 0; + QAction* pageToTopAction = nullptr; + QAction* areaToTopAction = nullptr; + QAction* showOnTopAction = nullptr; + QAction* pageToRightAction = nullptr; + QAction* areaToRightAction = nullptr; + QAction* showOnRightAction = nullptr; + QAction* pageToBottomAction = nullptr; + QAction* areaToBottomAction = nullptr; + QAction* showOnBottomAction = nullptr; + QAction* pageToLeftAction = nullptr; + QAction* areaToLeftAction = nullptr; + QAction* showOnLeftAction = nullptr; + QAction* hidePageAction = nullptr; + QAction* hideAreaAction = nullptr; if (page) { TraceItemView::Position p = _tabView->tabPosition(page); @@ -170,13 +170,13 @@ _tabView->moveTab(page, TraceItemView::Left, true); else if (a == showOnTopAction) - _tabView->moveTab(0, TraceItemView::Top, true); + _tabView->moveTab(nullptr, TraceItemView::Top, true); else if (a == showOnRightAction) - _tabView->moveTab(0, TraceItemView::Right, true); + _tabView->moveTab(nullptr, TraceItemView::Right, true); else if (a == showOnBottomAction) - _tabView->moveTab(0, TraceItemView::Bottom, true); + _tabView->moveTab(nullptr, TraceItemView::Bottom, true); else if (a == showOnLeftAction) - _tabView->moveTab(0, TraceItemView::Left, true); + _tabView->moveTab(nullptr, TraceItemView::Left, true); } @@ -378,28 +378,28 @@ // Keep following order in sync with DEFAULT_xxxTABS defines! addTop( addTab( tr("Types"), - new EventTypeView(this, 0, + new EventTypeView(this, nullptr, "EventTypeView"))); addTop( addTab( tr("Callers"), callerView) ); addTop( addTab( tr("All Callers"), allCallerView) ); addTop( addTab( tr("Callee Map"), - new CallMapView(false, this, 0, + new CallMapView(false, this, nullptr, "CalleeMapView"))); addTop( addTab( tr("Source Code"), sourceView) ); addBottom( addTab( tr("Parts"), partView ) ); addBottom( addTab( tr("Callees"), calleeView) ); addBottom( addTab( tr("Call Graph"), - new CallGraphView(this, 0, + new CallGraphView(this, nullptr, "CallGraphView"))); addBottom( addTab( tr("All Callees"), allCalleeView) ); addBottom( addTab( tr("Caller Map"), - new CallMapView(true, this, 0, + new CallMapView(true, this, nullptr, "CallerMapView"))); addBottom( addTab( tr("Machine Code"), instrView) ); // after all child widgets are created... - _lastFocus = 0; + _lastFocus = nullptr; _active = false; installFocusFilters(); @@ -593,14 +593,14 @@ default: break; } - return 0; + return nullptr; } void TabView::moveTab(QWidget* w, Position p, bool wholeArea) { Position origPos = Hidden; if (w) { - TraceItemView* found = 0; + TraceItemView* found = nullptr; foreach(TraceItemView* v, _tabs) if (v->widget() == w) { found = v; break; } @@ -627,7 +627,7 @@ isEnabled = from->isTabEnabled(from->indexOf(w)); from->removeTab(from->indexOf(w)); } - else isEnabled = (v->canShow(_activeItem)!=0); + else isEnabled = (v->canShow(_activeItem)!=nullptr); if (to) { int idx = -1, i; @@ -691,8 +691,8 @@ bool TabView::eventFilter(QObject* o, QEvent* e) { if (e->type() == QEvent::FocusIn) { - _lastFocus = o->isWidgetType() ? (QWidget*) o : 0; - setActive(_lastFocus != 0); + _lastFocus = o->isWidgetType() ? (QWidget*) o : nullptr; + setActive(_lastFocus != nullptr); } return QWidget::eventFilter(o,e); } @@ -742,7 +742,7 @@ bool canShow; foreach(TraceItemView *v, _tabs) { - TabWidget *tw = 0; + TabWidget *tw = nullptr; switch(v->position()) { case TraceItemView::Top: tw = _topTW; break; case TraceItemView::Bottom: tw = _bottomTW; break; @@ -861,10 +861,10 @@ bottomTabs = bottomTabsDefault; } - TraceItemView *activeTop = 0, *activeBottom = 0; - TraceItemView *activeLeft = 0, *activeRight = 0; + TraceItemView *activeTop = nullptr, *activeBottom = nullptr; + TraceItemView *activeLeft = nullptr, *activeRight = nullptr; - moveTab(0, TraceItemView::Top, true); + moveTab(nullptr, TraceItemView::Top, true); foreach(TraceItemView *v, _tabs) { QString n = v->widget()->objectName(); if (topTabs.contains(n)) { diff --git a/libviews/traceitemview.h b/libviews/traceitemview.h --- a/libviews/traceitemview.h +++ b/libviews/traceitemview.h @@ -92,7 +92,7 @@ // a TraceItemView can have a position in a parent container enum Position { Hidden, Top, Right, Left, Bottom }; - explicit TraceItemView(TraceItemView* parentView, TopLevelBase* top = 0); + explicit TraceItemView(TraceItemView* parentView, TopLevelBase* top = nullptr); virtual ~TraceItemView(); virtual QString whatsThis() const; diff --git a/libviews/traceitemview.cpp b/libviews/traceitemview.cpp --- a/libviews/traceitemview.cpp +++ b/libviews/traceitemview.cpp @@ -51,12 +51,12 @@ _parentView = parentView; _topLevel = top ? top : parentView->topLevel(); - _data = _newData = 0; + _data = _newData = nullptr; // _partList and _newPartList is empty - _activeItem = _newActiveItem = 0; - _selectedItem = _newSelectedItem = 0; - _eventType = _newEventType = 0; - _eventType2 = _newEventType2 = 0; + _activeItem = _newActiveItem = nullptr; + _selectedItem = _newSelectedItem = nullptr; + _eventType = _newEventType = nullptr; + _eventType2 = _newEventType2 = nullptr; _groupType = _newGroupType = ProfileContext::InvalidType; _status = nothingChanged; @@ -113,16 +113,16 @@ _newActiveItem = canShow(i); if (_activeItem != _newActiveItem) { // new item activated, start with empty selection - _newSelectedItem = 0; + _newSelectedItem = nullptr; updateView(); } - return (_newActiveItem != 0); + return (_newActiveItem != nullptr); } TraceFunction* TraceItemView::activeFunction() { - if (!_activeItem) return 0; + if (!_activeItem) return nullptr; ProfileContext::Type t = _activeItem->type(); switch(t) { @@ -132,7 +132,7 @@ default: break; } - return 0; + return nullptr; } bool TraceItemView::set(int changeType, TraceData* d, @@ -150,11 +150,11 @@ _newActiveItem = canShow(a); if (_activeItem != _newActiveItem) { // new item activated, start with empty selection - _newSelectedItem = 0; + _newSelectedItem = nullptr; } updateView(); - return (_newActiveItem != 0); + return (_newActiveItem != nullptr); } @@ -172,10 +172,10 @@ _newData = d; // invalidate all pointers to old data - _activeItem = _newActiveItem = 0; - _selectedItem = _newSelectedItem = 0; - _eventType = _newEventType = 0; - _eventType2 = _newEventType2 = 0; + _activeItem = _newActiveItem = nullptr; + _selectedItem = _newSelectedItem = nullptr; + _eventType = _newEventType = nullptr; + _eventType2 = _newEventType2 = nullptr; _groupType = _newGroupType = ProfileContext::InvalidType; _partList.clear(); _newPartList.clear(); @@ -236,7 +236,7 @@ if (_newActiveItem != _activeItem) { // when setting a new active item, there is no selection - _selectedItem = 0; + _selectedItem = nullptr; _status |= activeItemChanged; _activeItem = _newActiveItem; diff --git a/libviews/treemap.h b/libviews/treemap.h --- a/libviews/treemap.h +++ b/libviews/treemap.h @@ -104,20 +104,20 @@ bool selected = false, bool current = false); // getters - QString text(int) const; - QPixmap pixmap(int) const; - Position position(int) const; - int maxLines(int) const; - int fieldCount() const { return _field.size(); } + QString text(int) const override; + QPixmap pixmap(int) const override; + Position position(int) const override; + int maxLines(int) const override; + int fieldCount() const override { return _field.size(); } - QColor backColor() const { return _backColor; } - bool selected() const { return _selected; } - bool current() const { return _current; } - bool shaded() const { return _shaded; } - bool rotated() const { return _rotated; } - bool drawFrame() const { return _drawFrame; } + QColor backColor() const override { return _backColor; } + bool selected() const override { return _selected; } + bool current() const override { return _current; } + bool shaded() const override { return _shaded; } + bool rotated() const override { return _rotated; } + bool drawFrame() const override { return _drawFrame; } - const QFont& font() const; + const QFont& font() const override; // attribute setters void setField(int f, const QString& t, const QPixmap& pm = QPixmap(), @@ -177,18 +177,18 @@ void setDrawParams(DrawParams*); // draw on a given QPainter, use this class as info provider per default - void drawBack(QPainter*, DrawParams* dp = 0); + void drawBack(QPainter*, DrawParams* dp = nullptr); /* Draw field at position() from pixmap()/text() with maxLines(). * Returns true if something was drawn */ - bool drawField(QPainter*, int f, DrawParams* dp = 0); + bool drawField(QPainter*, int f, DrawParams* dp = nullptr); // resets rectangle for free space void setRect(const QRect&); // Returns the rectangle area still free of text/pixmaps after // a number of drawText() calls. - QRect remainingRect(DrawParams* dp = 0); + QRect remainingRect(DrawParams* dp = nullptr); private: int _usedTopLeft, _usedTopCenter, _usedTopRight; @@ -241,11 +241,11 @@ HAlternate, VAlternate, Horizontal, Vertical }; - explicit TreeMapItem(TreeMapItem* parent = 0, double value = 1.0 ); + explicit TreeMapItem(TreeMapItem* parent = nullptr, double value = 1.0 ); TreeMapItem(TreeMapItem* parent, double value, const QString& text1, const QString& text2 = QString(), const QString& text3 = QString(), const QString& text4 = QString()); - virtual ~TreeMapItem(); + ~TreeMapItem() override; bool isChildOf(TreeMapItem*); @@ -326,8 +326,8 @@ virtual double sum() const; virtual double value() const; // replace "Default" position with setting from TreeMapWidget - virtual Position position(int) const; - virtual const QFont& font() const; + Position position(int) const override; + const QFont& font() const override; virtual bool isMarked(int) const; virtual int borderWidth() const; @@ -405,8 +405,8 @@ enum SelectionMode { Single, Multi, Extended, NoSelection }; /* The widget gets owner of the base item */ - explicit TreeMapWidget(TreeMapItem* base, QWidget* parent=0); - ~TreeMapWidget(); + explicit TreeMapWidget(TreeMapItem* base, QWidget* parent=nullptr); + ~TreeMapWidget() override; /** * Returns the TreeMapItem filling out the widget space @@ -460,7 +460,7 @@ * parent. When parent == 0, clears whole selection * Returns true if selection changed. */ - bool clearSelection(TreeMapItem* parent = 0); + bool clearSelection(TreeMapItem* parent = nullptr); /** * Selects or unselects items in a range. @@ -664,15 +664,15 @@ void contextMenuRequested(TreeMapItem*, const QPoint &); protected: - void mousePressEvent( QMouseEvent * ); - void contextMenuEvent( QContextMenuEvent * ); - void mouseReleaseEvent( QMouseEvent * ); - void mouseMoveEvent( QMouseEvent * ); - void mouseDoubleClickEvent( QMouseEvent * ); - void keyPressEvent( QKeyEvent* ); - void paintEvent( QPaintEvent * ); + void mousePressEvent( QMouseEvent * ) override; + void contextMenuEvent( QContextMenuEvent * ) override; + void mouseReleaseEvent( QMouseEvent * ) override; + void mouseMoveEvent( QMouseEvent * ) override; + void mouseDoubleClickEvent( QMouseEvent * ) override; + void keyPressEvent( QKeyEvent* ) override; + void paintEvent( QPaintEvent * ) override; void fontChange( const QFont& ); - bool event(QEvent *event); + bool event(QEvent *event) override; private: TreeMapItemList diff(TreeMapItemList&, TreeMapItemList&); diff --git a/libviews/treemap.cpp b/libviews/treemap.cpp --- a/libviews/treemap.cpp +++ b/libviews/treemap.cpp @@ -110,7 +110,7 @@ const QFont& StoredDrawParams::font() const { - static QFont* f = 0; + static QFont* f = nullptr; if (!f) f = new QFont(QApplication::font()); return *f; @@ -184,8 +184,8 @@ RectDrawing::RectDrawing(const QRect& r) { - _fm = 0; - _dp = 0; + _fm = nullptr; + _dp = nullptr; setRect(r); } @@ -503,7 +503,7 @@ bool isBottom = false; bool isCenter = false; bool isRight = false; - int* used = 0; + int* used = nullptr; switch(pos) { case DrawParams::TopLeft: used = &_usedTopLeft; @@ -809,7 +809,7 @@ TreeMapItem* TreeMapItemList::commonParent() { - if (isEmpty()) return 0; + if (isEmpty()) return nullptr; TreeMapItem* parent = first(); for(int i = 1; parent && isetParent(this); _children->append(i); // preserve insertion order - if (sorting(0) != -1) + if (sorting(nullptr) != -1) std::sort(_children->begin(), _children->end(), treeMapItemLessThan); } @@ -1206,10 +1206,10 @@ // _forceText will be false on resizing (per default) // start state: _selection is an empty list - _current = 0; - _oldCurrent = 0; - _pressed = 0; - _lastOver = 0; + _current = nullptr; + _oldCurrent = nullptr; + _pressed = nullptr; + _lastOver = nullptr; _needsRefresh = _base; setAttribute(Qt::WA_NoSystemBackground, true); @@ -1524,10 +1524,10 @@ _selection.removeAll(i); _tmpSelection.removeAll(i); - if (_current == i) _current = 0; - if (_oldCurrent == i) _oldCurrent = 0; - if (_pressed == i) _pressed = 0; - if (_lastOver == i) _lastOver = 0; + if (_current == i) _current = nullptr; + if (_oldCurrent == i) _oldCurrent = nullptr; + if (_pressed == i) _pressed = nullptr; + if (_lastOver == i) _lastOver = nullptr; // do not redraw a deleted item if (_needsRefresh == i) { @@ -1561,14 +1561,14 @@ TreeMapItem* TreeMapWidget::item(int x, int y) const { - if (!rect().contains(x, y)) return 0; + if (!rect().contains(x, y)) return nullptr; if (DEBUG_DRAWING) qDebug() << "item(" << x << "," << y << "):"; TreeMapItem* p = _base; TreeMapItem* i; while (1) { TreeMapItemList* list = p->children(); - i = 0; + i = nullptr; if (list) { int idx; for (idx=0; idxsize(); idx++) { @@ -1588,11 +1588,11 @@ break; } } - if (idx == list->size()) i = 0; // not contained in child + if (idx == list->size()) i = nullptr; // not contained in child } if (!i) { - static TreeMapItem* last = 0; + static TreeMapItem* last = nullptr; if (p != last) { last = p; @@ -1607,7 +1607,7 @@ } p = i; } - return 0; + return nullptr; } TreeMapItem* TreeMapWidget::possibleSelection(TreeMapItem* i) const @@ -1696,8 +1696,8 @@ */ TreeMapItem* TreeMapWidget::setTmpSelected(TreeMapItem* item, bool selected) { - if (!item) return 0; - if (_selectionMode == NoSelection) return 0; + if (!item) return nullptr; + if (_selectionMode == NoSelection) return nullptr; TreeMapItemList old = _tmpSelection; @@ -1736,7 +1736,7 @@ changed->redraw(); emit selectionChanged(); } - return (changed != 0); + return (changed != nullptr); } bool TreeMapWidget::isSelected(TreeMapItem* i) const @@ -1802,9 +1802,9 @@ TreeMapItem* i2, bool selected) { - if ((i1 == 0) && (i2 == 0)) return 0; - if ((i1 == 0) || i1->isChildOf(i2)) return setTmpSelected(i2, selected); - if ((i2 == 0) || i2->isChildOf(i1)) return setTmpSelected(i1, selected); + if ((i1 == nullptr) && (i2 == nullptr)) return nullptr; + if ((i1 == nullptr) || i1->isChildOf(i2)) return setTmpSelected(i2, selected); + if ((i2 == nullptr) || i2->isChildOf(i1)) return setTmpSelected(i1, selected); TreeMapItem* changed = setTmpSelected(i1, selected); TreeMapItem* changed2 = setTmpSelected(i2, selected); @@ -1870,7 +1870,7 @@ _inControlDrag = e->modifiers() & Qt::ControlModifier; _lastOver = _pressed; - TreeMapItem* changed = 0; + TreeMapItem* changed = nullptr; TreeMapItem* item = possibleSelection(_pressed); switch(_selectionMode) { @@ -1918,8 +1918,8 @@ emit selectionChanged(_lastOver); emit selectionChanged(); } - _pressed = 0; - _lastOver = 0; + _pressed = nullptr; + _lastOver = nullptr; emit rightButtonPressed(i, e->pos()); } } @@ -1933,12 +1933,12 @@ if (_lastOver == over) return; setCurrent(over); - if (over == 0) { - _lastOver = 0; + if (over == nullptr) { + _lastOver = nullptr; return; } - TreeMapItem* changed = 0; + TreeMapItem* changed = nullptr; TreeMapItem* item = possibleSelection(over); switch(_selectionMode) { @@ -1992,8 +1992,8 @@ emit clicked(_lastOver); } - _pressed = 0; - _lastOver = 0; + _pressed = nullptr; + _lastOver = nullptr; } @@ -2057,8 +2057,8 @@ if (changed) redraw(changed); } - _pressed = 0; - _lastOver = 0; + _pressed = nullptr; + _lastOver = nullptr; } if ((e->key() == Qt::Key_Space) || @@ -2229,7 +2229,7 @@ _fontHeight = fontMetrics().height(); drawItems(&p, _needsRefresh); - _needsRefresh = 0; + _needsRefresh = nullptr; } QPainter p(this); @@ -2536,7 +2536,7 @@ QRect firstRect = QRect(r.x(), r.y(), nextPos, r.height()); if (nextPos < _visibleWidth) { - if (item->sorting(0) == -1) { + if (item->sorting(nullptr) == -1) { // fill current rect with hash pattern drawFill(item, p, firstRect); } @@ -2555,7 +2555,7 @@ len = lenLeft; if (!drawDetails) { - if (item->sorting(0) == -1) + if (item->sorting(nullptr) == -1) drawDetails = true; else { drawFill(item, p, r, list, idx, len, goBack); @@ -2587,7 +2587,7 @@ QRect firstRect = QRect(r.x(), r.y(), r.width(), nextPos); if (nextPos < _visibleWidth) { - if (item->sorting(0) == -1) { + if (item->sorting(nullptr) == -1) { drawFill(item, p, firstRect); } else { @@ -2604,7 +2604,7 @@ len = lenLeft; if (!drawDetails) { - if (item->sorting(0) == -1) + if (item->sorting(nullptr) == -1) drawDetails = true; else { drawFill(item, p, r, list, idx, len, goBack); @@ -2716,7 +2716,7 @@ } // if no sorting, do not stop drawing - if (item->sorting(0) == -1) drawOn = true; + if (item->sorting(nullptr) == -1) drawOn = true; // second half if (drawOn) @@ -2771,7 +2771,7 @@ int nextPos = (user_sum <= 0.0) ? 0: (int)(lastPos * val / user_sum +.5); if (nextPos>lastPos) nextPos = lastPos; - if ((item->sorting(0) != -1) && (nextPos < _visibleWidth)) { + if ((item->sorting(nullptr) != -1) && (nextPos < _visibleWidth)) { drawFill(item, p, fullRect, list, idx, len, goBack); if (DEBUG_DRAWING) qDebug() << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) diff --git a/qcachegrind/colorsettings.h b/qcachegrind/colorsettings.h --- a/qcachegrind/colorsettings.h +++ b/qcachegrind/colorsettings.h @@ -36,11 +36,11 @@ public: ColorSettings(TraceData* data, QWidget* parent); - virtual ~ColorSettings(); + ~ColorSettings() override; - bool check(QString&, QString&); - void accept(); - void activate(QString s); + bool check(QString&, QString&) override; + void accept() override; + void activate(QString s) override; public slots: void resetClicked(); diff --git a/qcachegrind/colorsettings.cpp b/qcachegrind/colorsettings.cpp --- a/qcachegrind/colorsettings.cpp +++ b/qcachegrind/colorsettings.cpp @@ -100,7 +100,7 @@ connect(ui.colorButton, &QtColorButton::colorChanged, this, &ColorSettings::colorChanged); - _current = 0; + _current = nullptr; update(); } diff --git a/qcachegrind/configdialog.h b/qcachegrind/configdialog.h --- a/qcachegrind/configdialog.h +++ b/qcachegrind/configdialog.h @@ -49,7 +49,7 @@ QString currentPage(); public slots: - void accept(); + void accept() override; void listItemChanged(QString); void clearError(); diff --git a/qcachegrind/configpage.h b/qcachegrind/configpage.h --- a/qcachegrind/configpage.h +++ b/qcachegrind/configpage.h @@ -32,7 +32,7 @@ Q_OBJECT public: ConfigPage(QWidget* parent, QString title, QString longTitle = QString()); - virtual ~ConfigPage() {} + ~ConfigPage() override {} QString title() { return _title; } QString longTitle() { return _longTitle; } diff --git a/qcachegrind/generalsettings.h b/qcachegrind/generalsettings.h --- a/qcachegrind/generalsettings.h +++ b/qcachegrind/generalsettings.h @@ -31,10 +31,10 @@ Q_OBJECT public: explicit GeneralSettings(QWidget* parent); - virtual ~GeneralSettings() {} + ~GeneralSettings() override {} - bool check(QString&, QString&); - void accept(); + bool check(QString&, QString&) override; + void accept() override; private: Ui::GeneralSettings ui; diff --git a/qcachegrind/qcgconfig.h b/qcachegrind/qcgconfig.h --- a/qcachegrind/qcgconfig.h +++ b/qcachegrind/qcgconfig.h @@ -33,11 +33,11 @@ friend class QCGConfigStorage; public: - ~QCGConfigGroup(); + ~QCGConfigGroup() override; void setValue(const QString& key, const QVariant& value, - const QVariant& defaultValue = QVariant()); - QVariant value(const QString& key, const QVariant& defaultValue) const; + const QVariant& defaultValue = QVariant()) override; + QVariant value(const QString& key, const QVariant& defaultValue) const override; private: QCGConfigGroup(QSettings*, QString prefix, bool); @@ -52,11 +52,11 @@ { public: QCGConfigStorage(); - ~QCGConfigStorage(); + ~QCGConfigStorage() override; private: ConfigGroup* getGroup(const QString& group, - const QString& optSuffix); + const QString& optSuffix) override; QSettings* _settings; }; diff --git a/qcachegrind/qcgconfig.cpp b/qcachegrind/qcgconfig.cpp --- a/qcachegrind/qcgconfig.cpp +++ b/qcachegrind/qcgconfig.cpp @@ -45,7 +45,7 @@ void QCGConfigGroup::setValue(const QString& key, const QVariant& value, const QVariant& defaultValue) { - if ((_settings == 0) || _readOnly) return; + if ((_settings == nullptr) || _readOnly) return; QString fullKey = QStringLiteral("%1/%2").arg(_prefix).arg(key); if (value == defaultValue) @@ -57,7 +57,7 @@ QVariant QCGConfigGroup::value(const QString& key, const QVariant& defaultValue) const { - if (_settings == 0) return defaultValue; + if (_settings == nullptr) return defaultValue; QString fullKey = QStringLiteral("%1/%2").arg(_prefix).arg(key); return _settings->value(fullKey, defaultValue); @@ -94,5 +94,5 @@ return new QCGConfigGroup(_settings, group, true); // requested group does not exist, return only default values - return new QCGConfigGroup(0, QString(), true); + return new QCGConfigGroup(nullptr, QString(), true); } diff --git a/qcachegrind/qcgtoplevel.h b/qcachegrind/qcgtoplevel.h --- a/qcachegrind/qcgtoplevel.h +++ b/qcachegrind/qcgtoplevel.h @@ -55,7 +55,7 @@ public: QCGTopLevel(); - ~QCGTopLevel(); + ~QCGTopLevel() override; TraceData* data() { return _data; } void setData(TraceData*); @@ -65,24 +65,24 @@ void createMenu(); void createToolbar(); - void closeEvent(QCloseEvent*); + void closeEvent(QCloseEvent*) override; ProfileContext::Type groupType() { return _groupType; } EventType* eventType() { return _eventType; } EventType* eventType2() { return _eventType2; } TracePartList activeParts() { return _activeParts; } - TracePartList hiddenParts() { return _hiddenParts; } + TracePartList hiddenParts() override { return _hiddenParts; } /* convenience functions for often used context menu items */ - void addEventTypeMenu(QMenu*,bool); - void addGoMenu(QMenu*); + void addEventTypeMenu(QMenu*,bool) override; + void addGoMenu(QMenu*) override; // Logger overwrites: notifications for file loading - virtual void loadStart(const QString& filename); - virtual void loadProgress(int progress); // 0 - 100 - virtual void loadWarning(int line, const QString& msg); - virtual void loadError(int line, const QString& msg); - virtual void loadFinished(const QString& msg); // msg could be error + void loadStart(const QString& filename) override; + void loadProgress(int progress) override; // 0 - 100 + void loadWarning(int line, const QString& msg) override; + void loadError(int line, const QString& msg) override; + void loadFinished(const QString& msg) override; // msg could be error public slots: void load(); @@ -150,25 +150,25 @@ bool setGroup(QString); bool setFunction(TraceFunction*); bool setFunction(QString); - void activePartsChangedSlot(const TracePartList& list); + void activePartsChangedSlot(const TracePartList& list) override; void partsHideSelectedSlot(); void partsUnhideAllSlot(); /* These go back to mainloop first by using a timer. * So they can be called from event handlers that * are not allowed to delete list entries. */ - void setEventTypeDelayed(EventType*); - void setEventType2Delayed(EventType*); - void setGroupTypeDelayed(ProfileContext::Type); - void setGroupDelayed(TraceCostItem*); - void setTraceItemDelayed(CostItem*); + void setEventTypeDelayed(EventType*) override; + void setEventType2Delayed(EventType*) override; + void setGroupTypeDelayed(ProfileContext::Type) override; + void setGroupDelayed(TraceCostItem*) override; + void setTraceItemDelayed(CostItem*) override; void partsHideSelectedSlotDelayed(); void partsUnhideAllSlotDelayed(); void goBack(); void goForward(); void goUp(); - void setDirectionDelayed(TraceItemView::Direction); + void setDirectionDelayed(TraceItemView::Direction) override; /* SingleShot Slots (without parameters) for the delayed versions */ void setEventTypeDelayed(); @@ -180,13 +180,13 @@ void setDirectionDelayed(); // configuration has changed - void configChanged(); + void configChanged() override; //void refresh(); // progress in status bar, empty message disables progress display void showStatus(const QString& msg, int progress); - void showMessage(const QString&, int msec); + void showMessage(const QString&, int msec) override; private: void resetState(); diff --git a/qcachegrind/qcgtoplevel.cpp b/qcachegrind/qcgtoplevel.cpp --- a/qcachegrind/qcgtoplevel.cpp +++ b/qcachegrind/qcgtoplevel.cpp @@ -66,7 +66,7 @@ QDBusConnection::ExportScriptableSlots); #endif - _progressBar = 0; + _progressBar = nullptr; _statusbar = statusBar(); _statusLabel = new QLabel(_statusbar); _statusbar->addWidget(_statusLabel, 1); @@ -118,21 +118,21 @@ _activeParts.clear(); _hiddenParts.clear(); - _data = 0; - _function = 0; - _eventType = 0; - _eventType2 = 0; + _data = nullptr; + _function = nullptr; + _eventType = nullptr; + _eventType2 = nullptr; _groupType = ProfileContext::InvalidType; - _group = 0; + _group = nullptr; // for delayed slots - _traceItemDelayed = 0; - _eventTypeDelayed = 0; - _eventType2Delayed = 0; + _traceItemDelayed = nullptr; + _eventTypeDelayed = nullptr; + _eventType2Delayed = nullptr; _groupTypeDelayed = ProfileContext::InvalidType; - _groupDelayed = 0; + _groupDelayed = nullptr; _directionDelayed = TraceItemView::None; - _lastSender = 0; + _lastSender = nullptr; } @@ -916,7 +916,7 @@ { EventType* ct; - ct = (_data) ? _data->eventTypes()->type(s) : 0; + ct = (_data) ? _data->eventTypes()->type(s) : nullptr; // if costtype with given name not found, use first available if (!ct && _data) ct = _data->eventTypes()->type(0); @@ -929,24 +929,24 @@ EventType* ct; // Special type tr("(Hidden)") gives 0 - ct = (_data) ? _data->eventTypes()->type(s) : 0; + ct = (_data) ? _data->eventTypes()->type(s) : nullptr; return setEventType2(ct); } void QCGTopLevel::eventTypeSelected(const QString& s) { EventType* ct; - ct = (_data) ? _data->eventTypes()->typeForLong(s) : 0; + ct = (_data) ? _data->eventTypes()->typeForLong(s) : nullptr; setEventType(ct); } void QCGTopLevel::eventType2Selected(const QString& s) { EventType* ct; - ct = (_data) ? _data->eventTypes()->typeForLong(s) : 0; + ct = (_data) ? _data->eventTypes()->typeForLong(s) : nullptr; setEventType2(ct); } @@ -1185,9 +1185,9 @@ case TraceItemView::Up: { - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; - TraceFunction* f = hi ? hi->function() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; + TraceFunction* f = hi ? hi->function() : nullptr; if (!f) break; f = hi->stack()->caller(f, false); @@ -1245,8 +1245,8 @@ default: break; } - _traceItemDelayed = 0; - _lastSender = 0; + _traceItemDelayed = nullptr; + _lastSender = nullptr; } /** @@ -1259,15 +1259,15 @@ { if (data == _data) return; - _lastSender = 0; + _lastSender = nullptr; saveTraceSettings(); if (_data) { - _partSelection->setData(0); - _stackSelection->setData(0); - _functionSelection->setData(0); - _multiView->setData(0); + _partSelection->setData(nullptr); + _stackSelection->setData(nullptr); + _functionSelection->setData(nullptr); + _multiView->setData(nullptr); _multiView->updateView(true); // we are the owner... @@ -1344,7 +1344,7 @@ connect(m, SIGNAL(triggered(QAction*)), this, SLOT(setEventType2(QAction*)), Qt::UniqueConnection); - if (_eventType2 != 0) { + if (_eventType2 != nullptr) { action = m->addAction(tr("Hide")); action->setData(199); m->addSeparator(); @@ -1399,10 +1399,10 @@ bool QCGTopLevel::setEventType(QAction* action) { if (!_data) return false; - int id = action->data().toInt(0); + int id = action->data().toInt(nullptr); EventTypeSet* m = _data->eventTypes(); - EventType* ct=0; + EventType* ct=nullptr; if (id >=100 && id<199) ct = m->realType(id-100); if (id >=200 && id<299) ct = m->derivedType(id-200); @@ -1412,10 +1412,10 @@ bool QCGTopLevel::setEventType2(QAction* action) { if (!_data) return false; - int id = action->data().toInt(0); + int id = action->data().toInt(nullptr); EventTypeSet* m = _data->eventTypes(); - EventType* ct=0; + EventType* ct=nullptr; if (id >=100 && id<199) ct = m->realType(id-100); if (id >=200 && id<299) ct = m->derivedType(id-200); @@ -1832,8 +1832,8 @@ QMenu *popup = _forwardAction->menu(); popup->clear(); - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; TraceFunction* f; QAction* action; @@ -1869,8 +1869,8 @@ QMenu *popup = _backAction->menu(); popup->clear(); - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; TraceFunction* f; QAction* action; @@ -1906,9 +1906,9 @@ QMenu *popup = _upAction->menu(); popup->clear(); - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; - TraceFunction* f = hi ? hi->function() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; + TraceFunction* f = hi ? hi->function() : nullptr; QAction* action; if (!f) { @@ -1935,12 +1935,12 @@ void QCGTopLevel::forwardTriggered(QAction* action) { - int count = action->data().toInt(0); + int count = action->data().toInt(nullptr); //qDebug("forwardTriggered: %d", count); if( count <= 0) return; - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; if (!b) return; while (count>1) { @@ -1952,12 +1952,12 @@ void QCGTopLevel::backTriggered(QAction* action) { - int count = action->data().toInt(0); + int count = action->data().toInt(nullptr); //qDebug("backTriggered: %d", count); if( count <= 0) return; - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; if (!b) return; while (count>1) { @@ -1969,13 +1969,13 @@ void QCGTopLevel::upTriggered(QAction* action) { - int count = action->data().toInt(0); + int count = action->data().toInt(nullptr); //qDebug("upTriggered: %d", count); if( count <= 0) return; - StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0; - HistoryItem* hi = b ? b->current() : 0; + StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr; + HistoryItem* hi = b ? b->current() : nullptr; if (!hi) return; TraceFunction* f = hi->function(); @@ -2007,7 +2007,7 @@ if (_progressBar) { _statusbar->removeWidget(_progressBar); delete _progressBar; - _progressBar = 0; + _progressBar = nullptr; } _statusbar->clearMessage(); _progressMsg = msg; diff --git a/qcachegrind/qtcolorbutton.h b/qcachegrind/qtcolorbutton.h --- a/qcachegrind/qtcolorbutton.h +++ b/qcachegrind/qtcolorbutton.h @@ -44,8 +44,8 @@ Q_OBJECT Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered) public: - explicit QtColorButton(QWidget *parent = 0); - ~QtColorButton(); + explicit QtColorButton(QWidget *parent = nullptr); + ~QtColorButton() override; bool isBackgroundCheckered() const; void setBackgroundCheckered(bool checkered); @@ -59,13 +59,13 @@ signals: void colorChanged(const QColor &color); protected: - void paintEvent(QPaintEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); + void paintEvent(QPaintEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; #ifndef QT_NO_DRAGANDDROP - void dragEnterEvent(QDragEnterEvent *event); - void dragLeaveEvent(QDragLeaveEvent *event); - void dropEvent(QDropEvent *event); + void dragEnterEvent(QDragEnterEvent *event) override; + void dragLeaveEvent(QDragLeaveEvent *event) override; + void dropEvent(QDropEvent *event) override; #endif private: class QtColorButtonPrivate* d_ptr; diff --git a/qcachegrind/sourcesettings.h b/qcachegrind/sourcesettings.h --- a/qcachegrind/sourcesettings.h +++ b/qcachegrind/sourcesettings.h @@ -35,11 +35,11 @@ public: SourceSettings(TraceData* data, QWidget* parent); - virtual ~SourceSettings() {} + ~SourceSettings() override {} - bool check(QString&, QString&); - void accept(); - void activate(QString s); + bool check(QString&, QString&) override; + void accept() override; + void activate(QString s) override; public slots: void addClicked(); diff --git a/qcachegrind/sourcesettings.cpp b/qcachegrind/sourcesettings.cpp --- a/qcachegrind/sourcesettings.cpp +++ b/qcachegrind/sourcesettings.cpp @@ -96,7 +96,7 @@ connect(ui.dirEdit, SIGNAL(textChanged(QString)), this, SLOT(dirEditChanged(QString))); - _current = 0; + _current = nullptr; update(); } @@ -144,7 +144,7 @@ delete _current; // deletion can trigger a call to dirListItemChanged() ! if (_current == i) { - _current = 0; + _current = nullptr; update(); } }