11. Creating Graphics/View Windows
By reimplementing a custom QWidget
subclass’s paintEvent()
and using a QPainter
, we can draw anything we want. This is ideal for custom widgets, but is not at all convenient if we want to draw lots of individual items, especially if we want to provide the user with the ability to interact with the items. For example, in the past some users have created graphical applications using literally thousands of custom widgets to stand as graphical items, and although widget painting is very fast, handling a single mouse click in such situations could easily consume almost the whole CPU’s processing capability. Fortunately, ...
Get Advanced Qt Programming: Creating Great Software with C++ and Qt 4 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.