Quote Originally Posted by franco.amato View Post
I still didn't understand why the static gave that behaviour if I update at every call the member variablke
Here is a small example:
Qt Code:
  1. void foo() {
  2. static int counter = 0;
  3. cout << "foo has been called " << ++counter << " times\n";
  4. }
  5.  
  6. int main() {
  7. for( int i = 0; i < 10; ++i ) foo();
  8. }
To copy to clipboard, switch view to plain text mode 
it will display:
foo has been called 1 times
foo has been called 2 times
foo has been called 3 times
...
foo has been called 10 times

So, as it can be easily noticed, this line:
Qt Code:
  1. static int counter = 0;
To copy to clipboard, switch view to plain text mode 
is called ONCE, when this line is rached for the first time. So counter variable is created once and 0 is assigned to it once. Then it remains in memory for every foo() call until the end of app execution.
So in your code point[3] was created and initialized once on the first call of paintEvent() and remained there forever (until program ends).