When a user clicks, the mouse position x & y value is stored in a QList<int>
User will be able to click several times
My problem is if a user clicks the same spot where he/she already clicked
that x & y value must be deleted from the array only.
This is so far what i got:
//In mouseMove function
if(ev->button()==Qt::LeftButton)
{
x1 = ev->x();
y1 = ev->y(); //x1,y1 are temp variables later in same function used to .append into array
...
}
//In mouseMove function
if(ev->button()==Qt::LeftButton)
{
x1 = ev->x();
y1 = ev->y(); //x1,y1 are temp variables later in same function used to .append into array
...
}
To copy to clipboard, switch view to plain text mode
RemoveValue function is:
void class::RemovePoint()
{
int r = 0;
do
{
//Only 1 Array stored in format x|y|x|y|x|y|x|y|x|y|...
if(Array1[r] == x1 && Array1[r+1] == y1)
{
Array1.removeAt(r);
Array1.removeAt(r);
}
r = r + 2; //Jumps to next x value
}while(r < 50); lets say 25 points, hence x & y values = 50 array elements
}
void class::RemovePoint()
{
int r = 0;
do
{
//Only 1 Array stored in format x|y|x|y|x|y|x|y|x|y|...
if(Array1[r] == x1 && Array1[r+1] == y1)
{
Array1.removeAt(r);
Array1.removeAt(r);
}
r = r + 2; //Jumps to next x value
}while(r < 50); lets say 25 points, hence x & y values = 50 array elements
}
To copy to clipboard, switch view to plain text mode
I am not worried about the display
Just need the array to be updated as it happens
Program compiles
when I test the same point
Program crashes
[Invalid parameter passing & Assert Failure :"index out of range"
Help Appreciated...Much
Thanks
Bookmarks