void QxrdImagePlot::setColorMap(int n) { switch(n) { case 0: setGrayscale(); break; case 1: setInverseGrayscale(); break; case 2: setEarthTones(); break; case 3: setSpectrum(); break; case 4: setFire(); break; case 5: setIce(); break; } }
void FormEfficiencyCalibration::update_spectra() { QVector<SelectorItem> items; for (auto &q : spectra_->spectra(1, -1)) { Qpx::Spectrum::Metadata md; if (q != nullptr) md = q->metadata(); if (!md.detectors.empty() && (md.detectors.front().name_ == current_detector_)) { SelectorItem new_spectrum; new_spectrum.text = QString::fromStdString(md.name); new_spectrum.color = QColor::fromRgba(md.appearance); new_spectrum.visible = md.visible; items.push_back(new_spectrum); } } ui->spectrumSelector->setItems(items); setSpectrum(ui->spectrumSelector->selected().text); }
// fftcalc class is designed to treat with fft calculations FFTCalc::FFTCalc(QObject *parent) :QObject(parent){ // fftcalc is done in other thread // so it cannot overload the main thread processor.moveToThread(&processorThread); // qRegisterMetaType is used to register QVector<double> as the typename for QVector<double> // it is necessary for signal/slots events treatment. qRegisterMetaType< QVector<double> >("QVector<double>"); // when the spectrum is calculated, setSpectrum function will comunicate // such spectrum to Qt as an emitted signal connect(&processor, SIGNAL(calculatedSpectrum(QVector<double>)), SLOT(setSpectrum(QVector<double>))); // when the processor finishes the calculation, the busy condition is changed. connect(&processor, SIGNAL(allDone()),SLOT(freeCalc())); // start the processor thread with low priority processorThread.start(QThread::LowestPriority); // initially, the processor is not occupied isBusy = false; }
void FormEfficiencyCalibration::spectrumDetails(SelectorItem item) { setSpectrum(item.text); }