mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-16 23:07:13 +02:00
made some changes to make clone and main window resize plot
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@3 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -1,105 +1,3 @@
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
/*
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <qgroupbox.h>
|
||||
//#include <qgridlayout.h>
|
||||
//#include <qlabel.h>
|
||||
|
||||
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
//the_layout=0;
|
||||
the_plot = new SlsQt2DPlot(this);
|
||||
|
||||
// z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2);
|
||||
// z_range_ne->setFixedWidth(402);
|
||||
|
||||
ConnectSignalsAndSlots();
|
||||
}
|
||||
|
||||
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||
|
||||
//if(the_layout) delete the_layout;
|
||||
delete the_plot;
|
||||
// delete z_range_ne;
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool)));
|
||||
connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool)));
|
||||
connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool)));
|
||||
|
||||
connect(z_range_ne,SIGNAL(CheckBoxChanged(bool)),this,SLOT(ResetRange()));
|
||||
connect(z_range_ne,SIGNAL(AValueChanged(SlsQtNumberEntry*)),this,SLOT(ResetRange()));
|
||||
|
||||
btnInterpolate->setChecked(false);
|
||||
btnContour->setChecked(false);
|
||||
btnLogz->setChecked(false);
|
||||
|
||||
}
|
||||
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
//just reset histogram range before update
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
}
|
||||
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::ResetRange(){
|
||||
//refind z limits
|
||||
the_plot->SetZMinMax();
|
||||
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
//first time check validity
|
||||
bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
|
||||
if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
|
||||
if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);
|
||||
|
||||
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0);
|
||||
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1);
|
||||
|
||||
//set histogram range
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
}
|
||||
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
|
||||
the_plot->LogZ(yes);
|
||||
ResetRange();
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetXTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetYTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
@ -112,6 +10,7 @@ void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
#include <qgroupbox.h>
|
||||
#include <qgridlayout.h>
|
||||
#include <qlabel.h>
|
||||
#include <QString>
|
||||
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
|
||||
@ -147,8 +46,6 @@ void SlsQt2DPlotLayout::Layout(){
|
||||
the_layout = new QGridLayout(this);
|
||||
the_layout->addWidget(the_plot,2,1,3,3);
|
||||
the_layout->addWidget(z_range_ne,5,1,1,3);
|
||||
|
||||
the_layout->setMargin(12);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
@ -210,3 +107,6 @@ void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetTitle(QString st){
|
||||
setTitle(st);
|
||||
}
|
||||
|
Reference in New Issue
Block a user