From 287a4519040c14a18a6e5208991075f602ad1f82 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 15 May 2013 12:50:11 +0000 Subject: [PATCH] optimized the plot a bit git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@180 af1100a4-978c-4157-bff7-07162d2ba061 --- .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 4 ++++ .../slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx | 7 ++++--- slsDetectorGui/src/qDrawPlot.cpp | 15 ++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index 6fbcfefc6..7942628c8 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -276,7 +276,11 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent):QwtPlot(parent){ SetupZoom(); // Assign a title +#ifndef IAN + insertLegend(new QwtLegend(), QwtPlot::BottomLegend); +#else insertLegend(new QwtLegend(), QwtPlot::RightLegend); +#endif axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating); axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating); diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx index eb722b1cd..74769e76e 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx @@ -72,11 +72,12 @@ void SlsQt2DPlotLayout::Layout(){ the_layout->addWidget(btnInterpolate,1,1); the_layout->addWidget(btnContour,1,2); the_layout->addWidget(btnLogz,1,3); -#endif the_layout->addWidget(the_plot,2,1,3,3); the_layout->addWidget(z_range_ne,5,1,1,3); -#ifdef IAN - the_layout->setMargin(12); + the_layout->setMargin(12); +#else + the_layout->addWidget(the_plot,2,0,3,3); + the_layout->addWidget(z_range_ne,5,0,1,3); #endif } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 91eed1436..a9d8715eb 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -201,7 +201,7 @@ void qDrawPlot::SetupWidgetWindow(){ histFrameIndexTitle= histFrameIndexTitle = new QLabel(""); boxPlot = new QGroupBox(""); - layout->addWidget(boxPlot,1,1); + layout->addWidget(boxPlot,1,0); boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); boxPlot->setTitle("Sample Plot"); @@ -251,8 +251,9 @@ void qDrawPlot::SetupWidgetWindow(){ boxPlot->setContentsMargins(0,15,0,0); plotLayout = new QGridLayout(boxPlot); - plotLayout->addWidget(plot1D,1,1,1,1); - plotLayout->addWidget(plot2D,1,1,1,1); + plotLayout->setContentsMargins(0,0,0,0); + plotLayout->addWidget(plot1D,0,0,1,1); + plotLayout->addWidget(plot2D,0,0,1,1); //callbacks @@ -1017,6 +1018,7 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D boxPlot->setFlat(false); plot_in_scope=1; layout->addWidget(histFrameIndexTitle,0,0); + plotLayout->setContentsMargins(10,10,10,10); }else{ plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); @@ -1027,6 +1029,7 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D plot_in_scope=2; histFrameIndexTitle->setText(""); layout->removeWidget(histFrameIndexTitle); + plotLayout->setContentsMargins(0,0,0,0); } } @@ -1194,7 +1197,8 @@ void qDrawPlot::ClonePlot(){ plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - plotLayout->addWidget(plot1D,1,1,1,1); + plotLayout->addWidget(plot1D,0,0,1,1); + plotLayout->setContentsMargins(10,10,10,10); if(running){ // update range bool found =false; @@ -1222,7 +1226,8 @@ void qDrawPlot::ClonePlot(){ plot2D->SetXTitle(imageXAxisTitle); plot2D->SetYTitle(imageYAxisTitle); plot2D->SetZTitle(imageZAxisTitle); - plotLayout->addWidget(plot2D,1,1,1,1); + plotLayout->addWidget(plot2D,0,0,1,1); + plotLayout->setContentsMargins(0,0,0,0); } UnlockLastImageArray();