-
Notifications
You must be signed in to change notification settings - Fork 122
/
IndirectDiffractionReduction.cpp
613 lines (515 loc) · 19.8 KB
/
IndirectDiffractionReduction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
//----------------------
// Includes
//----------------------
#include "MantidQtCustomInterfaces/Indirect/IndirectDiffractionReduction.h"
#include "MantidQtAPI/HelpWindow.h"
#include "MantidQtAPI/ManageUserDirectories.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/MultiFileNameParser.h"
#include <QDesktopServices>
#include <QUrl>
using namespace Mantid::API;
using namespace Mantid::Geometry;
//Add this class to the list of specialised dialogs in this namespace
namespace MantidQt
{
namespace CustomInterfaces
{
namespace // anon
{
/// static logger
Mantid::Kernel::Logger g_log("IndirectDiffractionReduction");
// Helper function for use with std::transform.
std::string toStdString(const QString & qString)
{
return qString.toStdString();
}
} // anon namespace
DECLARE_SUBWINDOW(IndirectDiffractionReduction)
using namespace Mantid::API;
using namespace MantidQt::CustomInterfaces;
using MantidQt::API::BatchAlgorithmRunner;
//----------------------
// Public member functions
//----------------------
///Constructor
IndirectDiffractionReduction::IndirectDiffractionReduction(QWidget *parent) :
UserSubWindow(parent), m_valInt(NULL), m_valDbl(NULL),
m_settingsGroup("CustomInterfaces/DEMON"),
m_batchAlgoRunner(new BatchAlgorithmRunner(parent))
{
// Handles completion of the diffraction algorithm chain
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(plotResults(bool)));
}
///Destructor
IndirectDiffractionReduction::~IndirectDiffractionReduction()
{
saveSettings();
}
/**
* Sets up UI components and Qt signal/slot connections.
*/
void IndirectDiffractionReduction::initLayout()
{
m_uiForm.setupUi(this);
connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(help()));
connect(m_uiForm.pbManageDirs, SIGNAL(clicked()), this, SLOT(openDirectoryDialog()));
connect(m_uiForm.pbRun, SIGNAL(clicked()), this, SLOT(demonRun()));
connect(m_uiForm.iicInstrumentConfiguration, SIGNAL(instrumentConfigurationUpdated(const QString &, const QString &, const QString &)),
this, SLOT(instrumentSelected(const QString &, const QString &, const QString &)));
// Update run button based on state of raw files field
connect(m_uiForm.dem_rawFiles, SIGNAL(fileTextChanged(const QString &)), this, SLOT(runFilesChanged()));
connect(m_uiForm.dem_rawFiles, SIGNAL(findingFiles()), this, SLOT(runFilesFinding()));
connect(m_uiForm.dem_rawFiles, SIGNAL(fileFindingFinished()), this, SLOT(runFilesFound()));
m_valInt = new QIntValidator(this);
m_valDbl = new QDoubleValidator(this);
m_uiForm.set_leSpecMin->setValidator(m_valInt);
m_uiForm.set_leSpecMax->setValidator(m_valInt);
m_uiForm.leRebinStart->setValidator(m_valDbl);
m_uiForm.leRebinWidth->setValidator(m_valDbl);
m_uiForm.leRebinEnd->setValidator(m_valDbl);
// Update the list of plot options when individual grouping is toggled
connect(m_uiForm.ckIndividualGrouping, SIGNAL(stateChanged(int)), this, SLOT(individualGroupingToggled(int)));
loadSettings();
// Update invalid rebinning markers
validateRebin();
// Update instrument dependant widgets
m_uiForm.iicInstrumentConfiguration->newInstrumentConfiguration();
}
/**
* Runs a diffraction reduction when the user clicks Run.
*/
void IndirectDiffractionReduction::demonRun()
{
QString instName = m_uiForm.iicInstrumentConfiguration->getInstrumentName();
QString mode = m_uiForm.iicInstrumentConfiguration->getReflectionName();
if(instName == "OSIRIS" && mode == "diffonly")
{
if(!m_uiForm.dem_rawFiles->isValid() || !validateVanCal())
{
showInformationBox("Invalid input.\nIncorrect entries marked with red star.");
return;
}
runOSIRISdiffonlyReduction();
}
else
{
if(!m_uiForm.dem_rawFiles->isValid() || !validateRebin() || !validateParFile())
{
showInformationBox("Invalid input.\nIncorrect entries marked with red star.");
return;
}
runGenericReduction(instName, mode);
}
}
/**
* Handles plotting result spectra from algorithm chains.
*
* @param error True if the chain was stopped due to error
*/
void IndirectDiffractionReduction::plotResults(bool error)
{
// Nothing can be plotted
if(error)
{
showInformationBox("Error running diffraction reduction.\nSee Results Log for details.");
return;
}
// Ungroup the output workspace if MSGDiffractionReduction was used
if(AnalysisDataService::Instance().doesExist("IndirectDiffraction_Workspaces"))
{
WorkspaceGroup_sptr diffResultsGroup = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>("IndirectDiffraction_Workspaces");
m_plotWorkspaces.clear();
m_plotWorkspaces = diffResultsGroup->getNames();
diffResultsGroup->removeAll();
AnalysisDataService::Instance().remove("IndirectDiffraction_Workspaces");
}
QString instName = m_uiForm.iicInstrumentConfiguration->getInstrumentName();
QString mode = m_uiForm.iicInstrumentConfiguration->getReflectionName();
QString plotType = m_uiForm.cbPlotType->currentText();
QString pyInput = "from mantidplot import plotSpectrum, plot2D\n";
if(plotType == "Spectra" || plotType == "Both")
{
for(auto it = m_plotWorkspaces.begin(); it != m_plotWorkspaces.end(); ++it)
pyInput += "plotSpectrum('" + QString::fromStdString(*it) + "', 0)\n";
}
if(plotType == "Contour" || plotType == "Both")
{
for(auto it = m_plotWorkspaces.begin(); it != m_plotWorkspaces.end(); ++it)
pyInput += "plot2D('" + QString::fromStdString(*it) + "')\n";
}
runPythonCode(pyInput);
}
/**
* Runs a diffraction reduction for any instrument in any mode.
*
* @param instName Name of the instrument
* @param mode Mode instrument is operating in (diffspec/diffonly)
*/
void IndirectDiffractionReduction::runGenericReduction(QString instName, QString mode)
{
// Get rebin string
QString rebinStart = m_uiForm.leRebinStart->text();
QString rebinWidth = m_uiForm.leRebinWidth->text();
QString rebinEnd = m_uiForm.leRebinEnd->text();
QString rebin = "";
if(!rebinStart.isEmpty() && !rebinWidth.isEmpty() && !rebinEnd.isEmpty())
rebin = rebinStart + "," + rebinWidth + "," + rebinEnd;
bool individualGrouping = m_uiForm.ckIndividualGrouping->isChecked();
bool useParFile = m_uiForm.ckPARFile->isChecked();
// Get detector range
std::vector<long> detRange;
detRange.push_back(m_uiForm.set_leSpecMin->text().toLong());
detRange.push_back(m_uiForm.set_leSpecMax->text().toLong());
// Get MSGDiffractionReduction algorithm instance
IAlgorithm_sptr msgDiffReduction = AlgorithmManager::Instance().create("MSGDiffractionReduction");
msgDiffReduction->initialize();
// Get save formats
std::vector<std::string> saveFormats;
if(m_uiForm.ckGSS->isChecked()) saveFormats.push_back("gss");
if(m_uiForm.ckNexus->isChecked()) saveFormats.push_back("nxs");
if(m_uiForm.ckAscii->isChecked()) saveFormats.push_back("ascii");
// Set algorithm properties
msgDiffReduction->setProperty("Instrument", instName.toStdString());
msgDiffReduction->setProperty("Mode", mode.toStdString());
msgDiffReduction->setProperty("SumFiles", m_uiForm.dem_ckSumFiles->isChecked());
msgDiffReduction->setProperty("InputFiles", m_uiForm.dem_rawFiles->getFilenames().join(",").toStdString());
msgDiffReduction->setProperty("DetectorRange", detRange);
msgDiffReduction->setProperty("RebinParam", rebin.toStdString());
msgDiffReduction->setProperty("IndividualGrouping", individualGrouping);
msgDiffReduction->setProperty("SaveFormats", saveFormats);
msgDiffReduction->setProperty("OutputWorkspace", "IndirectDiffraction_Workspaces");
if(useParFile)
msgDiffReduction->setProperty("InstrumentParFile", m_uiForm.rfPARFile->getFirstFilename().toStdString());
m_batchAlgoRunner->addAlgorithm(msgDiffReduction);
m_batchAlgoRunner->executeBatchAsync();
}
/**
* Runs a diffraction reduction for OSIRIS operating in diffonly mode using the OSIRISDiffractionReduction algorithm.
*/
void IndirectDiffractionReduction::runOSIRISdiffonlyReduction()
{
// Get the files names from MWRunFiles widget, and convert them from Qt forms into stl equivalents.
QStringList fileNames = m_uiForm.dem_rawFiles->getFilenames();
std::vector<std::string> stlFileNames;
stlFileNames.reserve(fileNames.size());
std::transform(fileNames.begin(),fileNames.end(),std::back_inserter(stlFileNames), toStdString);
// Use the file names to suggest a workspace name to use. Report to logger and stop if unable to parse correctly.
QString drangeWsName;
QString tofWsName;
try
{
QString nameBase = QString::fromStdString(Mantid::Kernel::MultiFileNameParsing::suggestWorkspaceName(stlFileNames));
tofWsName = nameBase + "_tof";
drangeWsName = nameBase + "_dRange";
}
catch(std::runtime_error & re)
{
g_log.error(re.what());
return;
}
IAlgorithm_sptr osirisDiffReduction = AlgorithmManager::Instance().create("OSIRISDiffractionReduction");
osirisDiffReduction->initialize();
osirisDiffReduction->setProperty("Sample", m_uiForm.dem_rawFiles->getFilenames().join(",").toStdString());
osirisDiffReduction->setProperty("Vanadium", m_uiForm.dem_vanadiumFile->getFilenames().join(",").toStdString());
osirisDiffReduction->setProperty("CalFile", m_uiForm.dem_calFile->getFirstFilename().toStdString());
osirisDiffReduction->setProperty("OutputWorkspace", drangeWsName.toStdString());
m_batchAlgoRunner->addAlgorithm(osirisDiffReduction);
BatchAlgorithmRunner::AlgorithmRuntimeProps inputFromReductionProps;
inputFromReductionProps["InputWorkspace"] = drangeWsName.toStdString();
IAlgorithm_sptr convertUnits = AlgorithmManager::Instance().create("ConvertUnits");
convertUnits->initialize();
convertUnits->setProperty("OutputWorkspace", tofWsName.toStdString());
convertUnits->setProperty("Target", "TOF");
m_batchAlgoRunner->addAlgorithm(convertUnits, inputFromReductionProps);
BatchAlgorithmRunner::AlgorithmRuntimeProps inputFromConvUnitsProps;
inputFromConvUnitsProps["InputWorkspace"] = tofWsName.toStdString();
if ( m_uiForm.ckGSS->isChecked() )
{
QString gssFilename = tofWsName + ".gss";
IAlgorithm_sptr saveGSS = AlgorithmManager::Instance().create("SaveGSS");
saveGSS->initialize();
saveGSS->setProperty("Filename", gssFilename.toStdString());
m_batchAlgoRunner->addAlgorithm(saveGSS, inputFromConvUnitsProps);
}
if ( m_uiForm.ckNexus->isChecked() )
{
QString nexusFilename = drangeWsName + ".nxs";
IAlgorithm_sptr saveNexus = AlgorithmManager::Instance().create("SaveNexusProcessed");
saveNexus->initialize();
saveNexus->setProperty("Filename", nexusFilename.toStdString());
m_batchAlgoRunner->addAlgorithm(saveNexus, inputFromReductionProps);
}
if ( m_uiForm.ckAscii->isChecked() )
{
QString asciiFilename = drangeWsName + ".dat";
IAlgorithm_sptr saveASCII = AlgorithmManager::Instance().create("SaveAscii");
saveASCII->initialize();
saveASCII->setProperty("Filename", asciiFilename.toStdString());
m_batchAlgoRunner->addAlgorithm(saveASCII, inputFromReductionProps);
}
m_plotWorkspaces.clear();
m_plotWorkspaces.push_back(tofWsName.toStdString());
m_plotWorkspaces.push_back(drangeWsName.toStdString());
m_batchAlgoRunner->executeBatchAsync();
}
/**
* Loads an empty instrument and returns a pointer to the workspace.
*
* Optionally loads an IPF if a reflection was provided.
*
* @param instrumentName Name of an inelastic indiretc instrument (IRIS, OSIRIN, TOSCA, VESUVIO)
* @param reflection Reflection mode to load parameters for (diffspec or diffonly)
*/
MatrixWorkspace_sptr IndirectDiffractionReduction::loadInstrument(std::string instrumentName, std::string reflection)
{
std::string idfPath = Mantid::Kernel::ConfigService::Instance().getString("instrumentDefinition.directory");
std::string parameterFilename = idfPath + instrumentName + "_Definition.xml";
IAlgorithm_sptr loadAlg = AlgorithmManager::Instance().create("LoadEmptyInstrument");
loadAlg->setChild(true);
loadAlg->initialize();
loadAlg->setProperty("Filename", parameterFilename);
loadAlg->setProperty("OutputWorkspace", "__InDiff_Inst");
loadAlg->execute();
MatrixWorkspace_sptr instWorkspace = loadAlg->getProperty("OutputWorkspace");
// Load parameter file if a reflection was given
if(!reflection.empty())
{
std::string ipfFilename = idfPath + instrumentName + "_diffraction_" + reflection + "_Parameters.xml";
IAlgorithm_sptr loadParamAlg = AlgorithmManager::Instance().create("LoadParameterFile");
loadParamAlg->setChild(true);
loadParamAlg->initialize();
loadParamAlg->setProperty("Filename", ipfFilename);
loadParamAlg->setProperty("Workspace", instWorkspace);
loadParamAlg->execute();
}
return instWorkspace;
}
/**
* Handles setting default spectra range when an instrument configuration is selected.
*
* @param instrumentName Name of selected instrument
* @param analyserName Name of selected analyser (should always be "diffraction")
* @param reflectionName Name of diffraction mode selected
*/
void IndirectDiffractionReduction::instrumentSelected(const QString & instrumentName, const QString & analyserName,
const QString & reflectionName)
{
UNUSED_ARG(analyserName);
// Set the search instrument for runs
m_uiForm.dem_rawFiles->setInstrumentOverride(instrumentName);
MatrixWorkspace_sptr instWorkspace = loadInstrument(instrumentName.toStdString(), reflectionName.toStdString());
Instrument_const_sptr instrument = instWorkspace->getInstrument();
// Get default spectra range
double specMin = instrument->getNumberParameter("spectra-min")[0];
double specMax = instrument->getNumberParameter("spectra-max")[0];
m_uiForm.set_leSpecMin->setText(QString::number(specMin));
m_uiForm.set_leSpecMax->setText(QString::number(specMax));
// Determine whether we need vanadium input
std::vector<std::string> correctionVector = instrument->getStringParameter("Workflow.Diffraction.Correction");
bool vanadiumNeeded = false;
if(correctionVector.size() > 0)
vanadiumNeeded = (correctionVector[0] == "Vanadium");
if(vanadiumNeeded)
m_uiForm.swVanadium->setCurrentIndex(0);
else
m_uiForm.swVanadium->setCurrentIndex(1);
// Hide options that the current instrument config cannot process
if(instrumentName == "OSIRIS" && reflectionName == "diffonly")
{
// Disable individual grouping
m_uiForm.ckIndividualGrouping->setToolTip("OSIRIS cannot group detectors individually in diffonly mode");
m_uiForm.ckIndividualGrouping->setEnabled(false);
m_uiForm.ckIndividualGrouping->setChecked(false);
// Disable sum files
m_uiForm.dem_ckSumFiles->setToolTip("OSIRIS cannot sum files in diffonly mode");
m_uiForm.dem_ckSumFiles->setEnabled(false);
m_uiForm.dem_ckSumFiles->setChecked(false);
}
else
{
// Re-enable sum files
m_uiForm.dem_ckSumFiles->setToolTip("");
m_uiForm.dem_ckSumFiles->setEnabled(true);
m_uiForm.dem_ckSumFiles->setChecked(true);
// Re-enable individual grouping
m_uiForm.ckIndividualGrouping->setToolTip("");
m_uiForm.ckIndividualGrouping->setEnabled(true);
}
// Update the VESUVIO PAR file option
bool isVesuvio = instrumentName == "VESUVIO";
if(!isVesuvio)
m_uiForm.ckPARFile->setChecked(false);
m_uiForm.ckPARFile->setEnabled(isVesuvio);
}
/**
* Handles opening the directory manager window.
*/
void IndirectDiffractionReduction::openDirectoryDialog()
{
MantidQt::API::ManageUserDirectories *ad = new MantidQt::API::ManageUserDirectories(this);
ad->show();
ad->setFocus();
}
/**
* Handles the user clicking the help button.
*/
void IndirectDiffractionReduction::help()
{
MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Indirect_Diffraction"));
}
void IndirectDiffractionReduction::initLocalPython()
{
}
void IndirectDiffractionReduction::loadSettings()
{
QSettings settings;
QString dataDir = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("datasearch.directories")).split(";")[0];
settings.beginGroup(m_settingsGroup);
settings.setValue("last_directory", dataDir);
m_uiForm.dem_rawFiles->readSettings(settings.group());
m_uiForm.dem_calFile->readSettings(settings.group());
m_uiForm.dem_calFile->setUserInput(settings.value("last_cal_file").toString());
m_uiForm.dem_vanadiumFile->setUserInput(settings.value("last_van_files").toString());
settings.endGroup();
}
void IndirectDiffractionReduction::saveSettings()
{
QSettings settings;
settings.beginGroup(m_settingsGroup);
settings.setValue("last_cal_file", m_uiForm.dem_calFile->getText());
settings.setValue("last_van_files", m_uiForm.dem_vanadiumFile->getText());
settings.endGroup();
}
/**
* Validates the instrument PAR file option.
*
* @returns Result of validation
*/
bool IndirectDiffractionReduction::validateParFile()
{
bool useParFile = m_uiForm.ckPARFile->isChecked();
if(useParFile)
return m_uiForm.rfPARFile->isValid();
return true;
}
/**
* Validates the rebinning fields and updates invalid markers.
*
* @returns True if reinning options are valid, flase otherwise
*/
bool IndirectDiffractionReduction::validateRebin()
{
QString rebStartTxt = m_uiForm.leRebinStart->text();
QString rebStepTxt = m_uiForm.leRebinWidth->text();
QString rebEndTxt = m_uiForm.leRebinEnd->text();
bool rebinValid = true;
// Need all or none
if(rebStartTxt.isEmpty() && rebStepTxt.isEmpty() && rebEndTxt.isEmpty())
{
rebinValid = true;
m_uiForm.valRebinStart->setText("");
m_uiForm.valRebinWidth->setText("");
m_uiForm.valRebinEnd->setText("");
}
else
{
#define CHECK_VALID(text,validator)\
if(text.isEmpty())\
{\
rebinValid = false;\
validator->setText("*");\
}\
else\
{\
rebinValid = true;\
validator->setText("");\
}
CHECK_VALID(rebStartTxt,m_uiForm.valRebinStart);
CHECK_VALID(rebStepTxt,m_uiForm.valRebinWidth);
CHECK_VALID(rebEndTxt,m_uiForm.valRebinEnd);
if(rebinValid && rebStartTxt.toDouble() >= rebEndTxt.toDouble())
{
rebinValid = false;
m_uiForm.valRebinStart->setText("*");
m_uiForm.valRebinEnd->setText("*");
}
}
return rebinValid;
}
/**
* Checks to see if the vanadium and cal file fields are valid.
*
* @returns True fo vanadium and calibration files are valid, false otherwise
*/
bool IndirectDiffractionReduction::validateVanCal()
{
if(!m_uiForm.dem_calFile->isValid())
return false;
if(!m_uiForm.dem_vanadiumFile->isValid())
return false;
return true;
}
/**
* Disables and shows message on run button indicating that run files have benn changed.
*/
void IndirectDiffractionReduction::runFilesChanged()
{
m_uiForm.pbRun->setEnabled(false);
m_uiForm.pbRun->setText("Editing...");
}
/**
* Disables and shows message on run button to indicate searching for data files.
*/
void IndirectDiffractionReduction::runFilesFinding()
{
m_uiForm.pbRun->setEnabled(false);
m_uiForm.pbRun->setText("Finding files...");
}
/**
* Updates run button with result of file search.
*/
void IndirectDiffractionReduction::runFilesFound()
{
bool valid = m_uiForm.dem_rawFiles->isValid();
m_uiForm.pbRun->setEnabled(valid);
if(valid)
m_uiForm.pbRun->setText("Run");
else
m_uiForm.pbRun->setText("Invalid Run");
// Disable sum files if only one file is given
int fileCount = m_uiForm.dem_rawFiles->getFilenames().size();
if(fileCount < 2)
m_uiForm.dem_ckSumFiles->setChecked(false);
}
/**
* Handles the user toggling the individual grouping check box.
*
* @param state The selection state of the check box
*/
void IndirectDiffractionReduction::individualGroupingToggled(int state)
{
int itemCount = m_uiForm.cbPlotType->count();
switch(state)
{
case Qt::Unchecked:
if(itemCount == 4)
{
m_uiForm.cbPlotType->removeItem(3);
m_uiForm.cbPlotType->removeItem(2);
}
break;
case Qt::Checked:
if(itemCount == 2)
{
m_uiForm.cbPlotType->insertItem(2, "Contour");
m_uiForm.cbPlotType->insertItem(3, "Both");
}
break;
default:
return;
}
}
}
}