Compare commits

..

7 Commits

Author SHA1 Message Date
Simon Edwards
f41edc2ea4 Bump the version 2023-03-07 22:48:15 +01:00
Simon Edwards
30ab4442cf
Merge pull request #999 from nodegui/input_methods
Add Input Method classes and support
2023-03-07 21:50:32 +01:00
Simon Edwards
90e556be6e Code formatting 2023-03-06 20:02:23 +01:00
Simon Edwards
e9ff6a93fb Improve docs for QInputMethodQueryEvent; extract nativeObjectFromVariantType() 2023-03-06 20:01:35 +01:00
Simon Edwards
5879ad7ec4 Use better types inside QInputMethodQueryEvent binding 2023-03-05 16:49:43 +01:00
Simon Edwards
731d186b01 Add QWidget.updateMicroFocus() method 2023-03-05 16:49:37 +01:00
Simon Edwards
47d98500cf Add Input Method classes and support 2023-03-04 10:29:55 +01:00
17 changed files with 338 additions and 11 deletions

View File

@ -62,6 +62,8 @@ add_library(${CORE_WIDGETS_ADDON} SHARED
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QDragMoveEvent/qdragmoveevent_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QDragMoveEvent/qdragmoveevent_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QDragLeaveEvent/qdragleaveevent_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QDragLeaveEvent/qdragleaveevent_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QResizeEvent/qresizeevent_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QResizeEvent/qresizeevent_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QInputMethodEvent/qinputmethodevent_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QEvent/QInputMethodQueryEvent/qinputmethodqueryevent_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QFontDatabase/qfontdatabase_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QFontDatabase/qfontdatabase_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QFontMetrics/qfontmetrics_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QFontMetrics/qfontmetrics_wrap.cpp"
"${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QFontMetricsF/qfontmetricsf_wrap.cpp" "${PROJECT_SOURCE_DIR}/src/cpp/lib/QtGui/QFontMetricsF/qfontmetricsf_wrap.cpp"

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@nodegui/nodegui", "name": "@nodegui/nodegui",
"version": "0.58.0", "version": "0.59.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@nodegui/nodegui", "name": "@nodegui/nodegui",
"version": "0.58.0", "version": "0.59.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@nodegui/nodegui", "name": "@nodegui/nodegui",
"version": "0.58.0", "version": "0.59.0",
"description": "A cross-platform library to build native desktop apps.", "description": "A cross-platform library to build native desktop apps.",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",

View File

@ -0,0 +1,32 @@
#pragma once
#include <napi.h>
#include <QInputMethodEvent>
#include "Extras/Export/export.h"
#include "QtGui/QEvent/QEvent/qevent_macro.h"
#include "core/Component/component_macro.h"
class DLL_EXPORT QInputMethodEventWrap
: public Napi::ObjectWrap<QInputMethodEventWrap> {
COMPONENT_WRAPPED_METHODS_DECLARATION
QEVENT_WRAPPED_METHODS_DECLARATION
private:
QInputMethodEvent* instance;
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
QInputMethodEventWrap(const Napi::CallbackInfo& info);
~QInputMethodEventWrap();
QInputMethodEvent* getInternalInstance();
// class constructor
static Napi::FunctionReference constructor;
// wrapped methods
Napi::Value commitString(const Napi::CallbackInfo& info);
Napi::Value preeditString(const Napi::CallbackInfo& info);
Napi::Value replacementLength(const Napi::CallbackInfo& info);
Napi::Value replacementStart(const Napi::CallbackInfo& info);
Napi::Value setCommitString(const Napi::CallbackInfo& info);
};

View File

@ -0,0 +1,30 @@
#pragma once
#include <napi.h>
#include <QInputMethodQueryEvent>
#include "Extras/Export/export.h"
#include "QtGui/QEvent/QEvent/qevent_macro.h"
#include "core/Component/component_macro.h"
class DLL_EXPORT QInputMethodQueryEventWrap
: public Napi::ObjectWrap<QInputMethodQueryEventWrap> {
COMPONENT_WRAPPED_METHODS_DECLARATION
QEVENT_WRAPPED_METHODS_DECLARATION
private:
QInputMethodQueryEvent* instance;
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
QInputMethodQueryEventWrap(const Napi::CallbackInfo& info);
~QInputMethodQueryEventWrap();
QInputMethodQueryEvent* getInternalInstance();
// class constructor
static Napi::FunctionReference constructor;
// wrapped methods
Napi::Value queries(const Napi::CallbackInfo& info);
Napi::Value setValue(const Napi::CallbackInfo& info);
Napi::Value value(const Napi::CallbackInfo& info);
};

View File

@ -23,4 +23,8 @@ class DLL_EXPORT NWidget : public QWidget, public NodeWidget {
} }
virtual void connectSignalsToEventEmitter() { QWIDGET_SIGNALS } virtual void connectSignalsToEventEmitter() { QWIDGET_SIGNALS }
void _protected_updateMicroFocus(Qt::InputMethodQuery query) {
updateMicroFocus(query);
}
}; };

