changeset 1601:4739a1b2266f

This addAction API from Qt 5.6+ is still, unfortunately, too recent for some of our builds
author Chris Cannam
date Wed, 29 Apr 2020 14:23:51 +0100
parents 1acd7be4df9a
children a798a7b5e215
files view/Pane.cpp view/Pane.h
diffstat 2 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/view/Pane.cpp	Wed Apr 29 13:26:23 2020 +0100
+++ b/view/Pane.cpp	Wed Apr 29 14:23:51 2020 +0100
@@ -2556,11 +2556,6 @@
 void
 Pane::verticalPannerContextMenuRequested(const QPoint &pos)
 {
-    Panner *panner = qobject_cast<Panner *>(sender());
-    if (!panner) {
-        return;
-    }
-
     double vmin, vmax, dmin, dmax;
     QString unit;
     if (!getTopLayerDisplayExtents(vmin, vmax, dmin, dmax, &unit)) {
@@ -2574,20 +2569,10 @@
     MenuTitle::addTitle(m, tr("Vertical Range: %1 - %2 %3")
                         .arg(dmin).arg(dmax).arg(unit));
 
-    m->addAction(tr("&Edit..."),
-                 [=]() {
-                     editVerticalPannerExtents();
-                 });
-    m->addAction(tr("&Reset to Default"),
-                 [=]() {
-                     if (m_vthumb) {
-                         // This determines the "size" of the panner box
-                         m_vthumb->resetToDefault();
-                     }
-                     panner->resetToDefault();
-                 });
-
-    m->popup(panner->mapToGlobal(pos));
+    m->addAction(tr("&Edit..."), this, SLOT(editVerticalPannerExtents()));
+    m->addAction(tr("&Reset to Default"), this, SLOT(resetVerticalPannerExtents()));
+
+    m->popup(m_vpan->mapToGlobal(pos));
     m_lastVerticalPannerContextMenu = m;
 }
 
@@ -2618,6 +2603,16 @@
 }
 
 void
+Pane::resetVerticalPannerExtents()
+{
+    if (m_vthumb) {
+        // This determines the "size" of the panner box
+        m_vthumb->resetToDefault();
+    }
+    m_vpan->resetToDefault();
+}
+
+void
 Pane::layerParametersChanged()
 {
     View::layerParametersChanged();
--- a/view/Pane.h	Wed Apr 29 13:26:23 2020 +0100
+++ b/view/Pane.h	Wed Apr 29 14:23:51 2020 +0100
@@ -100,6 +100,7 @@
     void verticalPannerMoved(float x, float y, float w, float h);
     void verticalPannerContextMenuRequested(const QPoint &);
     void editVerticalPannerExtents();
+    void resetVerticalPannerExtents();
 
     virtual void layerParametersChanged() override;