Added getter property for pixmap and text for label
This commit is contained in:
parent
e6eccd06a9
commit
c14cf72504
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user