View File

@ -765,6 +765,16 @@
Napi::Env env = info.Env(); \ Napi::Env env = info.Env(); \
int result = this->instance->widthMM(); \ int result = this->instance->widthMM(); \
return Napi::Number::New(env, result); \ return Napi::Number::New(env, result); \
} \
Napi::Value updateMicroFocus(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \
NWidget* nwidget = dynamic_cast<NWidget*>(this->instance.data()); \
if (nwidget) { \
Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>( \
info[0].As<Napi::Number>().Int32Value()); \
nwidget->_protected_updateMicroFocus(query); \
} \
return env.Null(); \
} }
#endif // QWIDGET_WRAPPED_METHODS_DECLARATION #endif // QWIDGET_WRAPPED_METHODS_DECLARATION
@ -884,7 +894,8 @@
InstanceMethod("paintingActive", &WidgetWrapName::paintingActive), \ InstanceMethod("paintingActive", &WidgetWrapName::paintingActive), \
InstanceMethod("physicalDpiX", &WidgetWrapName::physicalDpiX), \ InstanceMethod("physicalDpiX", &WidgetWrapName::physicalDpiX), \
InstanceMethod("physicalDpiY", &WidgetWrapName::physicalDpiY), \ InstanceMethod("physicalDpiY", &WidgetWrapName::physicalDpiY), \
InstanceMethod("widthMM", &WidgetWrapName::widthMM), InstanceMethod("widthMM", &WidgetWrapName::widthMM), \
InstanceMethod("updateMicroFocus", &WidgetWrapName::updateMicroFocus),
#endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE #endif // QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE

View File

