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

Method plotAt

src/frontend/worksheet/WorksheetView.cpp:803–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803CartesianPlot* WorksheetView::plotAt(QPoint pos) const {
804 QGraphicsItem* item = itemAt(pos);
805 if (!item)
806 return nullptr;
807
808 QGraphicsItem* plotItem = nullptr;
809 if (item->data(0).toInt() == static_cast<int>(AspectType::CartesianPlot))
810 plotItem = item;
811 else {
812 if (item->parentItem() && item->parentItem()->data(0).toInt() == static_cast<int>(AspectType::CartesianPlot))
813 plotItem = item->parentItem();
814 }
815
816 if (plotItem == nullptr)
817 return nullptr;
818
819 CartesianPlot* plot = nullptr;
820 for (auto* p : m_worksheet->children<CartesianPlot>()) {
821 if (p->graphicsItem() == plotItem) {
822 plot = p;
823 break;
824 }
825 }
826
827 return plot;
828}
829
830// ##############################################################################
831// #################################### Events ###############################

Callers

nothing calls this directly

Calls 2

dataMethod · 0.45
graphicsItemMethod · 0.45

Tested by

no test coverage detected