The w variable is an instance of the MainWindow you allocated on the stack in main, so when you're inside of a method in your MainWindow class, just use move().