@ -0,0 +1,90 @@
#include "QtGui/QEvent/QInputMethodEvent/qinputmethodevent_wrap.h"
#include <QString>
#include "Extras/Utils/nutils.h"
Napi::FunctionReference QInputMethodEventWrap::constructor;
Napi::Object QInputMethodEventWrap::init(Napi::Env env, Napi::Object exports) {
Napi::HandleScope scope(env);
char CLASSNAME[] = "QInputMethodEvent";
Napi::Function func = DefineClass(
env, CLASSNAME,
{InstanceMethod("commitString", &QInputMethodEventWrap::commitString),
InstanceMethod("preeditString", &QInputMethodEventWrap::preeditString),
InstanceMethod("replacementLength",
&QInputMethodEventWrap::replacementLength),
InstanceMethod("replacementStart",
&QInputMethodEventWrap::replacementStart),
InstanceMethod("setCommitString",
&QInputMethodEventWrap::setCommitString),
COMPONENT_WRAPPED_METHODS_EXPORT_DEFINE(QInputMethodEventWrap)
QEVENT_WRAPPED_METHODS_EXPORT_DEFINE(QInputMethodEventWrap)});
constructor = Napi::Persistent(func);
exports.Set(CLASSNAME, func);
return exports;
}
QInputMethodEvent* QInputMethodEventWrap::getInternalInstance() {
return this->instance;
}
QInputMethodEventWrap::QInputMethodEventWrap(const Napi::CallbackInfo& info)
: Napi::ObjectWrap<QInputMethodEventWrap>(info) {
Napi::Env env = info.Env();
if (info.Length() == 1) {
Napi::External<QInputMethodEvent> eventObject =
info[0].As<Napi::External<QInputMethodEvent>>();
this->instance = static_cast<QInputMethodEvent*>(eventObject.Data());
} else {
Napi::TypeError::New(env, "Wrong number of arguments")
.ThrowAsJavaScriptException();
}
this->rawData = extrautils::configureComponent(this->getInternalInstance());
}
QInputMethodEventWrap::~QInputMethodEventWrap() {
// Do not destroy instance here. It will be done by Qt Event loop.
}
Napi::Value QInputMethodEventWrap::setCommitString(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
Napi::String setCommitString = info[0].As<Napi::String>();
int replaceFrom = info[1].As<Napi::Number>().Int32Value();
int replaceLength = info[2].As<Napi::Number>().Int32Value();
this->instance->setCommitString(
QString::fromStdString(setCommitString.Utf8Value()), replaceFrom,
replaceLength);
return env.Null();
}
Napi::Value QInputMethodEventWrap::commitString(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
QString commitString = this->instance->commitString();
return Napi::Value::From(env, commitString.toStdString());
}
Napi::Value QInputMethodEventWrap::preeditString(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
QString preeditString = this->instance->preeditString();
return Napi::Value::From(env, preeditString.toStdString());
}
Napi::Value QInputMethodEventWrap::replacementLength(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
int x = this->instance->replacementLength();
return Napi::Number::From(env, x);
}
Napi::Value QInputMethodEventWrap::replacementStart(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
int x = this->instance->replacementStart();
return Napi::Number::From(env, x);
}

View File

@ -0,0 +1,79 @@
#include "QtGui/QEvent/QInputMethodQueryEvent/qinputmethodqueryevent_wrap.h"
#include <QString>
#include "Extras/Utils/nutils.h"
#include "QtCore/QVariant/qvariant_wrap.h"
Napi::FunctionReference QInputMethodQueryEventWrap::constructor;
Napi::Object QInputMethodQueryEventWrap::init(Napi::Env env,
Napi::Object exports) {
Napi::HandleScope scope(env);
char CLASSNAME[] = "QInputMethodQueryEvent";
Napi::Function func = DefineClass(
env, CLASSNAME,
{InstanceMethod("queries", &QInputMethodQueryEventWrap::queries),
InstanceMethod("setValue", &QInputMethodQueryEventWrap::setValue),
InstanceMethod("value", &QInputMethodQueryEventWrap::value),
COMPONENT_WRAPPED_METHODS_EXPORT_DEFINE(QInputMethodQueryEventWrap)
QEVENT_WRAPPED_METHODS_EXPORT_DEFINE(QInputMethodQueryEventWrap)});
constructor = Napi::Persistent(func);
exports.Set(CLASSNAME, func);
return exports;
}
QInputMethodQueryEvent* QInputMethodQueryEventWrap::getInternalInstance() {
return this->instance;
}
QInputMethodQueryEventWrap::QInputMethodQueryEventWrap(
const Napi::CallbackInfo& info)
: Napi::ObjectWrap<QInputMethodQueryEventWrap>(info) {
Napi::Env env = info.Env();
if (info.Length() == 1) {
Napi::External<QInputMethodQueryEvent> eventObject =
info[0].As<Napi::External<QInputMethodQueryEvent>>();
this->instance = static_cast<QInputMethodQueryEvent*>(eventObject.Data());
} else {
Napi::TypeError::New(env, "Wrong number of arguments")
.ThrowAsJavaScriptException();
}
this->rawData = extrautils::configureComponent(this->getInternalInstance());
}
QInputMethodQueryEventWrap::~QInputMethodQueryEventWrap() {
// Do not destroy instance here. It will be done by Qt Event loop.
}
Napi::Value QInputMethodQueryEventWrap::queries(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
Qt::InputMethodQueries queries = this->instance->queries();
return Napi::Number::From(env, queries.toInt());
}
Napi::Value QInputMethodQueryEventWrap::setValue(
const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(
info[0].As<Napi::Number>().Int32Value());
Napi::Value value = info[1];
QVariant* valueVariant = extrautils::convertToQVariant(env, value);
this->instance->setValue(query, *valueVariant);
delete valueVariant;
return env.Null();
}
Napi::Value QInputMethodQueryEventWrap::value(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
Qt::InputMethodQuery query = static_cast<Qt::InputMethodQuery>(
info[0].As<Napi::Number>().Int32Value());
QVariant value = this->instance->value(query);
auto instance = QVariantWrap::constructor.New(
{Napi::External<QVariant>::New(env, new QVariant(value))});
return instance;
}

