Compare commits
11 Commits
v0.58.0-rc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f41edc2ea4 | ||
|
|
30ab4442cf | ||
|
|
90e556be6e | ||
|
|
e9ff6a93fb | ||
|
|
5879ad7ec4 | ||
|
|
731d186b01 | ||
|
|
47d98500cf | ||
|
|
2561fd92f9 | ||
|
|
9129cdef0d | ||
|
|
613ee337aa | ||
|
|
bd6595e40a |
@ -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"
|
||||||
|
|||||||
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@nodegui/nodegui",
|
"name": "@nodegui/nodegui",
|
||||||
"version": "0.58.0-rc1",
|
"version": "0.59.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@nodegui/nodegui",
|
"name": "@nodegui/nodegui",
|
||||||
"version": "0.58.0-rc1",
|
"version": "0.59.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nodegui/artifact-installer": "^1.1.0",
|
"@nodegui/artifact-installer": "^1.1.0",
|
||||||
"@nodegui/qode": "^18.12.1-rc1",
|
"@nodegui/qode": "^18.12.1",
|
||||||
"cmake-js": "^6.2.1",
|
"cmake-js": "^6.2.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cuid": "^2.1.8",
|
"cuid": "^2.1.8",
|
||||||
@ -1134,9 +1134,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nodegui/qode": {
|
"node_modules/@nodegui/qode": {
|
||||||
"version": "18.12.1-rc1",
|
"version": "18.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-18.12.1-rc1.tgz",
|
"resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-18.12.1.tgz",
|
||||||
"integrity": "sha512-Bb0CnZJIIOh+KMnoJiiYwBHOdEPL67bLj/3yKFwms0zCuAOzFl07KxMRKALoyoMKvzY/QzQv3/531nSirWyBfw==",
|
"integrity": "sha512-iJdNwMPif+NkbZeXQPek6IfKmmHt04Iy1dlRGVFaICU5nSpNDsSmzGxHrVdllQWGGzqvre82BOV3CgMxclGZtQ==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"env-paths": "^2.2.1",
|
"env-paths": "^2.2.1",
|
||||||
@ -6833,9 +6833,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@nodegui/qode": {
|
"@nodegui/qode": {
|
||||||
"version": "18.12.1-rc1",
|
"version": "18.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-18.12.1-rc1.tgz",
|
"resolved": "https://registry.npmjs.org/@nodegui/qode/-/qode-18.12.1.tgz",
|
||||||
"integrity": "sha512-Bb0CnZJIIOh+KMnoJiiYwBHOdEPL67bLj/3yKFwms0zCuAOzFl07KxMRKALoyoMKvzY/QzQv3/531nSirWyBfw==",
|
"integrity": "sha512-iJdNwMPif+NkbZeXQPek6IfKmmHt04Iy1dlRGVFaICU5nSpNDsSmzGxHrVdllQWGGzqvre82BOV3CgMxclGZtQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"env-paths": "^2.2.1",
|
"env-paths": "^2.2.1",
|
||||||
"make-dir": "^3.1.0",
|
"make-dir": "^3.1.0",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nodegui/nodegui",
|
"name": "@nodegui/nodegui",
|
||||||
"version": "0.58.0-rc4",
|
"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",
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"engineStrict": false,
|
"engineStrict": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nodegui/artifact-installer": "^1.1.0",
|
"@nodegui/artifact-installer": "^1.1.0",
|
||||||
"@nodegui/qode": "^18.12.1-rc1",
|
"@nodegui/qode": "^18.12.1",
|
||||||
"cmake-js": "^6.2.1",
|
"cmake-js": "^6.2.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cuid": "^2.1.8",
|
"cuid": "^2.1.8",
|
||||||
|
|||||||
@ -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);
|
||||||
|
};
|
||||||
@ -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);
|
||||||
|
};
|
||||||
@ -80,4 +80,8 @@ class DLL_EXPORT QTableWidgetWrap : public Napi::ObjectWrap<QTableWidgetWrap> {
|
|||||||
Napi::Value setRowCount(const Napi::CallbackInfo& info);
|
Napi::Value setRowCount(const Napi::CallbackInfo& info);
|
||||||
Napi::Value setSortingEnabled(const Napi::CallbackInfo& info);
|
Napi::Value setSortingEnabled(const Napi::CallbackInfo& info);
|
||||||
Napi::Value isSortingEnabled(const Napi::CallbackInfo& info);
|
Napi::Value isSortingEnabled(const Napi::CallbackInfo& info);
|
||||||
|
Napi::Value clearSelection(const Napi::CallbackInfo& info);
|
||||||
|
Napi::Value selectAll(const Napi::CallbackInfo& info);
|
||||||
|
Napi::Value scrollToBottom(const Napi::CallbackInfo& info);
|
||||||
|
Napi::Value scrollToTop(const Napi::CallbackInfo& info);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
@ -82,6 +82,10 @@ Napi::Object QTableWidgetWrap::init(Napi::Env env, Napi::Object exports) {
|
|||||||
InstanceMethod("visualColumn", &QTableWidgetWrap::visualColumn),
|
InstanceMethod("visualColumn", &QTableWidgetWrap::visualColumn),
|
||||||
InstanceMethod("visualItemRect", &QTableWidgetWrap::visualItemRect),
|
InstanceMethod("visualItemRect", &QTableWidgetWrap::visualItemRect),
|
||||||
InstanceMethod("visualRow", &QTableWidgetWrap::visualRow),
|
InstanceMethod("visualRow", &QTableWidgetWrap::visualRow),
|
||||||
|
InstanceMethod("clearSelection", &QTableWidgetWrap::clearSelection),
|
||||||
|
InstanceMethod("selectAll", &QTableWidgetWrap::selectAll),
|
||||||
|
InstanceMethod("scrollToBottom", &QTableWidgetWrap::scrollToBottom),
|
||||||
|
InstanceMethod("scrollToTop", &QTableWidgetWrap::scrollToTop),
|
||||||
|
|
||||||
QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(QTableWidgetWrap)});
|
QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE(QTableWidgetWrap)});
|
||||||
constructor = Napi::Persistent(func);
|
constructor = Napi::Persistent(func);
|
||||||
@ -647,3 +651,27 @@ Napi::Value QTableWidgetWrap::isSortingEnabled(const Napi::CallbackInfo& info) {
|
|||||||
bool enabled = this->instance->isSortingEnabled();
|
bool enabled = this->instance->isSortingEnabled();
|
||||||
return Napi::Boolean::New(env, enabled);
|
return Napi::Boolean::New(env, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Napi::Value QTableWidgetWrap::clearSelection(const Napi::CallbackInfo& info) {
|
||||||
|
Napi::Env env = info.Env();
|
||||||
|
this->instance->clearSelection();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
Napi::Value QTableWidgetWrap::selectAll(const Napi::CallbackInfo& info) {
|
||||||
|
Napi::Env env = info.Env();
|
||||||
|
this->instance->clearSelection();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
Napi::Value QTableWidgetWrap::scrollToBottom(const Napi::CallbackInfo& info) {
|
||||||
|
Napi::Env env = info.Env();
|
||||||
|
this->instance->scrollToBottom();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|
||||||
|
Napi::Value QTableWidgetWrap::scrollToTop(const Napi::CallbackInfo& info) {
|
||||||
|
Napi::Env env = info.Env();
|
||||||
|
this->instance->scrollToTop();
|
||||||
|
return env.Null();
|
||||||
|
}
|
||||||
|
|||||||
@ -19,7 +19,6 @@ int QtRunLoopWrapper() {
|
|||||||
void integrate() {
|
void integrate() {
|
||||||
// Bootstrap Qt
|
// Bootstrap Qt
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
app = new NApplication(qode::qode_argc, qode::qode_argv);
|
app = new NApplication(qode::qode_argc, qode::qode_argv);
|
||||||
qode::InjectCustomRunLoop(&QtRunLoopWrapper);
|
qode::InjectCustomRunLoop(&QtRunLoopWrapper);
|
||||||
// Other init settings
|
// Other init settings
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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';
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
|
|||||||
@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/lib/QtGui/QEvent/QInputMethodEvent.ts
Normal file
24
src/lib/QtGui/QEvent/QInputMethodEvent.ts
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/lib/QtGui/QEvent/QInputMethodQueryEvent.ts
Normal file
28
src/lib/QtGui/QEvent/QInputMethodQueryEvent.ts
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -238,6 +238,18 @@ export class QTableWidget extends QAbstractScrollArea<QTableWidgetSignals> {
|
|||||||
isSortingEnabled(): boolean {
|
isSortingEnabled(): boolean {
|
||||||
return this.native.isSortingEnabled();
|
return this.native.isSortingEnabled();
|
||||||
}
|
}
|
||||||
|
selectAll(): void {
|
||||||
|
this.native.selectAll();
|
||||||
|
}
|
||||||
|
clearSelection(): void {
|
||||||
|
this.native.clearSelection();
|
||||||
|
}
|
||||||
|
scrollToTop(): void {
|
||||||
|
this.native.scrollToTop();
|
||||||
|
}
|
||||||
|
scrollToBottom(): void {
|
||||||
|
this.native.scrollToBottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wrapperCache.registerWrapper('QTableWidgetWrap', QTableWidget);
|
wrapperCache.registerWrapper('QTableWidgetWrap', QTableWidget);
|
||||||
|
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user