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

Method autoScaleRange

src/frontend/dockwidgets/CartesianPlotDock.cpp:986–1025  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

984}
985
986void CartesianPlotDock::autoScaleRange(const Dimension dim, const int index, bool checked) {
987 DEBUG(Q_FUNC_INFO << ", index = " << index << " checked = " << checked)
988
989 QTableWidget* treewidget = ui.twXRanges;
990 Dimension dim_other = Dimension::Y;
991 switch (dim) {
992 case Dimension::X:
993 break;
994 case Dimension::Y:
995 dim_other = Dimension::X;
996 treewidget = ui.twYRanges;
997 break;
998 }
999
1000 if (treewidget->cellWidget(index, TwRangesColumn::Format)) {
1001 CELLWIDGET(dim, index, TwRangesColumn::Format, QComboBox, setEnabled(!checked));
1002 CELLWIDGET(dim, index, TwRangesColumn::Min, QWidget, setEnabled(!checked));
1003 CELLWIDGET(dim, index, TwRangesColumn::Max, QWidget, setEnabled(!checked));
1004 }
1005
1006 for (auto* plot : m_plotList) {
1007 bool retransform = true; // must be true, because in enableAutoScale scaleAutoX will be already called
1008 plot->enableAutoScale(dim, index, checked, true);
1009 DEBUG(Q_FUNC_INFO << " new auto scale = " << plot->range(dim, index).autoScale())
1010 if (checked) { // && index == plot->defaultCoordinateSystem()->index(Dimension::Y)
1011 retransform |= plot->scaleAuto(dim, index, true);
1012
1013 for (int i = 0; i < plot->coordinateSystemCount(); i++) {
1014 auto cSystem = plot->coordinateSystem(i);
1015 if (cSystem->index(dim) == index) {
1016 if (plot->autoScale(dim_other, cSystem->index(dim_other)))
1017 retransform |= plot->scaleAuto(dim_other, cSystem->index(dim_other), false);
1018 }
1019 }
1020 }
1021 if (retransform)
1022 plot->WorksheetElementContainer::retransform();
1023 }
1024 updateRangeList(dim); // see range changes
1025}
1026
1027void CartesianPlotDock::minChanged(const Dimension dim, const int index, double min) {
1028 DEBUG(Q_FUNC_INFO << ", value = " << min);

Callers

nothing calls this directly

Calls 7

rangeMethod · 0.80
scaleAutoMethod · 0.80
enableAutoScaleMethod · 0.45
autoScaleMethod · 0.45
coordinateSystemCountMethod · 0.45
coordinateSystemMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected