void QFRDRFCSCrossCorrelationEditor::rawDataChangedRecalc()
{
    QFRDRFCSData* m=qobject_cast<QFRDRFCSData*>(current);
    //qDebug()<<"rawDataChangedRecalc()  m="<<m;
    if (m) m->recalculateCorrelations();
    replotData();
    runs->setCurrent(current);
}
void SigParamThresholdDialog::posChanged()
{
    // set autoscale back (may have been unset by zoomer)
    plot->setAxisAutoScale(QwtPlot::xBottom);
    plot->setAxisAutoScale(QwtPlot::yLeft);

    replotData();
    zoomer->setZoomBase();
}
void QFFitResultsEvaluationEditorBase::resetAll() {
    if (!current) return;
    QFFitResultsEvaluation* eval=qobject_cast<QFFitResultsEvaluation*>(current);
    if (!eval) return;
    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    eval->resetAllFitResultsAllFiles();
    displayModel(false);
    replotData();
    QApplication::restoreOverrideCursor();
}
void SigParamWithDualThreshold::posChanged()
{
    // set autoscale back (may have been unset by zoomer)
    plot->setAxisAutoScale(QwtPlot::xBottom);
    plot->setAxisAutoScale(QwtPlot::yLeft);

    file.seek(curPos);
    memset(readBuf, 0, PassBytes);
    file.read((char*)readBuf, PassBytes);

    replotData();
    zoomer->setZoomBase();
}
void QFFitResultsEvaluationEditorBase::loadCurrentFitResults(QFRawDataRecord* rec) {
    if (!current) return;
    QFFitResultsEvaluation* eval=qobject_cast<QFFitResultsEvaluation*>(current);
    QFFitFunction* ffunc=eval->getFitFunction(rec);
    if (!ffunc || !eval) return;

    QString filter= tr("Fit Parameter Set (*.fps)");
    QString selectedFilter=filter;
    QString fileName = qfGetOpenFileName(this, tr("Load Fit Parameter Set ..."), m_currentFPSSaveDir, filter, &selectedFilter);
    if ((!fileName.isEmpty())&&(!fileName.isNull())) {
        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
        eval->set_doEmitPropertiesChanged(false);
        m_currentFPSSaveDir=QFileInfo(fileName).absolutePath();
        QSettings settings(fileName, QSettings::IniFormat);
        QString ffuncname=settings.value("fit_function/id", eval->getFitFunction(rec)->id()).toString();
        eval->setFitFunction(ffuncname);
        settings.beginGroup("fit_params");
        QStringList keys = settings.allKeys();
        for (int i=0; i<keys.size(); i++) {
            if (keys[i].endsWith("/error")) {
                QString paramname=keys[i].left(keys[i].length()-6);
                eval->setFitError(paramname, settings.value(keys[i]).toDouble(), rec);
            } else if (keys[i].endsWith("/value")) {
                QString paramname=keys[i].left(keys[i].length()-6);
                eval->setFitValue(paramname, settings.value(keys[i]).toDouble(), rec);
            } else if (keys[i].endsWith("/fix")) {
                QString paramname=keys[i].left(keys[i].length()-4);
                eval->setFitFix(paramname, settings.value(keys[i]).toBool(), rec);
            } else if (keys[i].endsWith("/min")) {
                QString paramname=keys[i].left(keys[i].length()-4);
                eval->setFitMin(paramname, settings.value(keys[i]).toDouble(), rec);
            } else if (keys[i].endsWith("/max")) {
                QString paramname=keys[i].left(keys[i].length()-4);
                eval->setFitMax(paramname, settings.value(keys[i]).toDouble(), rec);
            }
        }
        eval->set_doEmitPropertiesChanged(true);
        eval->emitPropertiesChanged();
        displayModel(true);
        replotData();
        QApplication::restoreOverrideCursor();
    }
}
void SigParamWithDualThreshold::thresholdLChanged(double thresholdL)
{
    curThresholdL = thresholdL;
    replotData();
}
void SigParamWithDualThreshold::thresholdHChanged(double thresholdH)
{
    curThresholdH = thresholdH;
    replotData();
}
void SigParamLowpassDialog::filtParamChanged()
{
    file.setFilter(sbTaps->value(), sbCutoff->value());
    replotData();
}
void QFRDRFCSCrossCorrelationEditor::slidersChanged(int userMin, int userMax, int /*min*/, int /*max*/) {
    if (!current) return;
    current->setQFProperty("fcscorreditor_datacut_min", userMin, false, false);
    current->setQFProperty("fcscorreditor_datacut_max", userMax, false, false);
    replotData();
}
void QFRDRFCSCrossCorrelationEditor::rawDataChanged() {
    replotData();
}
void QFRDRFCSCrossCorrelationEditor::runsModeChanged(int/* c*/) {
    if (cmbRunDisplay->currentIndex()==0) lstRunsSelect->setEnabled(false);
    else lstRunsSelect->setEnabled(true);
    replotData();
}
void QFRDRFCSCrossCorrelationEditor::selectionChanged(const QItemSelection & /*current*/, const QItemSelection & /*previous*/ ) {
    replotData();
}