MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / selectZone

Method selectZone

qt/DeviceView.cpp:996–1029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

994}
995
996bool DeviceView::selectZone(int zone, bool add)
997{
998 if(zone < 0 || size_t(zone) >= controller->zones.size())
999 {
1000 return false;
1001 }
1002
1003 if(!add)
1004 {
1005 selectedLeds.clear();
1006 selectionFlags.clear();
1007 selectionFlags.resize(controller->leds.size());
1008 }
1009
1010 int zoneStart = controller->zones[zone].start_idx;
1011
1012 for(std::size_t led_idx = 0; led_idx < controller->zones[zone].leds_count; ++led_idx)
1013 {
1014 if(!selectionFlags[zoneStart + led_idx])
1015 {
1016 selectedLeds.push_back(zoneStart + led_idx);
1017 selectionFlags[zoneStart + led_idx] = 1;
1018 }
1019 }
1020
1021 update();
1022
1023 /*-----------------------------------------------------*\
1024 | Send selection changed signal |
1025 \*-----------------------------------------------------*/
1026 emit selectionChanged(selectedLeds);
1027
1028 return true;
1029}
1030
1031void DeviceView::clearSelection()
1032{

Calls 3

updateFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected