Added setFocus to QWidget (nodegui#661) (#669)
This commit is contained in:
parent
5c368b66e4
commit
979989e166
@ -432,6 +432,13 @@
|
||||
bool v = info[0].As<Napi::Boolean>().Value(); \
|
||||
this->instance->setAcceptDrops(v); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value setFocus(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
int reason = info[0].As<Napi::Number>().Int32Value(); \
|
||||
this->instance->setFocus(static_cast<Qt::FocusReason>(reason)); \
|
||||
return env.Null(); \
|
||||
}
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_DECLARATION
|
||||
@ -493,7 +500,8 @@
|
||||
InstanceMethod("repolish", &WidgetWrapName::repolish), \
|
||||
InstanceMethod("setGraphicsEffect", &WidgetWrapName::setGraphicsEffect), \
|
||||
InstanceMethod("acceptDrops", &WidgetWrapName::acceptDrops), \
|
||||
InstanceMethod("setAcceptDrops", &WidgetWrapName::setAcceptDrops),
|
||||
InstanceMethod("setAcceptDrops", &WidgetWrapName::setAcceptDrops), \
|
||||
InstanceMethod("setFocus", &WidgetWrapName::setFocus),
|
||||
|
||||
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import addon from '../utils/addon';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { FlexLayout } from '../core/FlexLayout';
|
||||
import { WidgetAttribute, WindowType, ContextMenuPolicy } from '../QtEnums';
|
||||
import { WidgetAttribute, WindowType, ContextMenuPolicy, FocusReason } from '../QtEnums';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QCursor } from '../QtGui/QCursor';
|
||||
import { CursorShape, WindowState } from '../QtEnums';
|
||||
@ -277,6 +277,9 @@ export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWid
|
||||
acceptDrops(): boolean {
|
||||
return this.native.acceptDrops();
|
||||
}
|
||||
setFocus(reason: FocusReason): void {
|
||||
this.native.setFocus(reason);
|
||||
}
|
||||
}
|
||||
|
||||
export interface QWidgetSignals extends QObjectSignals {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user