nodeguy/src/lib/QtWidgets/QGraphicsDropShadowEffect.ts
feng8848 527a18a1e5
fix issue #503 (#519)
* fix issue #481

* fix lint

* Add QTextEdit and QTextBrowser

* Add QGraphicsBlurEffect

* Add QGraphicsDropShadowEffect

Co-authored-by: wuxiaofeng <wuxiaofeng@erayt.com>
2020-04-14 19:10:34 +02:00

73 lines
2.2 KiB
TypeScript

import addon from '../utils/addon';
import { NativeElement } from '../core/Component';
import { checkIfNativeElement } from '../utils/helpers';
import { NodeObject } from '../QtCore/QObject';
import { QGraphicsEffect, QGraphicsEffectSignals } from './QGraphicsEffect';
import { QColor } from '../QtGui/QColor';
/**
> The QGraphicsDropShadowEffect class provides a drop shadow effect.
* **This class is a JS wrapper around Qt's [QGraphicsDropShadowEffect class](https://doc.qt.io/qt-5/qgraphicsdropshadoweffect.html)**
A drop shadow effect renders the source with a drop shadow.
### Example
```javascript
const { QGraphicsDropShadowEffect } = require("@nodegui/nodegui");
const shadow = new QGraphicsDropShadowEffect();
shadow.setBlurRadius(8);
```
*/
export class QGraphicsDropShadowEffect extends QGraphicsEffect<QGraphicsDropShadowEffectSignals> {
native: NativeElement;
constructor();
constructor(native: NativeElement);
constructor(parent: NodeObject<any>);
constructor(arg?: NodeObject<any> | NativeElement) {
let native: NativeElement;
if (arg) {
if (checkIfNativeElement(arg)) {
native = arg as NativeElement;
} else {
native = new addon.QGraphicsDropShadowEffect(arg.native);
}
} else {
native = new addon.QGraphicsDropShadowEffect();
}
super(native);
this.native = native;
}
setBlurRadius(blurRadius: number): void {
this.setProperty('blurRadius', blurRadius);
}
blurRadius(): number {
return this.property('blurRadius').toDouble();
}
setColor(color: QColor): void {
this.setProperty('color', color.native);
}
color(): QColor {
return QColor.fromQVariant(this.property('color'));
}
setXOffset(dx: number): void {
this.setProperty('xOffset', dx);
}
xOffset(): number {
return this.property('xOffset').toDouble();
}
setYOffset(dy: number): void {
this.setProperty('yOffset', dy);
}
yOffset(): number {
return this.property('yOffset').toDouble();
}
}
export interface QGraphicsDropShadowEffectSignals extends QGraphicsEffectSignals {
blurRadiusChanged: (blurRadius: number) => void;
}