From b026dc53ed158b51a35dbbac1f9f918eccb0ac79 Mon Sep 17 00:00:00 2001
From: Russell Taylor <taylorrj@ornl.gov>
Date: Mon, 9 Jan 2012 18:02:40 -0500
Subject: [PATCH] Make Grid and Legend work with proxy objects. Re #1037.

---
 Code/Mantid/MantidPlot/CMakeLists.txt | 1 +
 Code/Mantid/MantidPlot/src/Grid.cpp   | 2 +-
 Code/Mantid/MantidPlot/src/Grid.h     | 3 ++-
 Code/Mantid/MantidPlot/src/qti.sip    | 4 ++--
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Code/Mantid/MantidPlot/CMakeLists.txt b/Code/Mantid/MantidPlot/CMakeLists.txt
index 57390c80b5c..9d8c0757f97 100644
--- a/Code/Mantid/MantidPlot/CMakeLists.txt
+++ b/Code/Mantid/MantidPlot/CMakeLists.txt
@@ -558,6 +558,7 @@ set ( QTIPLOT_MOC_FILES src/ApplicationWindow.h
                         src/FunctionDialog.h
                         src/Graph3D.h
                         src/Graph.h
+                        src/Grid.h
                         src/ImageDialog.h
                         src/ImageExportDialog.h
                         src/ImportASCIIDialog.h
diff --git a/Code/Mantid/MantidPlot/src/Grid.cpp b/Code/Mantid/MantidPlot/src/Grid.cpp
index d690c51c13a..caf52111f1a 100644
--- a/Code/Mantid/MantidPlot/src/Grid.cpp
+++ b/Code/Mantid/MantidPlot/src/Grid.cpp
@@ -36,7 +36,7 @@
 
 #include <QPainter>
 
-Grid::Grid() : QwtPlotGrid(),
+Grid::Grid() : QObject(), QwtPlotGrid(),
 d_maj_pen_y(QPen(Qt::blue, 0.5, Qt::SolidLine)),
 d_min_pen_y(QPen(Qt::gray, 0.4, Qt::DotLine)),
 mrkX(-1),
diff --git a/Code/Mantid/MantidPlot/src/Grid.h b/Code/Mantid/MantidPlot/src/Grid.h
index 65c2a7a1c54..8e099f335ab 100644
--- a/Code/Mantid/MantidPlot/src/Grid.h
+++ b/Code/Mantid/MantidPlot/src/Grid.h
@@ -33,8 +33,9 @@
 #include <qwt_plot_grid.h>
 #include <qwt_plot_marker.h>
 
-class Grid : public QwtPlotGrid
+class Grid : public QObject, public QwtPlotGrid // Made a QObject just for our python proxies
 {
+  Q_OBJECT
 public:
     Grid();
 
diff --git a/Code/Mantid/MantidPlot/src/qti.sip b/Code/Mantid/MantidPlot/src/qti.sip
index f6e103fd45f..79d6c6a5bc8 100644
--- a/Code/Mantid/MantidPlot/src/qti.sip
+++ b/Code/Mantid/MantidPlot/src/qti.sip
@@ -481,7 +481,7 @@ private:
   ImageMarker(const ImageMarker&);
 };
 
-class LegendWidget // : QWidget /PyName=Legend/
+class LegendWidget : QObject // : QWidget /PyName=Legend/
 {
 %TypeHeaderCode
 #include "src/LegendWidget.h"
@@ -586,7 +586,7 @@ private:
 };
 
 
-class Grid // : QwtPlotGrid
+class Grid : QObject // : QwtPlotGrid
 {
 %TypeHeaderCode
 #include "src/Grid.h"
-- 
GitLab