Changeset View
Changeset View
Standalone View
Standalone View
src/kdefrontend/dockwidgets/HistogramDock.cpp
Context not available. | |||||
395 | connect(m_curve, SIGNAL(linePenChanged(QPen)), this, SLOT(curveLinePenChanged(QPen))); | 395 | connect(m_curve, SIGNAL(linePenChanged(QPen)), this, SLOT(curveLinePenChanged(QPen))); | ||
---|---|---|---|---|---|
396 | connect(m_curve, SIGNAL(visibilityChanged(bool)), this, SLOT(curveVisibilityChanged(bool))); | 396 | connect(m_curve, SIGNAL(visibilityChanged(bool)), this, SLOT(curveVisibilityChanged(bool))); | ||
397 | 397 | | |||
398 | uiGeneralTab.pbRecalculate->setEnabled(m_curve->isSourceDataChangedSinceLastPlot()); | | |||
399 | //Slots | 398 | //Slots | ||
400 | | ||||
401 | connect(m_curve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), | 399 | connect(m_curve, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), | ||
402 | this, SLOT(curveDescriptionChanged(const AbstractAspect*))); | 400 | this, SLOT(curveDescriptionChanged(const AbstractAspect*))); | ||
403 | connect(m_curve, SIGNAL(histogramDataChanged(Histogram::HistogramData)), | 401 | connect(m_curve, SIGNAL(histogramDataChanged(Histogram::HistogramData)), | ||
Context not available. | |||||
409 | //**** SLOTs for changes triggered in HistogramDock ***** | 407 | //**** SLOTs for changes triggered in HistogramDock ***** | ||
410 | //************************************************************* | 408 | //************************************************************* | ||
411 | 409 | | |||
412 | void HistogramDock::recalculateClicked() { | | |||
413 | Histogram::HistogramData data; | | |||
414 | if( data.type != (Histogram::HistogramType)uiGeneralTab.cbHistogramType->currentIndex()) | | |||
415 | data.type = (Histogram::HistogramType)uiGeneralTab.cbHistogramType->currentIndex(); | | |||
416 | | ||||
417 | data.binsOption= (Histogram::BinsOption)uiGeneralTab.cbBins->currentIndex(); | | |||
418 | data.binValue = uiGeneralTab.sbBins->value(); | | |||
419 | // m_curve->retransform(); | | |||
420 | for (auto* curve : m_curvesList) | | |||
421 | dynamic_cast<Histogram*>(curve)->setHistogramData(data); | | |||
422 | | ||||
423 | uiGeneralTab.pbRecalculate->setEnabled(false); | | |||
424 | } | | |||
425 | | ||||
426 | void HistogramDock::enableRecalculate() const { | | |||
427 | if (m_initializing) | | |||
428 | return; | | |||
429 | uiGeneralTab.pbRecalculate->setEnabled(true); | | |||
430 | } | | |||
431 | void HistogramDock::curveLinePenChanged(const QPen& pen) { | 410 | void HistogramDock::curveLinePenChanged(const QPen& pen) { | ||
432 | m_initializing = true; | 411 | m_initializing = true; | ||
433 | uiGeneralTab.kcbLineColor->setColor( pen.color()); | 412 | uiGeneralTab.kcbLineColor->setColor( pen.color()); | ||
Context not available. | |||||
958 | uiGeneralTab.cbHistogramType->addItem(i18n("Cumulative Histogram")); | 937 | uiGeneralTab.cbHistogramType->addItem(i18n("Cumulative Histogram")); | ||
959 | uiGeneralTab.cbHistogramType->addItem(i18n("AvgShifted Histogram")); | 938 | uiGeneralTab.cbHistogramType->addItem(i18n("AvgShifted Histogram")); | ||
960 | 939 | | |||
961 | uiGeneralTab.pbRecalculate->setIcon(QIcon::fromTheme("run-build")); | 940 | // Bars types | ||
941 | uiGeneralTab.cbBarsType->addItem(i18n("Vertical")); | ||||
942 | uiGeneralTab.cbBarsType->addItem(i18n("Horizontal")); | ||||
962 | 943 | | |||
963 | //General | 944 | //General | ||
964 | connect(uiGeneralTab.leName, &QLineEdit::textChanged, this, &HistogramDock::nameChanged); | 945 | connect(uiGeneralTab.leName, &QLineEdit::textChanged, this, &HistogramDock::nameChanged); | ||
Context not available. | |||||
968 | connect( uiGeneralTab.kcbLineColor, SIGNAL(changed(QColor)), this, SLOT(lineColorChanged(QColor)) ); | 949 | connect( uiGeneralTab.kcbLineColor, SIGNAL(changed(QColor)), this, SLOT(lineColorChanged(QColor)) ); | ||
969 | connect( cbXColumn, SIGNAL(currentModelIndexChanged(QModelIndex)), this, SLOT(xColumnChanged(QModelIndex)) ); | 950 | connect( cbXColumn, SIGNAL(currentModelIndexChanged(QModelIndex)), this, SLOT(xColumnChanged(QModelIndex)) ); | ||
970 | connect( uiGeneralTab.cbHistogramType, SIGNAL(currentIndexChanged(int)), this, SLOT(histogramTypeChanged(int)) ); | 951 | connect( uiGeneralTab.cbHistogramType, SIGNAL(currentIndexChanged(int)), this, SLOT(histogramTypeChanged(int)) ); | ||
952 | connect( uiGeneralTab.cbBarsType, SIGNAL(currentIndexChanged(int)), this, SLOT(barsTypeChanged(int))); | ||||
971 | connect( uiGeneralTab.cbBins, SIGNAL(currentIndexChanged(int)), this, SLOT(binsOptionChanged(int)) ); | 953 | connect( uiGeneralTab.cbBins, SIGNAL(currentIndexChanged(int)), this, SLOT(binsOptionChanged(int)) ); | ||
972 | connect( uiGeneralTab.sbBins, SIGNAL(valueChanged(int)), this, SLOT(binValueChanged(int)) ); | 954 | connect( uiGeneralTab.sbBins, SIGNAL(valueChanged(int)), this, SLOT(binValueChanged(int)) ); | ||
973 | connect( uiGeneralTab.pbRecalculate, SIGNAL(clicked()), this, SLOT(recalculateClicked()) ); | | |||
974 | 955 | | |||
975 | } | 956 | } | ||
976 | 957 | | |||
977 | void HistogramDock::histogramTypeChanged(int index) { | 958 | void HistogramDock::histogramTypeChanged(int index) { | ||
978 | Histogram::HistogramType histogramType = Histogram::HistogramType(index); | 959 | Histogram::HistogramType histogramType = Histogram::HistogramType(index); | ||
979 | m_curve->setHistrogramType(histogramType); | 960 | m_curve->setHistogramType(histogramType); | ||
980 | enableRecalculate(); | 961 | } | ||
962 | | ||||
963 | void HistogramDock::barsTypeChanged(int index) { | ||||
964 | Histogram::BarsType barsType = Histogram::BarsType(index); | ||||
965 | m_curve->setBarsType(barsType); | ||||
981 | } | 966 | } | ||
982 | 967 | | |||
983 | void HistogramDock::binValueChanged(int value) { | 968 | void HistogramDock::binValueChanged(int value) { | ||
984 | m_curve->setBinValue(value); | 969 | m_curve->setBinValue(value); | ||
985 | enableRecalculate(); | | |||
986 | } | 970 | } | ||
987 | 971 | | |||
988 | void HistogramDock::binsOptionChanged(int index){ | 972 | void HistogramDock::binsOptionChanged(int index){ | ||
989 | Histogram::BinsOption binsOption = Histogram::BinsOption(index); | 973 | Histogram::BinsOption binsOption = Histogram::BinsOption(index); | ||
990 | m_curve->setbinsOption(binsOption); | 974 | m_curve->setbinsOption(binsOption); | ||
991 | enableRecalculate(); | | |||
992 | } | 975 | } | ||
976 | | ||||
993 | void HistogramDock::lineColorChanged(const QColor& color){ | 977 | void HistogramDock::lineColorChanged(const QColor& color){ | ||
994 | if (m_initializing) | 978 | if (m_initializing) | ||
995 | return; | 979 | return; | ||
Context not available. |