mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 00:07:13 +02:00
WIP
This commit is contained in:
@ -22,10 +22,8 @@ SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
|
||||
z_range_ne = new SlsQtNumberEntry(this,1,(char*)"Set the z axis range from",2,(char*)"to",2);
|
||||
z_range_ne->setFixedWidth(402);
|
||||
#ifndef IAN
|
||||
zRangeChecked = false;
|
||||
z_range_ne->hide();
|
||||
#endif
|
||||
|
||||
CreateTheButtons();
|
||||
Layout();
|
||||
@ -43,69 +41,32 @@ SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::CreateTheButtons(){
|
||||
/** Dhanya: All these buttons are already in another class, logz is used and a wrapper around it*/
|
||||
#ifdef IAN
|
||||
btnInterpolate = new QToolButton(this);
|
||||
btnInterpolate->setText("Interpolate");
|
||||
btnInterpolate->setCheckable(true);
|
||||
btnInterpolate->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
|
||||
btnContour = new QToolButton(this);
|
||||
btnContour->setText("Contour");
|
||||
btnContour->setCheckable(true);
|
||||
btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#endif
|
||||
btnLogz = new QToolButton(this);
|
||||
btnLogz->setText("Log Scale (Z)");
|
||||
btnLogz->setCheckable(true);
|
||||
btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#ifndef IAN
|
||||
btnLogz->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::Layout(){
|
||||
if(the_layout) delete the_layout;
|
||||
the_layout = new QGridLayout(this);
|
||||
#ifdef IAN
|
||||
the_layout->addWidget(btnInterpolate,1,1);
|
||||
the_layout->addWidget(btnContour,1,2);
|
||||
the_layout->addWidget(btnLogz,1,3);
|
||||
the_layout->addWidget(the_plot,2,1,3,3);
|
||||
the_layout->addWidget(z_range_ne,5,1,1,3);
|
||||
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
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
#ifndef IAN
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool)));
|
||||
#else
|
||||
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)));
|
||||
btnInterpolate->setChecked(false);
|
||||
btnContour->setChecked(false);
|
||||
#endif
|
||||
connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange()));
|
||||
connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange()));
|
||||
btnLogz->setChecked(false);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
|
||||
#ifdef IAN
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
#endif
|
||||
//just reset histogram range before update
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
#ifdef IAN
|
||||
}
|
||||
#endif
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
@ -113,11 +74,7 @@ void SlsQt2DPlotLayout::ResetRange(){
|
||||
//refind z limits
|
||||
the_plot->SetZMinMax();
|
||||
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
#ifdef IAN
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
#else
|
||||
if(zRangeChecked){
|
||||
#endif
|
||||
//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);
|
||||
@ -175,49 +132,34 @@ void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double m
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
|
||||
#ifndef IAN
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting ZScale to log:"<<yes<<endl;
|
||||
#endif
|
||||
btnLogz->setChecked(yes);
|
||||
#endif
|
||||
the_plot->LogZ(yes);
|
||||
ResetRange();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetXTitle(QString st){
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetYTitle(QString st){
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef IAN
|
||||
void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){
|
||||
#ifdef VERBOSE
|
||||
cout<<"zmin:"<<zmin<<"\tzmax:"<<zmax<<endl;
|
||||
@ -236,4 +178,3 @@ void SlsQt2DPlotLayout::EnableZRange(bool enable){
|
||||
ResetRange();
|
||||
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user