O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a custom widget

It is time to actually get something onto the screen by painting on a widget. A widget is repainted as a result of receiving a paint event, which is handled by reimplementing the paintEvent() virtual method. This method accepts a pointer to the event object of the QPaintEvent type that contains various bits of information about the repaint request. Remember that you can only paint on the widget from within that widget's paintEvent() call.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required