MCPcopy Create free account
hub / github.com/KDE/labplot / enableRecalculate

Method enableRecalculate

src/frontend/dockwidgets/XYAnalysisCurveDock.cpp:182–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void XYAnalysisCurveDock::enableRecalculate() const {
183 // enable the recalculate button if all required data source columns were provided, disable otherwise
184 bool hasSourceData = false;
185 if (m_analysisCurve->dataSourceType() == XYAnalysisCurve::DataSourceType::Spreadsheet) {
186 AbstractAspect* aspectX = nullptr;
187 AbstractAspect* aspectY = nullptr;
188 AbstractAspect* aspectY2 = nullptr;
189 switch (m_requiredDataSource) {
190 case RequiredDataSource::XY: {
191 aspectX = static_cast<AbstractAspect*>(cbXDataColumn->currentModelIndex().internalPointer());
192 aspectY = static_cast<AbstractAspect*>(cbYDataColumn->currentModelIndex().internalPointer());
193 hasSourceData = (aspectX != nullptr && aspectY != nullptr);
194 break;
195 }
196 case RequiredDataSource::Y: {
197 aspectY = static_cast<AbstractAspect*>(cbYDataColumn->currentModelIndex().internalPointer());
198 hasSourceData = (aspectY != nullptr);
199 break;
200 }
201 case RequiredDataSource::YY2: {
202 aspectY = static_cast<AbstractAspect*>(cbYDataColumn->currentModelIndex().internalPointer());
203 aspectY2 = static_cast<AbstractAspect*>(cbY2DataColumn->currentModelIndex().internalPointer());
204 hasSourceData = (aspectY != nullptr && aspectY2 != nullptr);
205 break;
206 }
207 }
208
209 if (aspectX)
210 cbXDataColumn->setInvalid(false);
211
212 if (aspectY)
213 cbYDataColumn->setInvalid(false);
214
215 if (aspectY2)
216 cbY2DataColumn->setInvalid(false);
217 } else
218 hasSourceData = (m_analysisCurve->dataSourceCurve() != nullptr);
219
220 m_recalculateButton->setEnabled(hasSourceData);
221}
222
223//*************************************************************
224//***** SLOTs for changes triggered in the analyis curve ******

Callers

nothing calls this directly

Calls 3

currentModelIndexMethod · 0.80
setInvalidMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected