Application Development with Qt Creator - Second Edition by Ray Rischpater

Application Development with Qt Creator - Second Edition by Ray Rischpater

Author:Ray Rischpater [Rischpater, Ray]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2014-11-27T05:00:00+00:00


As Qt's painting implementation uses the underlying windowing system, any application that performs graphics operation must be built using QGuiApplication, which initializes the windowing system as part of its startup.

Drawing with QPainter on QPaintDevice instances

At its core, graphics painting requires two things: something that knows how to paint and something that can be painted on. Qt defines the QPainter class as the former and the QPaintDevice as the interface for classes for the latter. You'll seldom instantiate each, but you use both of these classes a lot if you're doing graphics programming; typically, you'll have an instance of a subclass of QPaintDevice, ask it for its associated QPainter, and then use QPainter to perform your drawing. This can happen when you're writing a widget; you'll be passed a QPainter subclass, for example, when you need to paint the widget's contents.

There are several subclasses of QPaintDevice:

QWidget: This class and its subclasses are used by the widget hierarchy

QImage: This is a container class for offscreen images that are optimized for input/output and individual pixel access

QPixmap: This is a container class for offscreen images that's highly optimized for interaction with the screen

QBitmap: This is a subclass of QPixmap that has a bit depth of 1, making it suitable for monochrome images

QPicture: This is a paint device that records QPainter drawing operations and can play them back



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.