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.

Example

const { QPixmap } = require("@nodegui/nodegui");
const imageUrl = "path/to/png";
const pixMap = new QPixmap(imageUrl);

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new QPixmap(): QPixmap

Overrides Component.constructor

Returns: QPixmap

+ new QPixmap(native: NativeElement): QPixmap

Overrides Component.constructor

Parameters:

NameType
nativeNativeElement

Returns: QPixmap

+ new QPixmap(filePath: string): QPixmap

Overrides Component.constructor

Parameters:

NameType
filePathstring

Returns: QPixmap

Properties

native

• native: NativeElement | null

Inherited from Component.native

Methods

height

â–¸ height(): number

Returns: number


load

â–¸ load(imagePath: string): boolean

Parameters:

NameType
imagePathstring

Returns: boolean


loadFromData

â–¸ loadFromData(buffer: Buffer, format?: ImageFormats): boolean

Parameters:

NameType
bufferBuffer
format?ImageFormats

Returns: boolean


save

â–¸ save(fileName: string, format?: ImageFormats): boolean

Parameters:

NameType
fileNamestring
format?ImageFormats

Returns: boolean


scaled

â–¸ scaled(width: number, height: number, aspectRatioMode?: AspectRatioMode, transformationMode?: TransformationMode): QPixmap

Parameters:

NameType
widthnumber
heightnumber
aspectRatioMode?AspectRatioMode
transformationMode?TransformationMode

Returns: QPixmap


width

â–¸ width(): number

Returns: number


Static fromImage

â–¸ fromImage(image: QImage, flags: ImageConversionFlag): QPixmap

Parameters:

NameType
imageQImage
flagsImageConversionFlag

Returns: QPixmap


Static fromQVariant

â–¸ fromQVariant(variant: QVariant): QPixmap

Parameters:

NameType
variantQVariant

Returns: QPixmap