| 86 | } |
| 87 | |
| 88 | void BaseDock::updatePlotRangeList() { |
| 89 | auto* element{static_cast<WorksheetElement*>(m_aspect)}; |
| 90 | if (!element) { |
| 91 | DEBUG(Q_FUNC_INFO << ", WARNING: no worksheet element!") |
| 92 | return; |
| 93 | } |
| 94 | const int cSystemCount{element->coordinateSystemCount()}; |
| 95 | const int cSystemIndex{element->coordinateSystemIndex()}; |
| 96 | |
| 97 | if (cSystemCount == 0) { |
| 98 | DEBUG(Q_FUNC_INFO << ", WARNING: no plot range yet") |
| 99 | return; |
| 100 | } |
| 101 | DEBUG(Q_FUNC_INFO << ", plot ranges count: " << cSystemCount) |
| 102 | DEBUG(Q_FUNC_INFO << ", current plot range: " << cSystemIndex + 1) |
| 103 | |
| 104 | if (!m_cbPlotRangeList) { |
| 105 | assert(false); |
| 106 | DEBUG(Q_FUNC_INFO << ", ERROR: no plot range combo box") |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | // fill ui.cbPlotRanges |
| 111 | m_suppressPlotRetransform = true; |
| 112 | m_cbPlotRangeList->clear(); |
| 113 | for (int i{0}; i < cSystemCount; i++) |
| 114 | m_cbPlotRangeList->addItem(QString::number(i + 1) + QStringLiteral(" : ") + element->coordinateSystemInfo(i)); |
| 115 | m_cbPlotRangeList->setCurrentIndex(cSystemIndex); |
| 116 | m_suppressPlotRetransform = false; |
| 117 | |
| 118 | // disable when there is only on plot range |
| 119 | m_cbPlotRangeList->setEnabled(cSystemCount == 1 ? false : true); |
| 120 | } |
| 121 | |
| 122 | //************************************************************* |
| 123 | //******* SLOTs for changes triggered in the dock widget ***** |
nothing calls this directly
no test coverage detected