[][src]Struct qt_gui::QPaintDevice

#[repr(C)]pub struct QPaintDevice { /* fields omitted */ }

The QPaintDevice class is the base class of objects that can be painted on with QPainter.

C++ class: QPaintDevice.

C++ documentation:

The QPaintDevice class is the base class of objects that can be painted on with QPainter.

A paint device is an abstraction of a two-dimensional space that can be drawn on using a QPainter. Its default coordinate system has its origin located at the top-left position. X increases to the right and Y increases downwards. The unit is one pixel.

The drawing capabilities of QPaintDevice are currently implemented by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and QPrinter subclasses.

To implement support for a new backend, you must derive from QPaintDevice and reimplement the virtual paintEngine() function to tell QPainter which paint engine should be used to draw on this particular device. Note that you also must create a corresponding paint engine to be able to draw on the device, i.e derive from QPaintEngine and reimplement its virtual functions.

Warning: Qt requires that a QGuiApplication object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.

The QPaintDevice class provides several functions returning the various device metrics: The depth() function returns its bit depth (number of bit planes). The height() function returns its height in default coordinate system units (e.g. pixels for QPixmap and QWidget) while heightMM() returns the height of the device in millimeters. Similiarily, the width() and widthMM() functions return the width of the device in default coordinate system units and in millimeters, respectively. Alternatively, the protected metric() function can be used to retrieve the metric information by specifying the desired PaintDeviceMetric as argument.

The logicalDpiX() and logicalDpiY() functions return the horizontal and vertical resolution of the device in dots per inch. The physicalDpiX() and physicalDpiY() functions also return the resolution of the device in dots per inch, but note that if the logical and physical resolution differ, the corresponding QPaintEngine must handle the mapping. Finally, the colorCount() function returns the number of different colors available for the paint device.

Methods

impl QPaintDevice[src]

pub unsafe fn color_count(&self) -> c_int[src]

Returns the number of different colors available for the paint device. If the number of colors available is too great to be represented by the int data type, then INT_MAX will be returned instead.

Calls C++ function: int QPaintDevice::colorCount() const.

C++ documentation:

Returns the number of different colors available for the paint device. If the number of colors available is too great to be represented by the int data type, then INT_MAX will be returned instead.

pub unsafe fn depth(&self) -> c_int[src]

Returns the bit depth (number of bit planes) of the paint device.

Calls C++ function: int QPaintDevice::depth() const.

C++ documentation:

Returns the bit depth (number of bit planes) of the paint device.

pub unsafe fn dev_type(&self) -> c_int[src]

Calls C++ function: virtual int QPaintDevice::devType() const.

pub unsafe fn device_pixel_ratio(&self) -> c_int[src]

Returns the device pixel ratio for device.

Calls C++ function: int QPaintDevice::devicePixelRatio() const.

C++ documentation:

Returns the device pixel ratio for device.

Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

pub unsafe fn device_pixel_ratio_f(&self) -> c_double[src]

Returns the device pixel ratio for the device as a floating point number.

Calls C++ function: double QPaintDevice::devicePixelRatioF() const.

C++ documentation:

Returns the device pixel ratio for the device as a floating point number.

This function was introduced in Qt 5.6.

pub unsafe fn device_pixel_ratio_f_scale() -> c_double[src]

Calls C++ function: static double QPaintDevice::devicePixelRatioFScale().

pub unsafe fn height(&self) -> c_int[src]

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

Calls C++ function: int QPaintDevice::height() const.

C++ documentation:

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

See also heightMM().

pub unsafe fn height_m_m(&self) -> c_int[src]

Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

Calls C++ function: int QPaintDevice::heightMM() const.

C++ documentation:

Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

See also height().

pub unsafe fn logical_dpi_x(&self) -> c_int[src]

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM().

Calls C++ function: int QPaintDevice::logicalDpiX() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM().

Note that if the logicalDpiX() doesn't equal the physicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.

