Listing 1. Creating a QCanvas and a QCanvasView// This is the constructor for Snake. SnakeGame::SnakeGame(QWidget* parent, QMainWindow(parent,name,f), canvas(232, 258) { // create a canvas view cv = new QCanvasView(&canvas, this); // create a toolbar and put a new game button on it QToolBar* toolbar = new QToolBar( this); QToolButton* newgame = new QToolButton(newicon, SLOT(newGame()), toolbar,"New Game"); // set the canvasview to appear in the center of // the window setCentralWidget(cv); }