I think my mousemoveevent is already lightweight because the if condtions are rarely satisfied:
@void MatrixW::mouseMoveEvent(QMouseEvent *e)
{
if(thismove!=none)
{
int xnew=e->x()/larghcell;
int ynew =e->y()/altcell;
if((xnew!=xN||ynew!=yN)&&(xnew<size_x && ynew<size_y))
{
if (isarelease)
{
isarelease=false;
if (thismove==del)
setcell(xN,yN,0);
else if (thismove==add)
setcell(xN,yN,1);
}
xN=xnew;
yN=ynew;
if (thismove==del)
setcell(xN,yN,0);
else if (thismove==add)
setcell(xN,yN,1);
update();
}
}
}@
(thismove!=none) only if the mouse is clicked
((xnew!=xN||ynew!=yN)&&(xnew<size_x && ynew<size_y)) is rarely true each 50-100 ms
The good way to do this I think is to start a timer when the mouse was clicked, the timer call each 50-100ms a function like MatrixW::mouseMoveEvent(QMouseEvent *e) where the program can read the muose position.
The mouse release event stop the timer.
But I don't know how to read the mouse position in the function called by the timer
continually read the mouse position would be the same as what I do now (about the slowdowns)