See also logicalDpiY() and physicalDpiX().

pub unsafe fn logical_dpi_y(&self) -> c_int[src]

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM().

Calls C++ function: int QPaintDevice::logicalDpiY() const.

C++ documentation:

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM().

Note that if the logicalDpiY() doesn't equal the physicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.

See also logicalDpiX() and physicalDpiY().

pub unsafe fn paint_engine(&self) -> Ptr<QPaintEngine>[src]

Returns a pointer to the paint engine used for drawing on the device.

Calls C++ function: pure virtual QPaintEngine* QPaintDevice::paintEngine() const.

C++ documentation:

Returns a pointer to the paint engine used for drawing on the device.

pub unsafe fn painting_active(&self) -> bool[src]

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

Calls C++ function: bool QPaintDevice::paintingActive() const.

C++ documentation:

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

See also QPainter::isActive().

pub unsafe fn physical_dpi_x(&self) -> c_int[src]

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Calls C++ function: int QPaintDevice::physicalDpiX() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Note that if the physicalDpiX() doesn't equal the logicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.

See also physicalDpiY() and logicalDpiX().

pub unsafe fn physical_dpi_y(&self) -> c_int[src]

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Calls C++ function: int QPaintDevice::physicalDpiY() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Note that if the physicalDpiY() doesn't equal the logicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.

See also physicalDpiX() and logicalDpiY().

pub unsafe fn width(&self) -> c_int[src]

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

Calls C++ function: int QPaintDevice::width() const.

C++ documentation:

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

See also widthMM().

pub unsafe fn width_m_m(&self) -> c_int[src]

Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

Calls C++ function: int QPaintDevice::widthMM() const.

C++ documentation:

Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

See also width().

Trait Implementations

impl CppDeletable for QPaintDevice[src]

unsafe fn delete(&self)[src]

Destroys the paint device and frees window system resources.

Calls C++ function: virtual [destructor] void QPaintDevice::~QPaintDevice().

C++ documentation:

Destroys the paint device and frees window system resources.

impl DynamicCast<QBitmap> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>[src]

Calls C++ function: QBitmap* dynamic_cast<QBitmap*>(QPaintDevice* ptr).

impl DynamicCast<QImage> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QImage>[src]

Calls C++ function: QImage* dynamic_cast<QImage*>(QPaintDevice* ptr).

impl DynamicCast<QOpenGLPaintDevice> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QOpenGLPaintDevice>[src]

Calls C++ function: QOpenGLPaintDevice* dynamic_cast<QOpenGLPaintDevice*>(QPaintDevice* ptr).

impl DynamicCast<QOpenGLWindow> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QOpenGLWindow>[src]

Calls C++ function: QOpenGLWindow* dynamic_cast<QOpenGLWindow*>(QPaintDevice* ptr).

impl DynamicCast<QPagedPaintDevice> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QPagedPaintDevice>[src]

Calls C++ function: QPagedPaintDevice* dynamic_cast<QPagedPaintDevice*>(QPaintDevice* ptr).

impl DynamicCast<QPaintDeviceWindow> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QPaintDeviceWindow>[src]

Calls C++ function: QPaintDeviceWindow* dynamic_cast<QPaintDeviceWindow*>(QPaintDevice* ptr).

impl DynamicCast<QPdfWriter> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QPdfWriter>[src]

Calls C++ function: QPdfWriter* dynamic_cast<QPdfWriter*>(QPaintDevice* ptr).

impl DynamicCast<QPicture> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QPicture>[src]

Calls C++ function: QPicture* dynamic_cast<QPicture*>(QPaintDevice* ptr).

impl DynamicCast<QPixmap> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QPixmap>[src]

Calls C++ function: QPixmap* dynamic_cast<QPixmap*>(QPaintDevice* ptr).

impl DynamicCast<QRasterWindow> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QRasterWindow>[src]

