From c14cf72504ab59eb8cc680ee23bd1b7d1149d1d0 Mon Sep 17 00:00:00 2001 From: Atul R Date: Sat, 3 Aug 2019 23:48:40 +0200 Subject: [PATCH] Added getter property for pixmap and text for label --- docs/api/QLabel.md | 14 +++++++++----- src/lib/QtWidgets/QLabel/index.ts | 8 ++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/api/QLabel.md b/docs/api/QLabel.md index 66bdb7aaa..21083824e 100644 --- a/docs/api/QLabel.md +++ b/docs/api/QLabel.md @@ -27,7 +27,15 @@ QLabel can access all the static methods defined in [NodeWidget](api/NodeWidget. ### Instance Properties -QLabel can access all the instance properties defined in [NodeWidget](api/NodeWidget.md) +QLabel can access all the instance properties defined in [NodeWidget](api/NodeWidget.md). Additionally it also has the following instance properties: + +#### `label.pixmap` + +The pixmap currently set on this label. + +#### `label.text` + +the current text set on the label. ### Instance Methods @@ -41,10 +49,6 @@ Sets the given text to the label. - `text` string -#### `label.text()` - -returns the current text from the label. - #### `label.setWordWrap(on)` - `on` boolean - If true it sets wordwrap on the label diff --git a/src/lib/QtWidgets/QLabel/index.ts b/src/lib/QtWidgets/QLabel/index.ts index 1fc4eb726..87baaa247 100644 --- a/src/lib/QtWidgets/QLabel/index.ts +++ b/src/lib/QtWidgets/QLabel/index.ts @@ -9,6 +9,8 @@ export const QLabelEvents = Object.freeze({ }); export class QLabel extends NodeWidget { native: NativeElement; + text?: string | number; + pixmap?: QPixmap; constructor(parent?: NodeWidget) { let native; if (parent) { @@ -22,18 +24,16 @@ export class QLabel extends NodeWidget { // bind member functions this.setWordWrap.bind(this); this.setText.bind(this); - this.text.bind(this); } setWordWrap(on: boolean) { this.native.setWordWrap(on); } setText(text: string | number) { + this.text = text; this.native.setText(`${text}`); } - text() { - return this.native.text(); - } setPixmap(pixMap: QPixmap) { this.native.setPixmap(pixMap.native); + this.pixmap = pixMap; } }