View File

@ -84,8 +84,8 @@ Napi::Object QTableWidgetWrap::init(Napi::Env env, Napi::Object exports) {
InstanceMethod("visualRow", &QTableWidgetWrap::visualRow), InstanceMethod("visualRow", &QTableWidgetWrap::visualRow),
InstanceMethod("clearSelection", &QTableWidgetWrap::clearSelection), InstanceMethod("clearSelection", &QTableWidgetWrap::clearSelection),
InstanceMethod("selectAll", &QTableWidgetWrap::selectAll), InstanceMethod("selectAll", &QTableWidgetWrap::selectAll),
InstanceMethod("scrollToBottom", &QTableWidgetWrap::scrollToBottom), InstanceMethod("scrollToBottom", &QTableWidgetWrap::scrollToBottom),
InstanceMethod("scrollToTop", &QTableWidgetWrap::scrollToTop), InstanceMethod("scrollToTop", &QTableWidgetWrap::scrollToTop),
QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(QTableWidgetWrap)}); QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(QTableWidgetWrap)});
constructor = Napi::Persistent(func); constructor = Napi::Persistent(func);

View File

@ -27,6 +27,8 @@
#include "QtGui/QEvent/QDragLeaveEvent/qdragleaveevent_wrap.h" #include "QtGui/QEvent/QDragLeaveEvent/qdragleaveevent_wrap.h"
#include "QtGui/QEvent/QDragMoveEvent/qdragmoveevent_wrap.h" #include "QtGui/QEvent/QDragMoveEvent/qdragmoveevent_wrap.h"
#include "QtGui/QEvent/QDropEvent/qdropevent_wrap.h" #include "QtGui/QEvent/QDropEvent/qdropevent_wrap.h"
#include "QtGui/QEvent/QInputMethodEvent/qinputmethodevent_wrap.h"
#include "QtGui/QEvent/QInputMethodQueryEvent/qinputmethodqueryevent_wrap.h"
#include "QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h" #include "QtGui/QEvent/QKeyEvent/qkeyevent_wrap.h"
#include "QtGui/QEvent/QMouseEvent/qmouseevent_wrap.h" #include "QtGui/QEvent/QMouseEvent/qmouseevent_wrap.h"
#include "QtGui/QEvent/QMoveEvent/qmoveevent_wrap.h" #include "QtGui/QEvent/QMoveEvent/qmoveevent_wrap.h"
@ -246,6 +248,8 @@ Napi::Object Main(Napi::Env env, Napi::Object exports) {
QResizeEventWrap::init(env, exports); QResizeEventWrap::init(env, exports);
QTimerEventWrap::init(env, exports); QTimerEventWrap::init(env, exports);
QAbstractItemDelegateWrap::init(env, exports); QAbstractItemDelegateWrap::init(env, exports);
QInputMethodEventWrap::init(env, exports);
QInputMethodQueryEventWrap::init(env, exports);
// Test // Test
CacheTestQObjectWrap::init(env, exports); CacheTestQObjectWrap::init(env, exports);

View File

@ -22,6 +22,8 @@ export { QFontDatabase, SystemFont, WritingSystem } from './lib/QtGui/QFontDatab
export { QFontMetrics } from './lib/QtGui/QFontMetrics'; export { QFontMetrics } from './lib/QtGui/QFontMetrics';
export { QFontMetricsF } from './lib/QtGui/QFontMetricsF'; export { QFontMetricsF } from './lib/QtGui/QFontMetricsF';
// Events: Maybe a separate module ? // Events: Maybe a separate module ?
export { QInputMethodEvent } from './lib/QtGui/QEvent/QInputMethodEvent';
export { QInputMethodQueryEvent } from './lib/QtGui/QEvent/QInputMethodQueryEvent';
export { QKeyEvent } from './lib/QtGui/QEvent/QKeyEvent'; export { QKeyEvent } from './lib/QtGui/QEvent/QKeyEvent';
export { QMouseEvent } from './lib/QtGui/QEvent/QMouseEvent'; export { QMouseEvent } from './lib/QtGui/QEvent/QMouseEvent';
export { QMoveEvent } from './lib/QtGui/QEvent/QMoveEvent'; export { QMoveEvent } from './lib/QtGui/QEvent/QMoveEvent';

View File

@ -1,8 +1,9 @@
import { NativeElement, Component } from '../core/Component'; import { NativeElement, Component } from '../core/Component';
import addon from '../utils/addon'; import addon from '../utils/addon';
import { checkIfNativeElement } from '../utils/helpers'; import { checkIfNativeElement } from '../utils/helpers';
import { QRect } from './QRect';
export type QVariantType = NativeElement | string | string[] | number | boolean; export type QVariantType = NativeElement | string | string[] | number | boolean | QRect;
export class QVariant extends Component { export class QVariant extends Component {
constructor(); constructor();
@ -35,3 +36,14 @@ export class QVariant extends Component {
return this.native.toStringList(); return this.native.toStringList();
} }
} }
/**
* Get the correct native object which should be passed down to the
* C++ wrapper from a QVariantType object.
*/
export function nativeObjectFromVariantType(obj: QVariantType): any {
if (obj instanceof QRect) {
return obj.native;
}
return obj;
}

