Salome HOME
Qt4 porting: add axis grids to plot 2d preview.
[modules/smesh.git] / src / StdMeshersGUI / StdMeshersGUI_DistrPreview.cxx
index 96a72747ec54058351768405b116f7c07b625344..fc3787b9e5ced9b857475817e641d1e99d7d3348 100644 (file)
@@ -27,6 +27,7 @@
 // Qwt includes
 #include <qwt_plot_curve.h>
 #include <qwt_plot_marker.h>
+#include <qwt_plot_grid.h>
 #include <qwt_symbol.h>
 #include <qwt_legend.h>
 
@@ -84,6 +85,16 @@ StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::
 
   myDensity->setTitle( tr( "SMESH_DENSITY_FUNC" ) );
   myDistr->setTitle( tr( "SMESH_DISTR" ) );
+  
+  QwtPlotGrid* aGrid = new QwtPlotGrid();
+  QPen aMajPen = aGrid->majPen();
+  aMajPen.setStyle( Qt::DashLine );
+  aGrid->setPen( aMajPen );
+
+  aGrid->enableX( true );
+  aGrid->enableY( true );
+
+  aGrid->attach( this );
 }
 
 StdMeshersGUI_DistrPreview::~StdMeshersGUI_DistrPreview()
@@ -252,7 +263,7 @@ void StdMeshersGUI_DistrPreview::update()
   }
 
   setAxisScale( myDensity->xAxis(), min_x, max_x );
-  setAxisScale( myDensity->yAxis(), min( 0.0, min_y ), max( 0.0, max_y ) );
+  setAxisScale( myDensity->yAxis(), std::min( 0.0, min_y ), std::max( 0.0, max_y ) );
   myDensity->setData( x, y, size );
   if( x )
     delete[] x;