That's rather a lot of code to digest without being able to run it. Can you pare it down to the parts you need to be able to drag a shape, and add what's missing (the Model class, for example), and a main routine?
"Il y a peu de choses qui me soient impossibles..."
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad: