nodeguy/docs/api/QPixmap.md
2019-08-04 12:13:26 +02:00

1.7 KiB

Class: QPixmap

The QPixmap class helps hold an image in the form of off-screen image representation.

This class is a JS wrapper around Qt's QPixmap class

A QPixmap provides ability to store an image in the memory.

QPixmap inherits from Component

Example

const { QPixmap } = require("@nodegui/nodegui");

const imageUrl = "path/to/png";
const pixMap = new QPixmap(imageUrl);

new QPixmap(imageUrl?)

  • imageUrl string (optional). Absolute path of the image that needs to be loaded in the memory.

Static Methods

QPixmap can access all the static methods defined in Component

Instance Properties

QPixmap can access all the instance properties defined in Component

Instance Methods

QPixmap can access all the instance methods defined in Component

Additionally it also has the following instance methods:

pixMap.load(imageUrl)

loads an image from the url into memory as a Pixmap. returns true if load was successful otherwise returns false.

  • imageUrl string (optional). Absolute path of the image that needs to be loaded in the memory.

pixMap.scaled(width, height, aspectRatioMode?)

Scales the pixmap to provided height and width with respect to aspectRatioMode. This method doesnt mutate this pixmap and rather returns a new pixmap with new height and width.

  • width number. Width in pixels for new pixmap.
  • height number. Height in pixels for new pixmap.
  • aspectRatioMode AspectRatioMode (optional). Specifies how scaling should happen. AspectRatio is an enum from Qt