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

Method curveDataChanged

src/backend/worksheet/Worksheet.cpp:1327–1358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1325}
1326
1327void Worksheet::curveDataChanged(const XYCurve* curve) {
1328 auto* plot = dynamic_cast<CartesianPlot*>(QObject::sender());
1329 if (!plot || !curve)
1330 return;
1331
1332 TreeModel* treeModel = cursorModel();
1333 int rowCount = treeModel->rowCount();
1334
1335 for (int i = 0; i < rowCount; i++) {
1336 QModelIndex plotIndex = treeModel->index(i, static_cast<int>(WorksheetPrivate::TreeModelColumn::PLOTNAME));
1337 if (plotIndex.data().toString().compare(plot->name()) != 0)
1338 continue;
1339
1340 for (int j = 0; j < plot->curveCount(); j++) {
1341 if (plot->getCurve(j)->name().compare(curve->name()) != 0)
1342 continue;
1343
1344 treeModel->setTreeData(QVariant(curve->name()), j, static_cast<int>(WorksheetPrivate::TreeModelColumn::SIGNALNAME), plotIndex);
1345
1346 bool valueFound;
1347 double valueCursor0 = curve->y(plot->cursorPos(0), valueFound);
1348 treeModel->setTreeData(QVariant(valueCursor0), j, static_cast<int>(WorksheetPrivate::TreeModelColumn::CURSOR0), plotIndex);
1349
1350 double valueCursor1 = curve->y(plot->cursorPos(1), valueFound);
1351 treeModel->setTreeData(QVariant(valueCursor1), j, static_cast<int>(WorksheetPrivate::TreeModelColumn::CURSOR1), plotIndex);
1352
1353 treeModel->setTreeData(QVariant(valueCursor1 - valueCursor0), j, static_cast<int>(WorksheetPrivate::TreeModelColumn::CURSORDIFF), plotIndex);
1354 break;
1355 }
1356 break;
1357 }
1358}
1359
1360void Worksheet::curveAdded(const XYCurve* curve) {
1361 Q_D(const Worksheet);

Callers

nothing calls this directly

Calls 10

curveCountMethod · 0.80
getCurveMethod · 0.80
setTreeDataMethod · 0.80
cursorPosMethod · 0.80
rowCountMethod · 0.45
indexMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
nameMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected