| 96 | } |
| 97 | |
| 98 | void addRangeRow(LayerStatisticsDialog* lsd, QTableWidget* table, int& row_i, |
| 99 | const RangeStatsType& row_name, const RangeStatsVariant& row_data, |
| 100 | const bool enable_show_button, LayerStatistics* stats) |
| 101 | { |
| 102 | addEmptyRow(table, row_i, row_name.name.c_str()); |
| 103 | // get column data |
| 104 | std::array<QString, col_count> col_values = std::visit(overload{ |
| 105 | [&](const RangeStatsInt& d) -> std::array<QString, col_count> { return {toStringWithLocale(d.getCount()), |
| 106 | QString::number(d.getMin()), |
| 107 | QString::number(d.getMax()), |
| 108 | QString::number(d.getAvg(), 'f', 2)}; }, |
| 109 | [&](const RangeStatsDouble& d) -> std::array<QString, col_count> { return {toStringWithLocale(d.getCount()), |
| 110 | QString::number(d.getMin(), 'f', 2), |
| 111 | QString::number(d.getMax(), 'f', 2), |
| 112 | QString::number(d.getAvg(), 'f', 2)}; } |
| 113 | }, row_data); |
| 114 | |
| 115 | populateRow(table, row_i, col_values); |
| 116 | |
| 117 | if (enable_show_button) |
| 118 | { |
| 119 | auto button = new QPushButton(row_name.name.c_str(), table); |
| 120 | table->setCellWidget(row_i, col_count, button); |
| 121 | QObject::connect(button, &QPushButton::clicked, [=]() { showDistribution(lsd, row_name.name.c_str(), stats->getDistribution(row_name)); }); |
| 122 | } |
| 123 | |
| 124 | // next row |
| 125 | ++row_i; |
| 126 | } |
| 127 | |
| 128 | void addCountRow(QTableWidget* table, int& row_i, const QString& row_name, const StatsCounter& row_data) |
| 129 | { |
no test coverage detected