QmlProfiler: Avoid some 0 as nullptr warnings

Change-Id: I4763a22c6624eaffbb583bf26bf74a3e282b042f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Ulf Hermann
2018-04-12 10:04:55 +02:00
parent 7293e800e1
commit 7f7fe1a9db
17 changed files with 43 additions and 42 deletions

View File

@@ -71,7 +71,7 @@ FlameGraphModel::FlameGraphModel(QmlProfilerModelManager *modelManager,
void FlameGraphModel::clear()
{
beginResetModel();
m_stackBottom = FlameGraphData(0, -1, 0);
m_stackBottom = FlameGraphData(nullptr, -1, 0);
m_callStack.clear();
m_compileStack.clear();
m_callStack.append(QmlEvent());
@@ -283,7 +283,7 @@ QModelIndex FlameGraphModel::index(int row, int column, const QModelIndex &paren
FlameGraphData *parentData = static_cast<FlameGraphData *>(parent.internalPointer());
return createIndex(row, column, parentData->children[row]);
} else {
return createIndex(row, column, row >= 0 ? m_stackBottom.children[row] : 0);
return createIndex(row, column, row >= 0 ? m_stackBottom.children[row] : nullptr);
}
}

View File

@@ -38,7 +38,7 @@ namespace QmlProfiler {
namespace Internal {
struct FlameGraphData {
FlameGraphData(FlameGraphData *parent = 0, int typeIndex = -1, qint64 duration = 0);
FlameGraphData(FlameGraphData *parent = nullptr, int typeIndex = -1, qint64 duration = 0);
~FlameGraphData();
qint64 duration;
@@ -76,7 +76,7 @@ public:
MaxRole
};
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = 0);
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = nullptr);
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const override;

View File

@@ -85,7 +85,7 @@ void FlameGraphView::onVisibleFeaturesChanged(quint64 features)
void FlameGraphView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
QAction *getGlobalStatsAction = 0;
QAction *getGlobalStatsAction = nullptr;
QPoint position = ev->globalPos();

View File

@@ -103,7 +103,7 @@ QVariantMap MemoryUsageModel::details(int index) const
else
result.insert(QLatin1String("displayName"), tr("Memory Freed"));
result.insert(tr("Total"), tr("%n bytes", 0, ev->size));
result.insert(tr("Total"), tr("%n byte(s)", nullptr, ev->size));
if (ev->allocations > 0) {
result.insert(tr("Allocated"), tr("%1 bytes").arg(ev->allocated));
result.insert(tr("Allocations"), QString::number(ev->allocations));

View File

@@ -39,7 +39,7 @@ class QmlProfilerAttachDialog : public QDialog
Q_OBJECT
public:
explicit QmlProfilerAttachDialog(QWidget *parent = 0);
explicit QmlProfilerAttachDialog(QWidget *parent = nullptr);
~QmlProfilerAttachDialog();
int port() const;

View File

@@ -70,7 +70,7 @@ struct BindlingLoopsGeometry {
static const QSGGeometry::AttributeSet &point2DWithOffset();
static const int maxEventsPerNode = 0xffff / 18;
BindlingLoopsGeometry() : allocatedVertices(0), usedVertices(0), currentY(-1), node(0) {}
BindlingLoopsGeometry() : allocatedVertices(0), usedVertices(0), currentY(-1), node(nullptr) {}
uint allocatedVertices;
uint usedVertices;
float currentY;
@@ -170,7 +170,7 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
return oldState;
BindingLoopsRenderPassState *state;
if (oldState == 0)
if (oldState == nullptr)
state = new BindingLoopsRenderPassState(model);
else
state = static_cast<BindingLoopsRenderPassState *>(oldState);
@@ -327,7 +327,7 @@ void BindingLoopMaterialShader::updateState(const RenderState &state, QSGMateria
char const *const *BindingLoopMaterialShader::attributeNames() const
{
static const char *const attr[] = {"vertexCoord", "postScaleOffset", 0};
static const char *const attr[] = {"vertexCoord", "postScaleOffset", nullptr};
return attr;
}

View File

@@ -44,7 +44,7 @@ class QmlProfilerClientManager : public QmlDebug::QmlDebugConnectionManager
{
Q_OBJECT
public:
explicit QmlProfilerClientManager(QObject *parent = 0);
explicit QmlProfilerClientManager(QObject *parent = nullptr);
void setProfilerStateManager(QmlProfilerStateManager *profilerState);
void clearEvents();
void setModelManager(QmlProfilerModelManager *modelManager);

View File

@@ -41,7 +41,7 @@ class QmlProfilerConfigWidget : public QWidget
Q_OBJECT
public:
explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings, QWidget *parent = 0);
explicit QmlProfilerConfigWidget(QmlProfilerSettings *settings, QWidget *parent = nullptr);
~QmlProfilerConfigWidget();
private:

View File

@@ -37,7 +37,7 @@ class QMLPROFILER_EXPORT QmlProfilerEventsView : public QWidget
{
Q_OBJECT
public:
QmlProfilerEventsView(QWidget *parent = 0) : QWidget(parent) {}
QmlProfilerEventsView(QWidget *parent = nullptr) : QWidget(parent) {}
virtual void selectByTypeId(int typeIndex) = 0;
virtual void onVisibleFeaturesChanged(quint64 features) = 0;

View File

@@ -58,7 +58,7 @@ public:
typedef std::function<void(const QmlEvent &, const QmlEventType &)> EventLoader;
typedef std::function<void()> Finalizer;
explicit QmlProfilerModelManager(QObject *parent = 0);
explicit QmlProfilerModelManager(QObject *parent = nullptr);
~QmlProfilerModelManager();
State state() const;

View File

@@ -40,7 +40,7 @@ public:
AppDying,
};
explicit QmlProfilerStateManager(QObject *parent = 0);
explicit QmlProfilerStateManager(QObject *parent = nullptr);
~QmlProfilerStateManager();
QmlProfilerState currentState();

View File

@@ -118,7 +118,7 @@ void QmlProfilerStateWidget::updateDisplay()
// Heuristic to not show the number if the application will only send the events when it
// stops. The number is still > 0 then because we get some StartTrace etc.
uint numEvents = d->m_modelManager->numEvents();
showText(numEvents > 256 ? tr("Profiling application: %n events", 0, numEvents) :
showText(numEvents > 256 ? tr("Profiling application: %n events", nullptr, numEvents) :
tr("Profiling application"));
return;
}
@@ -135,7 +135,7 @@ void QmlProfilerStateWidget::updateDisplay()
if (d->m_profilerState->currentState() != QmlProfilerStateManager::Idle) {
if (state == QmlProfilerModelManager::AcquiringData) {
// we don't know how much more, so progress numbers are strange here
showText(tr("Loading buffered data: %n events", 0,
showText(tr("Loading buffered data: %n events", nullptr,
d->m_modelManager->numEvents()));
} else if (state == QmlProfilerModelManager::ClearingData) {
// when starting a second recording from the same process without aggregation
@@ -143,7 +143,7 @@ void QmlProfilerStateWidget::updateDisplay()
}
} else if (state == QmlProfilerModelManager::AcquiringData) {
// Application died before all data could be read
showText(tr("Loading offline data: %n events", 0,
showText(tr("Loading offline data: %n events", nullptr,
d->m_modelManager->numEvents()));
} else if (state == QmlProfilerModelManager::ClearingData) {
showText(tr("Clearing old trace"));

View File

@@ -38,7 +38,8 @@ class QmlProfilerStateWidget : public QFrame
Q_OBJECT
public:
explicit QmlProfilerStateWidget(QmlProfilerStateManager *stateManager,
QmlProfilerModelManager *modelManager, QWidget *parent = 0);
QmlProfilerModelManager *modelManager,
QWidget *parent = nullptr);
~QmlProfilerStateWidget();
private:

View File

@@ -130,10 +130,10 @@ QStringList QmlProfilerStatisticsView::details(int typeId) const
void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
QAction *copyRowAction = 0;
QAction *copyTableAction = 0;
QAction *showExtendedStatsAction = 0;
QAction *getGlobalStatsAction = 0;
QAction *copyRowAction = nullptr;
QAction *copyTableAction = nullptr;
QAction *showExtendedStatsAction = nullptr;
QAction *getGlobalStatsAction = nullptr;
QPoint position = ev->globalPos();

View File

@@ -98,31 +98,31 @@ namespace Internal {
class QmlProfilerTool::QmlProfilerToolPrivate
{
public:
QmlProfilerStateManager *m_profilerState = 0;
QmlProfilerClientManager *m_profilerConnections = 0;
QmlProfilerModelManager *m_profilerModelManager = 0;
QmlProfilerStateManager *m_profilerState = nullptr;
QmlProfilerClientManager *m_profilerConnections = nullptr;
QmlProfilerModelManager *m_profilerModelManager = nullptr;
QmlProfilerViewManager *m_viewContainer = 0;
QToolButton *m_recordButton = 0;
QMenu *m_recordFeaturesMenu = 0;
QmlProfilerViewManager *m_viewContainer = nullptr;
QToolButton *m_recordButton = nullptr;
QMenu *m_recordFeaturesMenu = nullptr;
QAction *m_startAction = 0;
QAction *m_stopAction = 0;
QToolButton *m_clearButton = 0;
QAction *m_startAction = nullptr;
QAction *m_stopAction = nullptr;
QToolButton *m_clearButton = nullptr;
// open search
QToolButton *m_searchButton = 0;
QToolButton *m_searchButton = nullptr;
// hide and show categories
QToolButton *m_displayFeaturesButton = 0;
QMenu *m_displayFeaturesMenu = 0;
QToolButton *m_displayFeaturesButton = nullptr;
QMenu *m_displayFeaturesMenu = nullptr;
// save and load actions
QAction *m_saveQmlTrace = 0;
QAction *m_loadQmlTrace = 0;
QAction *m_saveQmlTrace = nullptr;
QAction *m_loadQmlTrace = nullptr;
// elapsed time display
QLabel *m_timeLabel = 0;
QLabel *m_timeLabel = nullptr;
QTimer m_recordingTimer;
QTime m_recordingElapsedTime;
@@ -160,7 +160,7 @@ QmlProfilerTool::QmlProfilerTool()
this, &QmlProfilerTool::onLoadSaveFinished);
d->m_profilerConnections->setModelManager(d->m_profilerModelManager);
Command *command = 0;
Command *command = nullptr;
ActionContainer *menu = ActionManager::actionContainer(M_DEBUG_ANALYZER);
ActionContainer *options = ActionManager::createMenu("Analyzer.Menu.QMLOptions");

View File

@@ -266,7 +266,7 @@ void QmlProfilerTraceView::contextMenuEvent(QContextMenuEvent *ev)
void QmlProfilerTraceView::showContextMenu(QPoint position)
{
QMenu menu;
QAction *viewAllAction = 0;
QAction *viewAllAction = nullptr;
menu.addActions(QmlProfilerTool::profilerContextMenuActions());
menu.addSeparator();

View File

@@ -51,7 +51,7 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
QTC_ASSERT(m_profilerModelManager, return);
QTC_ASSERT(m_profilerState, return);
m_traceView = new QmlProfilerTraceView(0, this, m_profilerModelManager);
m_traceView = new QmlProfilerTraceView(nullptr, this, m_profilerModelManager);
connect(m_traceView, &QmlProfilerTraceView::gotoSourceLocation,
this, &QmlProfilerViewManager::gotoSourceLocation);
connect(m_traceView, &QmlProfilerTraceView::typeSelected,
@@ -96,7 +96,7 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
}
perspective->addOperation({m_statisticsView->objectName().toLatin1(), m_statisticsView,
anchorDockId, Perspective::AddToTab});
perspective->addOperation({anchorDockId, 0, {}, Perspective::Raise});
perspective->addOperation({anchorDockId, nullptr, {}, Perspective::Raise});
Debugger::registerPerspective(Constants::QmlProfilerPerspectiveId, perspective);
}