Calls C++ function: QRasterWindow* dynamic_cast<QRasterWindow*>(QPaintDevice* ptr).

impl StaticDowncast<QBitmap> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QBitmap>[src]

Calls C++ function: QBitmap* static_cast<QBitmap*>(QPaintDevice* ptr).

impl StaticDowncast<QImage> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QImage>[src]

Calls C++ function: QImage* static_cast<QImage*>(QPaintDevice* ptr).

impl StaticDowncast<QOpenGLPaintDevice> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QOpenGLPaintDevice>[src]

Calls C++ function: QOpenGLPaintDevice* static_cast<QOpenGLPaintDevice*>(QPaintDevice* ptr).

impl StaticDowncast<QOpenGLWindow> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QOpenGLWindow>[src]

Calls C++ function: QOpenGLWindow* static_cast<QOpenGLWindow*>(QPaintDevice* ptr).

impl StaticDowncast<QPagedPaintDevice> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QPagedPaintDevice>[src]

Calls C++ function: QPagedPaintDevice* static_cast<QPagedPaintDevice*>(QPaintDevice* ptr).

impl StaticDowncast<QPaintDeviceWindow> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QPaintDeviceWindow>[src]

Calls C++ function: QPaintDeviceWindow* static_cast<QPaintDeviceWindow*>(QPaintDevice* ptr).

impl StaticDowncast<QPdfWriter> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QPdfWriter>[src]

Calls C++ function: QPdfWriter* static_cast<QPdfWriter*>(QPaintDevice* ptr).

impl StaticDowncast<QPicture> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QPicture>[src]

Calls C++ function: QPicture* static_cast<QPicture*>(QPaintDevice* ptr).

impl StaticDowncast<QPixmap> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QPixmap>[src]

Calls C++ function: QPixmap* static_cast<QPixmap*>(QPaintDevice* ptr).

impl StaticDowncast<QRasterWindow> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QRasterWindow>[src]

Calls C++ function: QRasterWindow* static_cast<QRasterWindow*>(QPaintDevice* ptr).

impl StaticUpcast<QPaintDevice> for QImage[src]

unsafe fn static_upcast(ptr: Ptr<QImage>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QImage* ptr).

impl StaticUpcast<QPaintDevice> for QPixmap[src]

unsafe fn static_upcast(ptr: Ptr<QPixmap>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPixmap* ptr).

impl StaticUpcast<QPaintDevice> for QBitmap[src]

unsafe fn static_upcast(ptr: Ptr<QBitmap>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QBitmap* ptr).

impl StaticUpcast<QPaintDevice> for QOpenGLPaintDevice[src]

unsafe fn static_upcast(ptr: Ptr<QOpenGLPaintDevice>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QOpenGLPaintDevice* ptr).

impl StaticUpcast<QPaintDevice> for QPaintDeviceWindow[src]

unsafe fn static_upcast(ptr: Ptr<QPaintDeviceWindow>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPaintDeviceWindow* ptr).

impl StaticUpcast<QPaintDevice> for QOpenGLWindow[src]

unsafe fn static_upcast(ptr: Ptr<QOpenGLWindow>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QOpenGLWindow* ptr).

impl StaticUpcast<QPaintDevice> for QPagedPaintDevice[src]

unsafe fn static_upcast(ptr: Ptr<QPagedPaintDevice>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPagedPaintDevice* ptr).

impl StaticUpcast<QPaintDevice> for QPdfWriter[src]

unsafe fn static_upcast(ptr: Ptr<QPdfWriter>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPdfWriter* ptr).

impl StaticUpcast<QPaintDevice> for QPicture[src]

unsafe fn static_upcast(ptr: Ptr<QPicture>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPicture* ptr).

impl StaticUpcast<QPaintDevice> for QRasterWindow[src]

unsafe fn static_upcast(ptr: Ptr<QRasterWindow>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QRasterWindow* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.