MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / createCurveXYInteractive

Method createCurveXYInteractive

pj_plotting/widget/src/PlotWidget.cpp:273–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273PlotWidget::CurveInfo* PlotWidget::createCurveXYInteractive(const QString& x_key, const QString& y_key) {
274 if (catalog_ == nullptr) {
275 return nullptr;
276 }
277 const auto x_descriptor = catalog_->curveDescriptor(x_key);
278 const auto y_descriptor = catalog_->curveDescriptor(y_key);
279 if (!x_descriptor.has_value() || !y_descriptor.has_value()) {
280 return nullptr;
281 }
282
283 XYCurveDialog dialog(curveDisplayName(*x_descriptor), curveDisplayName(*y_descriptor), this);
284 while (dialog.exec() == QDialog::Accepted) {
285 const QString alias = dialog.alias();
286 if (curveFromTitle(alias) != nullptr) {
287 MessageBox::warning(
288 this, tr("Duplicate name"), tr("A curve named \"%1\" already exists in this plot.").arg(alias));
289 continue;
290 }
291 // The dialog reports whether the user swapped X and Y relative to the arguments.
292 const QString final_x = dialog.swapped() ? y_key : x_key;
293 const QString final_y = dialog.swapped() ? x_key : y_key;
294 return addCurveXY(final_x, final_y, alias);
295 }
296 return nullptr; // cancelled
297}
298
299void PlotWidget::setZoomRectangle(QRectF rect, bool emit_signal) {
300 if (isXYPlot() && keepRatioXY()) {

Callers 1

Calls 5

curveDisplayNameFunction · 0.85
trFunction · 0.85
curveDescriptorMethod · 0.80
aliasMethod · 0.80
swappedMethod · 0.80

Tested by

no test coverage detected