MCPcopy Create free account
hub / github.com/IENT/YUView / onStatisticsControlChanged

Method onStatisticsControlChanged

YUViewLib/src/statistics/StatisticUIHandler.cpp:207–248  ·  view source on GitHub ↗

One of the primary controls changed. Update the secondary controls (if they were created) without emitting further signals and of course update the statsTypeList to render the stats correctly.

Source from the content-addressed store, hash-verified

205// One of the primary controls changed. Update the secondary controls (if they were created) without
206// emitting further signals and of course update the statsTypeList to render the stats correctly.
207void StatisticUIHandler::onStatisticsControlChanged()
208{
209 if (!this->statisticsData)
210 {
211 DEBUG_STATUI("StatisticUIHandler::onStatisticsControlChanged statisticsData not set");
212 return;
213 }
214
215 auto &statTypes = this->statisticsData->getStatisticsTypes();
216 for (unsigned row = 0; row < statTypes.size(); ++row)
217 {
218 auto &statType = statTypes.at(row);
219
220 // Get the values of the statistics type from the controls
221 statType.render = itemNameCheckBoxes[0][row]->isChecked();
222 statType.alphaFactor = itemOpacitySliders[0][row]->value();
223
224 // Enable/disable the slider and grid check box depending on the item name check box
225 bool enable = itemNameCheckBoxes[0][row]->isChecked();
226 itemOpacitySliders[0][row]->setEnabled(enable);
227 itemStyleButtons[0][row]->setEnabled(enable);
228
229 // Update the secondary controls if they were created
230 if (ui2.created() && itemNameCheckBoxes[1].size() > 0)
231 {
232 // Update the controls that changed
233 if (itemNameCheckBoxes[0][row]->isChecked() != itemNameCheckBoxes[1][row]->isChecked())
234 {
235 const QSignalBlocker blocker(itemNameCheckBoxes[1][row]);
236 itemNameCheckBoxes[1][row]->setChecked(itemNameCheckBoxes[0][row]->isChecked());
237 }
238
239 if (itemOpacitySliders[0][row]->value() != itemOpacitySliders[1][row]->value())
240 {
241 const QSignalBlocker blocker(itemOpacitySliders[1][row]);
242 itemOpacitySliders[1][row]->setValue(itemOpacitySliders[0][row]->value());
243 }
244 }
245 }
246
247 emit updateItem(true);
248}
249
250// One of the secondary controls changed. Perform the inverse thing to onStatisticsControlChanged().
251// Update the primary controls without emitting further signals and of course update the

Callers

nothing calls this directly

Calls 3

createdMethod · 0.80
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected