comparison layer/RegionLayer.cpp @ 1408:c8a6fd3f9dff fix-static-analysis

Use nullptr throughout
author Chris Cannam
date Mon, 26 Nov 2018 14:33:54 +0000
parents c39f2d439d59
children d057dcc827e7
comparison
equal deleted inserted replaced
1407:05d614f6e46d 1408:c8a6fd3f9dff
44 #include <iostream> 44 #include <iostream>
45 #include <cmath> 45 #include <cmath>
46 46
47 RegionLayer::RegionLayer() : 47 RegionLayer::RegionLayer() :
48 SingleColourLayer(), 48 SingleColourLayer(),
49 m_model(0), 49 m_model(nullptr),
50 m_editing(false), 50 m_editing(false),
51 m_dragPointX(0), 51 m_dragPointX(0),
52 m_dragPointY(0), 52 m_dragPointY(0),
53 m_dragStartX(0), 53 m_dragStartX(0),
54 m_dragStartY(0), 54 m_dragStartY(0),
55 m_originalPoint(0, 0.0, 0, tr("New Region")), 55 m_originalPoint(0, 0.0, 0, tr("New Region")),
56 m_editingPoint(0, 0.0, 0, tr("New Region")), 56 m_editingPoint(0, 0.0, 0, tr("New Region")),
57 m_editingCommand(0), 57 m_editingCommand(nullptr),
58 m_verticalScale(EqualSpaced), 58 m_verticalScale(EqualSpaced),
59 m_colourMap(0), 59 m_colourMap(0),
60 m_colourInverted(false), 60 m_colourInverted(false),
61 m_plotStyle(PlotLines) 61 m_plotStyle(PlotLines)
62 { 62 {
1179 void 1179 void
1180 RegionLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *) 1180 RegionLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *)
1181 { 1181 {
1182 if (!m_model || !m_editing) return; 1182 if (!m_model || !m_editing) return;
1183 finish(m_editingCommand); 1183 finish(m_editingCommand);
1184 m_editingCommand = 0; 1184 m_editingCommand = nullptr;
1185 m_editing = false; 1185 m_editing = false;
1186 1186
1187 recalcSpacing(); 1187 recalcSpacing();
1188 } 1188 }
1189 1189
1194 1194
1195 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return; 1195 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return;
1196 1196
1197 if (m_editingCommand) { 1197 if (m_editingCommand) {
1198 finish(m_editingCommand); 1198 finish(m_editingCommand);
1199 m_editingCommand = 0; 1199 m_editingCommand = nullptr;
1200 } 1200 }
1201 1201
1202 m_editing = true; 1202 m_editing = true;
1203 recalcSpacing(); 1203 recalcSpacing();
1204 } 1204 }
1223 (m_model, tr("Erase Region")); 1223 (m_model, tr("Erase Region"));
1224 1224
1225 m_editingCommand->deletePoint(m_editingPoint); 1225 m_editingCommand->deletePoint(m_editingPoint);
1226 1226
1227 finish(m_editingCommand); 1227 finish(m_editingCommand);
1228 m_editingCommand = 0; 1228 m_editingCommand = nullptr;
1229 m_editing = false; 1229 m_editing = false;
1230 recalcSpacing(); 1230 recalcSpacing();
1231 } 1231 }
1232 1232
1233 void 1233 void
1244 1244
1245 m_originalPoint = m_editingPoint; 1245 m_originalPoint = m_editingPoint;
1246 1246
1247 if (m_editingCommand) { 1247 if (m_editingCommand) {
1248 finish(m_editingCommand); 1248 finish(m_editingCommand);
1249 m_editingCommand = 0; 1249 m_editingCommand = nullptr;
1250 } 1250 }
1251 1251
1252 m_editing = true; 1252 m_editing = true;
1253 m_dragStartX = e->x(); 1253 m_dragStartX = e->x();
1254 m_dragStartY = e->y(); 1254 m_dragStartY = e->y();
1311 1311
1312 m_editingCommand->setName(newName); 1312 m_editingCommand->setName(newName);
1313 finish(m_editingCommand); 1313 finish(m_editingCommand);
1314 } 1314 }
1315 1315
1316 m_editingCommand = 0; 1316 m_editingCommand = nullptr;
1317 m_editing = false; 1317 m_editing = false;
1318 recalcSpacing(); 1318 recalcSpacing();
1319 } 1319 }
1320 1320
1321 bool 1321 bool