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

Method setIntValue

src/frontend/spreadsheet/AddSubtractValueDialog.cpp:1095–1129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1093}
1094
1095bool AddSubtractValueDialog::setIntValue(int& value, int columnIndex) const {
1096 if (columnIndex < 0 || columnIndex >= m_columns.count()) // should never happen...
1097 return false;
1098
1099 bool ok = false;
1100 const auto numberLocale = QLocale();
1101 if (m_operation == Add || m_operation == Subtract) {
1102 auto type = static_cast<ValueType>(ui.cbType->itemData(ui.cbType->currentIndex()).toInt());
1103 switch (type) {
1104 case ValueType::CustomValue:
1105 value = numberLocale.toInt(ui.leValue->text(), &ok);
1106 break;
1107 case ValueType::Difference:
1108 value = numberLocale.toInt(ui.leValueEnd->text(), &ok) - numberLocale.toInt(ui.leValueStart->text(), &ok);
1109 break;
1110 case ValueType::Minimum:
1111 value = m_columns.at(columnIndex)->statistics().minimum;
1112 break;
1113 case ValueType::Maximum:
1114 value = m_columns.at(columnIndex)->statistics().maximum;
1115 break;
1116 case ValueType::Median:
1117 value = round(m_columns.at(columnIndex)->statistics().median);
1118 break;
1119 case ValueType::Mean:
1120 value = round(m_columns.at(columnIndex)->statistics().arithmeticMean);
1121 break;
1122 case ValueType::Baseline:
1123 break;
1124 }
1125 } else
1126 value = numberLocale.toInt(ui.leValue->text(), &ok);
1127
1128 return ok;
1129}
1130
1131bool AddSubtractValueDialog::setBigIntValue(qint64& value, int columnIndex) const {
1132 if (columnIndex < 0 || columnIndex >= m_columns.count()) // should never happen...

Callers

nothing calls this directly

Calls 4

statisticsMethod · 0.80
countMethod · 0.45
currentIndexMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected