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

Method removePlotRange

src/frontend/dockwidgets/CartesianPlotDock.cpp:1200–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1198}
1199
1200void CartesianPlotDock::removePlotRange() {
1201 DEBUG(Q_FUNC_INFO)
1202
1203 int currentRow{ui.twPlotRanges->currentRow()};
1204 QDEBUG(Q_FUNC_INFO << ", current plot range = " << currentRow)
1205 if (currentRow < 0 || currentRow > m_plot->coordinateSystemCount()) {
1206 DEBUG(Q_FUNC_INFO << ", no current plot range")
1207 currentRow = m_plot->coordinateSystemCount() - 1;
1208 }
1209 QDEBUG(Q_FUNC_INFO << ", removing plot range " << currentRow)
1210
1211 // check all children for cSystem usage
1212 for (auto* element : m_plot->children<WorksheetElement>()) {
1213 const int cSystemIndex{element->coordinateSystemIndex()};
1214 DEBUG(Q_FUNC_INFO << ", element x index = " << cSystemIndex)
1215 if (cSystemIndex == currentRow) {
1216 DEBUG(Q_FUNC_INFO << ", WARNING: plot range used in element")
1217
1218 auto status =
1219 KMessageBox::warningTwoActions(this,
1220 i18n("Plot range %1 is used by element \"%2\". ", currentRow + 1, element->name()) + i18n("Really remove it?"),
1221 QString(),
1222 KStandardGuiItem::remove(),
1223 KStandardGuiItem::cancel());
1224 if (status == KMessageBox::SecondaryAction)
1225 return;
1226 else
1227 element->setCoordinateSystemIndex(0); // reset
1228 }
1229 }
1230
1231 m_plot->removeCoordinateSystem(currentRow);
1232 updatePlotRangeList();
1233 m_plot->retransform(); // update plot and elements
1234}
1235
1236void CartesianPlotDock::PlotRangeChanged(const int plotRangeIndex, const Dimension dim, const int index) {
1237 const std::string dimStr = CartesianCoordinateSystem::dimensionToString(dim).toStdString();

Callers

nothing calls this directly

Calls 7

coordinateSystemIndexMethod · 0.80
QStringClass · 0.50
coordinateSystemCountMethod · 0.45
nameMethod · 0.45
retransformMethod · 0.45

Tested by

no test coverage detected