Added getter property for pixmap and text for label

This commit is contained in:
Atul R
2019-08-03 23:48:40 +02:00
parent e6eccd06a9
commit c14cf72504
2 changed files with 13 additions and 9 deletions
+4 -4
View File
@@ -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;
}
}