Fixed multiple selection, temporarily disabled interface updates due to update spam from a controler

Code style changes and integration by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
k1-801 2020-08-20 03:19:21 +04:00 committed by Adam Honse
parent c8ea2ff36f
commit 4601b91f1f
3 changed files with 64 additions and 36 deletions

View file

@ -323,8 +323,8 @@ void DeviceView::paintEvent(QPaintEvent* /* event */)
int posh = zone_pos[zone_idx].matrix_h * size;
QRect rect = {posx, posy, posw, posh};
if(rect.contains(lastMousePos))
if(rect.contains(lastMousePos) && (!mouseDown || !mouseMoved))
{
painter.setPen(palette().highlight().color());
}
@ -380,13 +380,15 @@ void DeviceView::updateSelection()
if(ctrlDown)
{
selectionFlags[led_idx] ^= previousFlags[led_idx];
}
if(selectionFlags[led_idx])
{
selectedLeds.push_back(led_idx);
}
if(selectionFlags[led_idx])
{
selectedLeds.push_back(led_idx);
}
}
update();
/*-----------------------------------------------------*\
| Send selection changed signal |
@ -407,6 +409,8 @@ bool DeviceView::selectLed(int target)
selectionFlags.resize(controller->leds.size());
selectionFlags[target] = 1;
update();
/*-----------------------------------------------------*\
| Send selection changed signal |
\*-----------------------------------------------------*/
@ -448,6 +452,8 @@ bool DeviceView::selectLeds(QVector<int> target)
}
}
update();
/*-----------------------------------------------------*\
| Send selection changed signal |
\*-----------------------------------------------------*/
@ -481,6 +487,8 @@ bool DeviceView::selectZone(int zone, bool add)
}
}
update();
/*-----------------------------------------------------*\
| Send selection changed signal |
\*-----------------------------------------------------*/