View File

@ -1,6 +1,5 @@
export enum InputMethodQuery { export enum InputMethodQuery {
ImEnabled = 0x1, ImEnabled = 0x1,
ImMicroFocus = 0x2,
ImCursorRectangle = 0x2, ImCursorRectangle = 0x2,
ImFont = 0x4, ImFont = 0x4,
ImCursorPosition = 0x8, ImCursorPosition = 0x8,
@ -17,6 +16,7 @@ export enum InputMethodQuery {
ImEnterKeyType = 0x2000, ImEnterKeyType = 0x2000,
ImAnchorRectangle = 0x4000, ImAnchorRectangle = 0x4000,
ImInputItemClipRectangle = 0x8000, ImInputItemClipRectangle = 0x8000,
ImReadOnly = 0x10000,
//Masks: //Masks:
ImQueryAll = 0xffffffff, ImQueryAll = 0xffffffff,
} }

View File

@ -0,0 +1,24 @@
import addon from '../../utils/addon';
import { NativeRawPointer } from '../../core/Component';
import { QEvent } from './QEvent';
export class QInputMethodEvent extends QEvent {
constructor(event: NativeRawPointer<'QEvent'>) {
super(new addon.QInputMethodEvent(event));
}
commitString(): string {
return this.native.commitString();
}
preeditString(): string {
return this.native.preeditString();
}
replacementLength(): number {
return this.native.replacementLength();
}
replacementStart(): number {
return this.native.replacementStart();
}
setCommitString(commitString: string, replaceFrom = 0, replaceLength = 0): void {
this.native.setCommitString(commitString, replaceFrom, replaceLength);
}
}

View File

@ -0,0 +1,28 @@
import addon from '../../utils/addon';
import { NativeRawPointer } from '../../core/Component';
import { QVariant, QVariantType, nativeObjectFromVariantType } from '../../QtCore/QVariant';
import { QEvent } from './QEvent';
/**
* Note: Qt performs some default processing for `QInputMethodQueryEvents`.
* When attaching an event listener via `addEventListener()` use the
* options object to specify that you want to run after the default
* processing, otherwise your `setValue()` calls will be overwritten.
*/
export class QInputMethodQueryEvent extends QEvent {
constructor(event: NativeRawPointer<'QEvent'>) {
super(new addon.QInputMethodQueryEvent(event));
}
queries(): number /* InputMethodQueries */ {
return this.native.queries();
}
setValue(query: number /* InputMethodQuery */, value: QVariantType): void {
this.native.setValue(query, nativeObjectFromVariantType(value));
}
value(query: number /* InputMethodQuery */): QVariant {
return new QVariant(this.native.value(query));
}
}

View File

@ -2,7 +2,7 @@ import addon from '../utils/addon';
import { QLayout } from './QLayout'; import { QLayout } from './QLayout';
import { NativeElement } from '../core/Component'; import { NativeElement } from '../core/Component';
import { FlexLayout } from '../core/FlexLayout'; import { FlexLayout } from '../core/FlexLayout';
import { WidgetAttribute, WindowType, ContextMenuPolicy, FocusReason, FocusPolicy } from '../QtEnums'; import { WidgetAttribute, WindowType, ContextMenuPolicy, FocusReason, FocusPolicy, InputMethodQuery } from '../QtEnums';
import { QIcon } from '../QtGui/QIcon'; import { QIcon } from '../QtGui/QIcon';
import { QCursor } from '../QtGui/QCursor'; import { QCursor } from '../QtGui/QCursor';
import { CursorShape, WindowState } from '../QtEnums'; import { CursorShape, WindowState } from '../QtEnums';
@ -193,7 +193,9 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
heightForWidth(w: number): number { heightForWidth(w: number): number {
return this.native.heightForWidth(w); return this.native.heightForWidth(w);
} }
// TODO: Qt::InputMethodHints inputMethodHints() const inputMethodHints(): number {
return this.property('inputMethodHints').toInt();
}
// TODO: virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const // TODO: virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const
// TODO: void insertAction(QAction *before, QAction *action) // TODO: void insertAction(QAction *before, QAction *action)
// TODO: void insertActions(QAction *before, QList<QAction *> actions) // TODO: void insertActions(QAction *before, QList<QAction *> actions)
@ -396,7 +398,9 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
setGraphicsEffect(effect: QGraphicsEffect<any>): void { setGraphicsEffect(effect: QGraphicsEffect<any>): void {
this.native.setGraphicsEffect(effect.native); this.native.setGraphicsEffect(effect.native);
} }
// TODO: void setInputMethodHints(Qt::InputMethodHints hints) setInputMethodHints(hints: number): void {
this.setProperty('inputMethodHints', hints);
}
setInlineStyle(style: string, postprocess = true): void { setInlineStyle(style: string, postprocess = true): void {
if (postprocess) { if (postprocess) {
this._rawInlineStyle = style; this._rawInlineStyle = style;
@ -560,6 +564,11 @@ export class QWidget<Signals extends QWidgetSignals = QWidgetSignals> extends Yo
updatesEnabled(): boolean { updatesEnabled(): boolean {
return this.property('updatesEnabled').toBool(); return this.property('updatesEnabled').toBool();
} }
updateMicroFocus(query: number = InputMethodQuery.ImQueryAll): void {
this.native.updateMicroFocus(query);
}
// TODO: QRegion visibleRegion() const // TODO: QRegion visibleRegion() const
whatsThis(): string { whatsThis(): string {
return this.property('whatsThis').toString(); return this.property('whatsThis').toString();