void Preview::paintGL () { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); const int w = width(); const int h = height(); // Paint the background painter.fillRect(0, 0, w, h, Qt::white); // ... a few dozen more lines ... painter.end(); }