SelectParams::SelectParams(FilterGUI* theModule,SelectField *sel,
const char* name,
bool modal, WFlags fl)
- : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), _size(128)
+ : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), _size(1024)
{
// Allocate histogram arrays
_x = new double[_size];
_myGroupLayout->addWidget( _myFunc, row, 0 );
row++;
+ // 01) histogram size (line edit)
+ _myHSize = new QButtonGroup( tr(""), _GroupC1 );
+ _myHSize->setExclusive( true );
+ _myHSize->setColumnLayout( 0, Qt::Horizontal );
+ QGridLayout* shLay = new QGridLayout( _myHSize->layout() );
+ shLay->addWidget( _myLSH = new QLabel( tr("FILTER_SIZE_HISTO") , _myHSize ), 0, 0 );
+ shLay->addWidget( _myLESH = new QLineEdit( "1024", _myHSize ), 0, 1 );
+ _myGroupLayout->addWidget( _myHSize, row, 0 );
+ row++;
+
// 1) display histogram button (pushbutton)
_myHisto = new QPushButton( "", _GroupC1 );
_myHisto->setText(tr("FILTER_DISPLAY_HISTO"));
_myHistoSThresh = _myPlot->insertCurve( QString() );
_myPlot->setCurvePen( _myHistoSThresh, QPen( Qt::black, 1 ) );
+ connect( _myLESH, SIGNAL(returnPressed()), this, SLOT(enterSHisto()));
connect( _myHisto, SIGNAL(clicked()), this, SLOT(updateHisto()));
connect( _myLinear, SIGNAL(clicked()), this, SLOT(scaleSelected()));
connect( _myLog, SIGNAL(clicked()), this, SLOT(scaleSelected()));
this->show(); /* displays Dialog */
}
+void SelectParams::enterSHisto()
+{
+ // Deallocate old histogram arrays
+ delete _x;
+ delete _y;
+
+ // get new histogram size
+ _size = atoi(_myLESH->text());
+
+ // Allocate new histogram arrays
+ _x = new double[_size];
+ _y = new double[_size];
+}
+
void SelectParams::scaleSelected()
{
// draw linear or log Y scale depend on user
void SelectParams::displayHisto()
{
+ // associate values to curve
+ _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
// give extrema values for each axis
_myPlot->setAxisScale( _myPlot->curveXAxis( _myHistoCurve ), _xmin, _xmax );
_myPlot->setAxisScale( _myPlot->curveYAxis( _myHistoCurve ), _ymin, _ymax );
- // associate values to curve
- _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
if( _myLinear->isChecked() )
_myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::None );
else
virtual void enableWidgets();
protected slots:
+ virtual void enterSHisto();
virtual void updateHisto();
virtual void scaleSelected();
virtual void nbThreshSelected();
double *_x, *_y;
double _xft[100], _yft[100], _xst[100], _yst[100];
- QLineEdit *_myFThresh, *_myExpr, *_myLEST, *_myLEFT, *_myOFN;
- QButtonGroup *_myFunc, *_myFScale, *_myNbThresh, *_myArea, *_myVThresh, *_myOutFile;
+ QLineEdit *_myLESH, *_myFThresh, *_myExpr, *_myLEST, *_myLEFT, *_myOFN;
+ QButtonGroup *_myHSize, *_myFunc, *_myFScale, *_myNbThresh, *_myArea, *_myVThresh, *_myOutFile;
QGridLayout *_myGroupLayout, *_myGroupLayout2, *_lay, *_GroupButtonsLayout;
QRadioButton *_myCutNeg, *_myInt, *_myExt, *_myOneThresh, *_myTwoThresh, *_myFieldB, *_myLinear, *_myLog;
QPushButton *_myHisto, *_myOFB, *_myProc, * _buttonClose, * _buttonHelp;
QGroupBox* _GroupC1, *_GroupC2, *_GroupButtons;
QwtPlot *_myPlot;
- QLabel *_myLFT, *_myLST, *_myLRR;
+ QLabel *_myLSH, *_myLFT, *_myLST, *_myLRR;
QwtDiMap _qmap;
QFrame *_fr;
QString _inputFile, _inputMesh, _inputField;