diff --git a/docs/api/QIcon.md b/docs/api/QIcon.md index 2a6cd1e08..11a88e226 100644 --- a/docs/api/QIcon.md +++ b/docs/api/QIcon.md @@ -30,3 +30,14 @@ QIcon can access all the instance properties defined in [Component](api/Componen ### Instance Methods QIcon can access all the instance methods defined in [Component](api/Component.md) +Additionally it also has the following instance methods: + +#### `icon.pixmap(width, height, mode?, state?)` + +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](https://doc.qt.io/qt-5/qicon.html#pixmap-3). + +- `width`: number, +- `height`: number +- `mode?`: QIconMode +- `state?`: QIconState diff --git a/src/index.ts b/src/index.ts index 7acd8a56f..a07bd0783 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ export * from "./lib/QtEnums"; // Gui: export { QApplication } from "./lib/QtGui/QApplication"; export { QPixmap } from "./lib/QtGui/QPixmap"; -export { QIcon } from "./lib/QtGui/QIcon"; +export { QIcon, QIconMode, QIconState } from "./lib/QtGui/QIcon"; export { QCursor } from "./lib/QtGui/QCursor"; export { QTextOptionWrapMode } from "./lib/QtGui/QTextOption"; export { QClipboard, QClipboardMode } from "./lib/QtGui/QClipboard"; diff --git a/src/lib/QtGui/QIcon/index.ts b/src/lib/QtGui/QIcon/index.ts index 4405ec5dd..b35fe6351 100644 --- a/src/lib/QtGui/QIcon/index.ts +++ b/src/lib/QtGui/QIcon/index.ts @@ -2,8 +2,16 @@ import addon from "../../core/addon"; import { Component, NativeElement } from "../../core/Component"; import { QPixmap } from "../../QtGui/QPixmap"; -export enum QIconMode { Normal, Disabled, Active, Selected } -export enum QIconState { Off, On } +export enum QIconMode { + Normal, + Disabled, + Active, + Selected +} +export enum QIconState { + Off, + On +} type arg = string | NativeElement; export class QIcon extends Component { @@ -21,7 +29,7 @@ export class QIcon extends Component { width: number, height: number, mode?: QIconMode, - state?: QIconState, + state?: QIconState ): QPixmap => { let nativePixmap; if (mode && state) {