nodeguy/website/docs/api/QIcon.md
2019-10-26 23:55:37 +02:00

1.7 KiB

sidebar_label title
QIcon QIcon

The QIcon class provides scalable icons in different modes and states.

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

QIcon inherits from Component

Example

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

const imageUrl = "path/to/png";
const icon = new QIcon(imageUrl);

new QIcon(imageUrl?)

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

Static Methods

QIcon can access all the static methods defined in Component

Instance Properties

QIcon can access all the instance properties defined in Component

Instance Methods

QIcon can access all the instance methods defined in Component Additionally it also has the following instance methods:

icon.pixmap(width, height, mode?, state?) (v0.1.10 & up)

Returns a pixmap with the requested size, mode, and state, generating one if necessary. The pixmap might be smaller than requested, but never larger. . It calls the native method QIcon: pixmap.

  • width: number,
  • height: number
  • mode?: QIconMode
  • state?: QIconState

icon.isMask()

Returns true if this icon has been marked as a mask image. It calls the native method QIcon: isMask.

icon.setIsMask(isMask)

Indicate that this icon is a mask image, and hence can potentially be modified based on where it's displayed. It calls the native method QIcon: setIsMask.

  • isMask: boolean