Added orientation support for QProgressBar
This commit is contained in:
parent
7d07068f3e
commit
6d64f7ae15
@ -14,6 +14,7 @@ Napi::Object QProgressBarWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
InstanceMethod("setValue", &QProgressBarWrap::setValue),
|
||||
InstanceMethod("setMaximum", &QProgressBarWrap::setMaximum),
|
||||
InstanceMethod("setMinimum", &QProgressBarWrap::setMinimum),
|
||||
InstanceMethod("setOrientation", &QProgressBarWrap::setOrientation),
|
||||
InstanceMethod("value", &QProgressBarWrap::value),
|
||||
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QProgressBarWrap)
|
||||
});
|
||||
@ -71,6 +72,14 @@ Napi::Value QProgressBarWrap::setMinimum(const Napi::CallbackInfo& info) {
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QProgressBarWrap::setOrientation(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
Napi::Number value = info[0].As<Napi::Number>();
|
||||
this->instance->setOrientation(static_cast<Qt::Orientation>(value.Int32Value()));
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QProgressBarWrap::value(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
@ -18,6 +18,7 @@ class QProgressBarWrap : public Napi::ObjectWrap<QProgressBarWrap>{
|
||||
Napi::Value setValue(const Napi::CallbackInfo& info);
|
||||
Napi::Value setMaximum(const Napi::CallbackInfo& info);
|
||||
Napi::Value setMinimum(const Napi::CallbackInfo& info);
|
||||
Napi::Value setOrientation(const Napi::CallbackInfo& info);
|
||||
Napi::Value value(const Napi::CallbackInfo& info);
|
||||
|
||||
QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
|
||||
@ -124,3 +124,8 @@ export enum WidgetAttribute {
|
||||
WA_AlwaysStackOnTop = 128,
|
||||
WA_ContentsMarginsRespectsSafeArea = 13
|
||||
}
|
||||
|
||||
export enum Orientation {
|
||||
Horizontal = 1,
|
||||
Vertical = 2
|
||||
}
|
||||
@ -2,6 +2,7 @@ import addon from "../../core/addon";
|
||||
import { NodeWidget } from "../../QtGui/QWidget";
|
||||
import { BaseWidgetEvents } from "../../core/EventWidget";
|
||||
import { NativeElement } from "../../core/Component";
|
||||
import { Orientation } from "../../QtEnums";
|
||||
|
||||
export const QProgressBarEvents = Object.freeze({
|
||||
...BaseWidgetEvents
|
||||
@ -22,6 +23,7 @@ export class QProgressBar extends NodeWidget {
|
||||
this.setValue.bind(this);
|
||||
this.setMinimum.bind(this);
|
||||
this.setMaximum.bind(this);
|
||||
this.setOrientation.bind(this);
|
||||
this.value.bind(this);
|
||||
}
|
||||
setValue(value: number) {
|
||||
@ -33,6 +35,9 @@ export class QProgressBar extends NodeWidget {
|
||||
setMaximum(max: number) {
|
||||
this.native.setMaximum(max);
|
||||
}
|
||||
setOrientation(orientation: Orientation) {
|
||||
this.native.setOrientation(orientation);
|
||||
}
|
||||
value(): number {
|
||||
return this.native.value();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user