nodeguy/src/lib/QtWidgets/QLabel.ts
Atul R 6035b5d038
Re arrange folders to make more sense (#180)
* Re-arranged qtgui and core

* Re arranges qt widgets
2019-11-08 20:33:17 +01:00

47 lines
1.3 KiB
TypeScript

import addon from '../utils/addon';
import { NodeWidget } from './QWidget';
import { BaseWidgetEvents } from '../core/EventWidget';
import { NativeElement } from '../core/Component';
import { QPixmap } from '../QtGui/QPixmap';
export const QLabelEvents = Object.freeze({
...BaseWidgetEvents,
});
export class QLabel extends NodeWidget {
native: NativeElement;
private _pixmap?: QPixmap;
constructor(parent?: NodeWidget) {
let native;
if (parent) {
native = new addon.QLabel(parent.native);
} else {
native = new addon.QLabel();
}
super(native);
this.native = native;
this.nodeParent = parent;
}
setWordWrap(on: boolean): void {
this.native.setWordWrap(on);
}
wordWrap(): boolean {
return this.native.wordWrap();
}
setText(text: string | number): void {
this.native.setText(`${text}`);
}
text(): string {
return this.native.text();
}
setPixmap(pixMap: QPixmap): void {
this.native.setPixmap(pixMap.native);
this._pixmap = pixMap;
}
pixmap(): QPixmap | undefined {
return this._pixmap;
}
setOpenExternalLinks(open: boolean): void {
this.native.setOpenExternalLinks(open);
}
}