##// END OF EJS Templates
Creates graph when dropping a product in the visu
trabillard -
r1288:5bae3c800f05
parent child
Show More
@@ -89,6 +89,8 signals:
89 89 /// validated, canceled, or failed)
90 90 void acquisitionFinished();
91 91
92 void variableAdded(const std::shared_ptr<Variable> &variable);
93
92 94 public slots:
93 95 /// Request the data loading of the variable whithin range
94 96 void onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables, const SqpRange &range,
@@ -373,6 +373,8 VariableController::createVariable(const QString &name, const QVariantHash &meta
373 373 // impl->processRequest(newVariable, range, varRequestId);
374 374 // impl->updateVariableRequest(varRequestId);
375 375
376 emit variableAdded(newVariable);
377
376 378 return newVariable;
377 379 }
378 380
@@ -375,10 +375,15 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropProducts(
375 375 return;
376 376 }
377 377
378 auto context = new QObject{tabWidget};
379 connect(&sqpApp->variableController(), &VariableController::variableAdded, context,
380 [this, index, tabWidget, context](auto variable) {
381 tabWidget->createZone({variable}, index);
382 delete context; // removes the connection
383 },
384 Qt::QueuedConnection);
385
378 386 auto productData = productsMetaData.first().toHash();
379 387 QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable",
380 388 Qt::QueuedConnection, Q_ARG(QVariantHash, productData));
381
382
383 // TODO: add graph
384 389 }
@@ -516,6 +516,14 void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragW
516 516 auto products = sqpApp->dataSourceController().productsDataForMimeData(
517 517 mimeData->data(MIME_TYPE_PRODUCT_LIST));
518 518
519 auto context = new QObject{this};
520 connect(&sqpApp->variableController(), &VariableController::variableAdded, context,
521 [this, graphWidget, context](auto variable) {
522 graphWidget->addVariable(variable, graphWidget->graphRange());
523 delete context; // removes the connection
524 },
525 Qt::QueuedConnection);
526
519 527 auto productData = products.first().toHash();
520 528 QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable",
521 529 Qt::QueuedConnection, Q_ARG(QVariantHash, productData));
@@ -630,10 +638,15 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropProducts(
630 638 return;
631 639 }
632 640
641 auto context = new QObject{zoneWidget};
642 connect(&sqpApp->variableController(), &VariableController::variableAdded, context,
643 [this, index, zoneWidget, context](auto variable) {
644 zoneWidget->createGraph(variable, index);
645 delete context; // removes the connection
646 },
647 Qt::QueuedConnection);
648
633 649 auto productData = productsData.first().toHash();
634 650 QMetaObject::invokeMethod(&sqpApp->dataSourceController(), "requestVariable",
635 651 Qt::QueuedConnection, Q_ARG(QVariantHash, productData));
636
637
638 // TODO: add graph
639 652 }
General Comments 0
You need to be logged in to leave comments. Login now