changeset 2479:acd2dcecc674

Add context menus to AudioDials; tidy
author Chris Cannam
date Thu, 26 Mar 2020 12:11:28 +0000
parents f08485694541
children 1a04140acf60
files main/MainWindow.cpp repoint-lock.json
diffstat 2 files changed, 4 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Mar 25 15:55:47 2020 +0000
+++ b/main/MainWindow.cpp	Thu Mar 26 12:11:28 2020 +0000
@@ -84,6 +84,7 @@
 #include "layer/ColourDatabase.h"
 #include "widgets/ModelDataTableDialog.h"
 #include "widgets/CSVExportDialog.h"
+#include "widgets/MenuTitle.h"
 #include "rdf/PluginRDFIndexer.h"
 
 #include "Surveyer.h"
@@ -5058,19 +5059,6 @@
     m_rightButtonMenu->popup(position);
 }
 
-#ifdef Q_OS_LINUX
-#define MENU_LEFT_INDENT \
-    (m_viewManager->scalePixelSize(5) + \
-     2 * qApp->style()->pixelMetric(QStyle::PM_SmallIconSize))
-#else
-#ifdef Q_OS_WIN
-#define MENU_LEFT_INDENT \
-    (9 + qApp->style()->pixelMetric(QStyle::PM_SmallIconSize))
-#else
-#define MENU_LEFT_INDENT 16
-#endif
-#endif
-
 void
 MainWindow::panePropertiesRightButtonMenuRequested(Pane *pane, QPoint position)
 {
@@ -5083,15 +5071,7 @@
     QMenu *m = new QMenu;
     IconLoader il;
 
-    QWidgetAction *wa = new QWidgetAction(m);
-    QLabel *title = new QLabel;
-    title->setText(tr("<b>Pane</b>"));
-    title->setMargin(m_viewManager->scalePixelSize(3));
-    title->setIndent(MENU_LEFT_INDENT);
-    wa->setDefaultWidget(title);
-    m->addAction(wa);
-
-    m->addSeparator();
+    MenuTitle::addTitle(m, tr("Pane"));
 
     // We repeat the setCurrentLayer call here just in case some
     // unexpected UI interaction (scripting?) changes it while the
@@ -5120,18 +5100,7 @@
     QMenu *m = new QMenu;
     IconLoader il;
 
-    QWidgetAction *wa = new QWidgetAction(m);
-    QLabel *title = new QLabel;
-    title->setText
-        (tr("<b>%2</b>")
-         .arg(XmlExportable::encodeEntities
-              (layer->getLayerPresentationName())));
-    title->setMargin(m_viewManager->scalePixelSize(3));
-    title->setIndent(MENU_LEFT_INDENT);
-    wa->setDefaultWidget(title);
-    m->addAction(wa);
-    
-    m->addSeparator();
+    MenuTitle::addTitle(m, layer->getLayerPresentationName());
 
     // We repeat the setCurrentLayer calls here just in case some
     // unexpected UI interaction (scripting?) changes it while the
--- a/repoint-lock.json	Wed Mar 25 15:55:47 2020 +0000
+++ b/repoint-lock.json	Thu Mar 26 12:11:28 2020 +0000
@@ -7,7 +7,7 @@
       "pin": "a4dce53b3353"
     },
     "svgui": {
-      "pin": "01a41a37bd26"
+      "pin": "e5464dc2f6cf"
     },
     "svapp": {
       "pin": "7b1d30af4b38"