Mercurial > hg > svgui
comparison view/PaneStack.cpp @ 1408:c8a6fd3f9dff fix-static-analysis
Use nullptr throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 14:33:54 +0000 |
parents | d79e21855aef |
children | 8e6a24110996 |
comparison
equal
deleted
inserted
replaced
1407:05d614f6e46d | 1408:c8a6fd3f9dff |
---|---|
37 | 37 |
38 //#define DEBUG_PANE_STACK 1 | 38 //#define DEBUG_PANE_STACK 1 |
39 | 39 |
40 PaneStack::PaneStack(QWidget *parent, ViewManager *viewManager) : | 40 PaneStack::PaneStack(QWidget *parent, ViewManager *viewManager) : |
41 QFrame(parent), | 41 QFrame(parent), |
42 m_currentPane(0), | 42 m_currentPane(nullptr), |
43 m_showAccessories(true), | 43 m_showAccessories(true), |
44 m_showAlignmentViews(false), | 44 m_showAlignmentViews(false), |
45 m_splitter(new QSplitter), | 45 m_splitter(new QSplitter), |
46 m_propertyStackStack(new QStackedWidget), | 46 m_propertyStackStack(new QStackedWidget), |
47 m_viewManager(viewManager), | 47 m_viewManager(viewManager), |
127 av->setFixedHeight(40);//!!! | 127 av->setFixedHeight(40);//!!! |
128 av->setVisible(m_showAlignmentViews); | 128 av->setVisible(m_showAlignmentViews); |
129 av->setViewManager(m_viewManager); | 129 av->setViewManager(m_viewManager); |
130 layout->addWidget(av, 2, 1); | 130 layout->addWidget(av, 2, 1); |
131 | 131 |
132 QWidget *properties = 0; | 132 QWidget *properties = nullptr; |
133 if (suppressPropertyBox) { | 133 if (suppressPropertyBox) { |
134 properties = new QFrame(); | 134 properties = new QFrame(); |
135 } else { | 135 } else { |
136 properties = new PropertyStack(frame, pane); | 136 properties = new PropertyStack(frame, pane); |
137 connect(properties, SIGNAL(propertyContainerSelected(View *, PropertyContainer *)), | 137 connect(properties, SIGNAL(propertyContainerSelected(View *, PropertyContainer *)), |
196 for (int i = 0; i < (int)m_panes.size(); ++i) { | 196 for (int i = 0; i < (int)m_panes.size(); ++i) { |
197 m_panes[i].alignmentView->setViewAbove(m_panes[i].pane); | 197 m_panes[i].alignmentView->setViewAbove(m_panes[i].pane); |
198 if (i + 1 < (int)m_panes.size()) { | 198 if (i + 1 < (int)m_panes.size()) { |
199 m_panes[i].alignmentView->setViewBelow(m_panes[i+1].pane); | 199 m_panes[i].alignmentView->setViewBelow(m_panes[i+1].pane); |
200 } else { | 200 } else { |
201 m_panes[i].alignmentView->setViewBelow(0); | 201 m_panes[i].alignmentView->setViewBelow(nullptr); |
202 } | 202 } |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 void | 206 void |
207 PaneStack::unlinkAlignmentViews() | 207 PaneStack::unlinkAlignmentViews() |
208 { | 208 { |
209 for (int i = 0; i < (int)m_panes.size(); ++i) { | 209 for (int i = 0; i < (int)m_panes.size(); ++i) { |
210 m_panes[i].alignmentView->setViewAbove(0); | 210 m_panes[i].alignmentView->setViewAbove(nullptr); |
211 m_panes[i].alignmentView->setViewBelow(0); | 211 m_panes[i].alignmentView->setViewBelow(nullptr); |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 void | 215 void |
216 PaneStack::setPropertyStackMinWidth(int mw) | 216 PaneStack::setPropertyStackMinWidth(int mw) |
260 PaneStack::getPane(int n) | 260 PaneStack::getPane(int n) |
261 { | 261 { |
262 if (n < (int)m_panes.size()) { | 262 if (n < (int)m_panes.size()) { |
263 return m_panes[n].pane; | 263 return m_panes[n].pane; |
264 } else { | 264 } else { |
265 return 0; | 265 return nullptr; |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 int | 269 int |
270 PaneStack::getPaneIndex(Pane *pane) | 270 PaneStack::getPaneIndex(Pane *pane) |
291 #endif | 291 #endif |
292 | 292 |
293 std::vector<PaneRec>::iterator i; | 293 std::vector<PaneRec>::iterator i; |
294 bool found = false; | 294 bool found = false; |
295 | 295 |
296 QWidget *stack = 0; | 296 QWidget *stack = nullptr; |
297 | 297 |
298 for (i = m_panes.begin(); i != m_panes.end(); ++i) { | 298 for (i = m_panes.begin(); i != m_panes.end(); ++i) { |
299 if (i->pane == pane) { | 299 if (i->pane == pane) { |
300 stack = i->propertyStack; | 300 stack = i->propertyStack; |
301 m_panes.erase(i); | 301 m_panes.erase(i); |
342 | 342 |
343 if (m_currentPane == pane) { | 343 if (m_currentPane == pane) { |
344 if (m_panes.size() > 0) { | 344 if (m_panes.size() > 0) { |
345 setCurrentPane(m_panes[0].pane); | 345 setCurrentPane(m_panes[0].pane); |
346 } else { | 346 } else { |
347 setCurrentPane(0); | 347 setCurrentPane(nullptr); |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 showOrHidePaneAccessories(); | 351 showOrHidePaneAccessories(); |
352 relinkAlignmentViews(); | 352 relinkAlignmentViews(); |
397 | 397 |
398 if (m_currentPane == pane) { | 398 if (m_currentPane == pane) { |
399 if (m_panes.size() > 0) { | 399 if (m_panes.size() > 0) { |
400 setCurrentPane(m_panes[0].pane); | 400 setCurrentPane(m_panes[0].pane); |
401 } else { | 401 } else { |
402 setCurrentPane(0); | 402 setCurrentPane(nullptr); |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 showOrHidePaneAccessories(); | 406 showOrHidePaneAccessories(); |
407 emit paneHidden(pane); | 407 emit paneHidden(pane); |
472 i->currentIndicator->setPixmap(unselectedMap); | 472 i->currentIndicator->setPixmap(unselectedMap); |
473 } | 473 } |
474 ++i; | 474 ++i; |
475 } | 475 } |
476 | 476 |
477 if (found || pane == 0) { | 477 if (found || pane == nullptr) { |
478 m_currentPane = pane; | 478 m_currentPane = pane; |
479 emit currentPaneChanged(m_currentPane); | 479 emit currentPaneChanged(m_currentPane); |
480 } else { | 480 } else { |
481 SVCERR << "WARNING: PaneStack::setCurrentPane(" << pane << "): pane is not a visible pane in this stack" << endl; | 481 SVCERR << "WARNING: PaneStack::setCurrentPane(" << pane << "): pane is not a visible pane in this stack" << endl; |
482 } | 482 } |
502 emit currentLayerChanged(pane, layer); | 502 emit currentLayerChanged(pane, layer); |
503 } else { | 503 } else { |
504 stack->setCurrentIndex | 504 stack->setCurrentIndex |
505 (stack->getContainerIndex | 505 (stack->getContainerIndex |
506 (pane->getPropertyContainer(0))); | 506 (pane->getPropertyContainer(0))); |
507 emit currentLayerChanged(pane, 0); | 507 emit currentLayerChanged(pane, nullptr); |
508 } | 508 } |
509 } | 509 } |
510 break; | 510 break; |
511 } | 511 } |
512 ++i; | 512 ++i; |
548 ++i; | 548 ++i; |
549 } | 549 } |
550 | 550 |
551 Layer *layer = dynamic_cast<Layer *>(pc); | 551 Layer *layer = dynamic_cast<Layer *>(pc); |
552 if (layer) emit currentLayerChanged(m_currentPane, layer); | 552 if (layer) emit currentLayerChanged(m_currentPane, layer); |
553 else emit currentLayerChanged(m_currentPane, 0); | 553 else emit currentLayerChanged(m_currentPane, nullptr); |
554 } | 554 } |
555 | 555 |
556 void | 556 void |
557 PaneStack::viewSelected(View *v) | 557 PaneStack::viewSelected(View *v) |
558 { | 558 { |