comparison view/PaneStack.cpp @ 1444:8e6a24110996 single-point

Avoid showing final (useless) alignment view
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 25 Apr 2019 17:07:04 +0100
parents c8a6fd3f9dff
children 1ed6d666ec9e
comparison
equal deleted inserted replaced
1443:089afbbe1253 1444:8e6a24110996
71 71
72 void 72 void
73 PaneStack::setShowAlignmentViews(bool show) 73 PaneStack::setShowAlignmentViews(bool show)
74 { 74 {
75 m_showAlignmentViews = show; 75 m_showAlignmentViews = show;
76 foreach (const PaneRec &r, m_panes) { 76 for (int i = 0; in_range_for(m_panes, i); ++i) {
77 r.alignmentView->setVisible(m_showAlignmentViews); 77 m_panes[i].alignmentView->setVisible(m_showAlignmentViews &&
78 in_range_for(m_panes, i+1));
78 } 79 }
79 } 80 }
80 81
81 Pane * 82 Pane *
82 PaneStack::addPane(bool suppressPropertyBox) 83 PaneStack::addPane(bool suppressPropertyBox)
123 layout->addWidget(pane, 0, 1, 2, 1); 124 layout->addWidget(pane, 0, 1, 2, 1);
124 layout->setColumnStretch(1, 20); 125 layout->setColumnStretch(1, 20);
125 126
126 AlignmentView *av = new AlignmentView(frame); 127 AlignmentView *av = new AlignmentView(frame);
127 av->setFixedHeight(40);//!!! 128 av->setFixedHeight(40);//!!!
128 av->setVisible(m_showAlignmentViews);
129 av->setViewManager(m_viewManager); 129 av->setViewManager(m_viewManager);
130 av->setVisible(false); // for now
130 layout->addWidget(av, 2, 1); 131 layout->addWidget(av, 2, 1);
131 132
132 QWidget *properties = nullptr; 133 QWidget *properties = nullptr;
133 if (suppressPropertyBox) { 134 if (suppressPropertyBox) {
134 properties = new QFrame(); 135 properties = new QFrame();
195 { 196 {
196 for (int i = 0; i < (int)m_panes.size(); ++i) { 197 for (int i = 0; i < (int)m_panes.size(); ++i) {
197 m_panes[i].alignmentView->setViewAbove(m_panes[i].pane); 198 m_panes[i].alignmentView->setViewAbove(m_panes[i].pane);
198 if (i + 1 < (int)m_panes.size()) { 199 if (i + 1 < (int)m_panes.size()) {
199 m_panes[i].alignmentView->setViewBelow(m_panes[i+1].pane); 200 m_panes[i].alignmentView->setViewBelow(m_panes[i+1].pane);
201 m_panes[i].alignmentView->setVisible(true);
200 } else { 202 } else {
201 m_panes[i].alignmentView->setViewBelow(nullptr); 203 m_panes[i].alignmentView->setViewBelow(nullptr);
204 m_panes[i].alignmentView->setVisible(false);
202 } 205 }
203 } 206 }
204 } 207 }
205 208
206 void 209 void
404 } 407 }
405 408
406 showOrHidePaneAccessories(); 409 showOrHidePaneAccessories();
407 emit paneHidden(pane); 410 emit paneHidden(pane);
408 emit paneHidden(); 411 emit paneHidden();
412 relinkAlignmentViews();
409 return; 413 return;
410 } 414 }
411 ++i; 415 ++i;
412 } 416 }
413
414 relinkAlignmentViews();
415 417
416 SVCERR << "WARNING: PaneStack::hidePane(" << pane << "): Pane not found in visible panes" << endl; 418 SVCERR << "WARNING: PaneStack::hidePane(" << pane << "): Pane not found in visible panes" << endl;
417 } 419 }
418 420
419 void 421 void
429 if (pw) pw->show(); 431 if (pw) pw->show();
430 432
431 //!!! update current pane 433 //!!! update current pane
432 434
433 showOrHidePaneAccessories(); 435 showOrHidePaneAccessories();
436 relinkAlignmentViews();
434 437
435 return; 438 return;
436 } 439 }
437 ++i; 440 ++i;
438 } 441 }
439
440 relinkAlignmentViews();
441 442
442 SVCERR << "WARNING: PaneStack::showPane(" << pane << "): Pane not found in hidden panes" << endl; 443 SVCERR << "WARNING: PaneStack::showPane(" << pane << "): Pane not found in hidden panes" << endl;
443 } 444 }
444 445
445 void 446 void