changeset 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 089afbbe1253
children ad86aa712d11
files view/PaneStack.cpp
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/view/PaneStack.cpp	Wed Apr 24 15:42:35 2019 +0100
+++ b/view/PaneStack.cpp	Thu Apr 25 17:07:04 2019 +0100
@@ -73,8 +73,9 @@
 PaneStack::setShowAlignmentViews(bool show)
 {
     m_showAlignmentViews = show;
-    foreach (const PaneRec &r, m_panes) {
-        r.alignmentView->setVisible(m_showAlignmentViews);
+    for (int i = 0; in_range_for(m_panes, i); ++i) {
+        m_panes[i].alignmentView->setVisible(m_showAlignmentViews &&
+                                             in_range_for(m_panes, i+1));
     }
 }
 
@@ -125,8 +126,8 @@
 
     AlignmentView *av = new AlignmentView(frame);
     av->setFixedHeight(40);//!!!
-    av->setVisible(m_showAlignmentViews);
     av->setViewManager(m_viewManager);
+    av->setVisible(false); // for now
     layout->addWidget(av, 2, 1);
 
     QWidget *properties = nullptr;
@@ -197,8 +198,10 @@
         m_panes[i].alignmentView->setViewAbove(m_panes[i].pane);
         if (i + 1 < (int)m_panes.size()) {
             m_panes[i].alignmentView->setViewBelow(m_panes[i+1].pane);
+            m_panes[i].alignmentView->setVisible(true);
         } else {
             m_panes[i].alignmentView->setViewBelow(nullptr);
+            m_panes[i].alignmentView->setVisible(false);
         }
     }
 }
@@ -406,13 +409,12 @@
             showOrHidePaneAccessories();
             emit paneHidden(pane);
             emit paneHidden();
+            relinkAlignmentViews();
             return;
         }
         ++i;
     }
 
-    relinkAlignmentViews();
-
     SVCERR << "WARNING: PaneStack::hidePane(" << pane << "): Pane not found in visible panes" << endl;
 }
 
@@ -431,14 +433,13 @@
             //!!! update current pane
 
             showOrHidePaneAccessories();
+            relinkAlignmentViews();
 
             return;
         }
         ++i;
     }
 
-    relinkAlignmentViews();
-
     SVCERR << "WARNING: PaneStack::showPane(" << pane << "): Pane not found in hidden panes" << endl;
 }