commit
d6ba15df55
16
.github/workflows/latest.yml
vendored
16
.github/workflows/latest.yml
vendored
@ -7,7 +7,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-18.04]
|
||||
os: [ubuntu-20.04]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -15,9 +15,9 @@ jobs:
|
||||
with:
|
||||
node-version: '16.x'
|
||||
- name: Install deps
|
||||
run: yarn install --ignore-scripts
|
||||
run: npm install
|
||||
- name: Build nodegui
|
||||
run: npx tsc
|
||||
run: npm run build
|
||||
- name: Archive using npm pack
|
||||
run: npm --no-git-tag-version version 0.0.0-latest-master && npm pack
|
||||
- uses: actions/upload-artifact@v1
|
||||
@ -30,11 +30,11 @@ jobs:
|
||||
code: v0.0.0-latest-master
|
||||
name: Latest Master Release
|
||||
body: >
|
||||
Latest auto release corresponding to commit ${{github.sha}} 🔥.
|
||||
To install do:
|
||||
`yarn install https://github.com/nodegui/nodegui/releases/download/v0.0.0-latest-master/nodegui-master.tgz`
|
||||
or
|
||||
`yarn install http://master-release.nodegui.org`
|
||||
Latest auto release corresponding to commit ${{github.sha}} 🔥.
|
||||
To install do:
|
||||
`npm install https://github.com/nodegui/nodegui/releases/download/v0.0.0-latest-master/nodegui-master.tgz`
|
||||
or
|
||||
`npm install http://master-release.nodegui.org`
|
||||
assets: >
|
||||
nodegui-nodegui-0.0.0-latest-master.tgz:nodegui-master.tgz:application/tar+gzip
|
||||
recreate: true
|
||||
|
||||
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-18.04
|
||||
- os: ubuntu-20.04
|
||||
platform: linux
|
||||
arch: x64
|
||||
- os: windows-latest
|
||||
@ -30,8 +30,8 @@ jobs:
|
||||
node-version: '16.x'
|
||||
|
||||
- name: Install ubuntu deps
|
||||
if: contains(matrix.os, 'ubuntu-18.04')
|
||||
run: sudo apt install mesa-common-dev libglu1-mesa-dev
|
||||
if: contains(matrix.os, 'ubuntu-20.04')
|
||||
run: sudo apt install mesa-common-dev libglu1-mesa-dev libegl1
|
||||
|
||||
- name: Install deps
|
||||
run: npm install
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -6,7 +6,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-18.04, windows-latest, macos-latest]
|
||||
os: [ubuntu-20.04, windows-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -15,7 +15,7 @@ jobs:
|
||||
node-version: '16.x'
|
||||
- name: Install ubuntu deps
|
||||
if: contains(matrix.os, 'ubuntu')
|
||||
run: sudo apt install mesa-common-dev libglu1-mesa-dev
|
||||
run: sudo apt install mesa-common-dev libglu1-mesa-dev libegl1
|
||||
- name: Install deps
|
||||
run: npm install
|
||||
- name: Build nodegui
|
||||
|
||||
@ -271,8 +271,9 @@ endif()
|
||||
|
||||
target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE
|
||||
"${CMAKE_JS_LIB}"
|
||||
Qt5::Widgets
|
||||
Qt5::Core
|
||||
Qt5::Gui
|
||||
Qt5::Svg
|
||||
Qt6::Widgets
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Svg
|
||||
Qt6::SvgWidgets
|
||||
)
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
Build **performant**, **native** and **cross-platform** desktop applications with **Node.js** and **CSS like styling**.🚀
|
||||
|
||||
NodeGUI is powered by **Qt5** 💚 which makes it CPU and memory efficient as compared to other chromium based solutions like Electron.
|
||||
NodeGUI is powered by **Qt6** 💚 which makes it CPU and memory efficient as compared to other chromium based solutions like Electron.
|
||||
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1024px-React-icon.svg.png" alt="" width="25"> If you are looking for **React** based version, check out: **[React NodeGUI](https://github.com/nodegui/react-nodegui)**.
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ set(CMAKE_AUTOUIC ON)
|
||||
|
||||
set(QTCONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/qtConfig.js)
|
||||
|
||||
macro(AddQtSupport addonName)
|
||||
macro(AddQtSupport addonName)
|
||||
execute_process(COMMAND node -p "require('${QTCONFIG_FILE}').qtCmakeDir"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE QT_CMAKE_HOME_DIR
|
||||
@ -16,10 +16,10 @@ macro(AddQtSupport addonName)
|
||||
|
||||
string(REPLACE "\n" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")
|
||||
string(REPLACE "\"" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")
|
||||
|
||||
message(STATUS "Using QT installation for ${addonName} QT_CMAKE_HOME_DIR:${QT_CMAKE_HOME_DIR}")
|
||||
|
||||
set(Qt5_DIR ${QT_CMAKE_HOME_DIR})
|
||||
find_package(Qt5 COMPONENTS Widgets Gui Core Svg REQUIRED)
|
||||
|
||||
message(STATUS "Using Qt installation for ${addonName} QT_CMAKE_HOME_DIR:${QT_CMAKE_HOME_DIR}")
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH "${QT_CMAKE_HOME_DIR}/../../..")
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Gui Core Svg SvgWidgets)
|
||||
|
||||
endmacro(AddQtSupport addonName)
|
||||
|
||||
@ -3,7 +3,7 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const SETUP_DIR = path.resolve(__dirname, '..', 'miniqt');
|
||||
const QT_VERSION = '5.15.2';
|
||||
const QT_VERSION = '6.4.1';
|
||||
const MIRROR = Boolean(process.env.QT_LINK_MIRROR) ? process.env.QT_LINK_MIRROR : 'https://download.qt.io';
|
||||
|
||||
const checkIfExists = (fullPath) => {
|
||||
@ -13,41 +13,27 @@ const checkIfExists = (fullPath) => {
|
||||
function getMiniQtConfig() {
|
||||
switch (os.platform()) {
|
||||
case 'darwin': {
|
||||
if (os.arch() === 'arm64') {
|
||||
const qtHome = path.resolve(SETUP_DIR, 'Qt-5.15.3');
|
||||
return {
|
||||
qtHome,
|
||||
artifacts: [
|
||||
{
|
||||
name: 'Mini Qt Bundle',
|
||||
link: `https://github.com/nodegui/nodegui/releases/download/miniQtm1-5153/Qt-5.15.3.zip`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'plugins', 'platforms', 'libqcocoa.dylib')),
|
||||
},
|
||||
],
|
||||
};
|
||||
} else {
|
||||
const qtHome = path.resolve(SETUP_DIR, QT_VERSION, 'clang_64');
|
||||
return {
|
||||
qtHome,
|
||||
artifacts: [
|
||||
{
|
||||
name: 'Qt Base',
|
||||
link: `${MIRROR}/online/qtsdkrepository/mac_x64/desktop/qt5_5152/qt.qt5.5152.clang_64/5.15.2-0-202011130601qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'plugins', 'platforms', 'libqcocoa.dylib')),
|
||||
},
|
||||
{
|
||||
name: 'Qt Svg',
|
||||
link: `${MIRROR}/online/qtsdkrepository/mac_x64/desktop/qt5_5152/qt.qt5.5152.clang_64/5.15.2-0-202011130601qtsvg-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'QtSvg.framework', 'QtSvg')),
|
||||
},
|
||||
{
|
||||
name: 'Qt Tools',
|
||||
link: `${MIRROR}/online/qtsdkrepository/mac_x64/desktop/qt5_5152/qt.qt5.5152.clang_64/5.15.2-0-202011130601qttools-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'macdeployqt')),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
const qtHome = path.resolve(SETUP_DIR, QT_VERSION, 'macos');
|
||||
return {
|
||||
qtHome,
|
||||
artifacts: [
|
||||
{
|
||||
name: 'Qt Base',
|
||||
link: `${MIRROR}/online/qtsdkrepository/mac_x64/desktop/qt6_641/qt.qt6.641.clang_64/6.4.1-0-202211101256qtbase-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'plugins', 'platforms', 'libqcocoa.dylib')),
|
||||
},
|
||||
{
|
||||
name: 'Qt Svg',
|
||||
link: `${MIRROR}/online/qtsdkrepository/mac_x64/desktop/qt6_641/qt.qt6.641.clang_64/6.4.1-0-202211101256qtsvg-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'QtSvg.framework', 'QtSvg')),
|
||||
},
|
||||
{
|
||||
name: 'Qt Tools',
|
||||
link: `${MIRROR}/online/qtsdkrepository/mac_x64/desktop/qt6_641/qt.qt6.641.clang_64/6.4.1-0-202211101256qttools-MacOS-MacOS_12-Clang-MacOS-MacOS_12-X86_64-ARM64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'macdeployqt')),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
case 'win32': {
|
||||
const qtHome = path.resolve(SETUP_DIR, QT_VERSION, 'msvc2019_64');
|
||||
@ -56,17 +42,17 @@ function getMiniQtConfig() {
|
||||
artifacts: [
|
||||
{
|
||||
name: 'Qt Base',
|
||||
link: `${MIRROR}/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'Qt5Core.dll')),
|
||||
link: `${MIRROR}/online/qtsdkrepository/windows_x86/desktop/qt6_641/qt.qt6.641.win64_msvc2019_64/6.4.1-0-202211101254qtbase-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'Qt6Core.dll')),
|
||||
},
|
||||
{
|
||||
name: 'Qt SVG',
|
||||
link: `${MIRROR}/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qtsvg-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'Qt5Svg.dll')),
|
||||
link: `${MIRROR}/online/qtsdkrepository/windows_x86/desktop/qt6_641/qt.qt6.641.win64_msvc2019_64/6.4.1-0-202211101254qtsvg-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'Qt6Svg.dll')),
|
||||
},
|
||||
{
|
||||
name: 'Qt Tools',
|
||||
link: `${MIRROR}/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/5.15.2-0-202011130602qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z`,
|
||||
link: `${MIRROR}/online/qtsdkrepository/windows_x86/desktop/qt6_641/qt.qt6.641.win64_msvc2019_64/6.4.1-0-202211101254qttools-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'windeployqt.exe')),
|
||||
},
|
||||
],
|
||||
@ -79,17 +65,17 @@ function getMiniQtConfig() {
|
||||
artifacts: [
|
||||
{
|
||||
name: 'Qt Base',
|
||||
link: `${MIRROR}/online/qtsdkrepository/linux_x64/desktop/qt5_5152/qt.qt5.5152.gcc_64/5.15.2-0-202011130601qtbase-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64.7z`,
|
||||
link: `${MIRROR}/online/qtsdkrepository/linux_x64/desktop/qt6_641/qt.qt6.641.gcc_64/6.4.1-0-202211101305qtbase-Linux-RHEL_8_4-GCC-Linux-RHEL_8_4-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'moc')),
|
||||
},
|
||||
{
|
||||
name: 'Qt SVG',
|
||||
link: `${MIRROR}/online/qtsdkrepository/linux_x64/desktop/qt5_5152/qt.qt5.5152.gcc_64/5.15.2-0-202011130601qtsvg-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'libQt5Svg.so')),
|
||||
link: `${MIRROR}/online/qtsdkrepository/linux_x64/desktop/qt6_641/qt.qt6.641.gcc_64/6.4.1-0-202211101305qtsvg-Linux-RHEL_8_4-GCC-Linux-RHEL_8_4-X86_64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'libQt6Svg.so')),
|
||||
},
|
||||
{
|
||||
name: 'Qt ICU',
|
||||
link: `${MIRROR}/online/qtsdkrepository/linux_x64/desktop/qt5_5152/qt.qt5.5152.gcc_64/5.15.2-0-202011130601icu-linux-Rhel7.2-x64.7z`,
|
||||
link: `${MIRROR}/online/qtsdkrepository/linux_x64/desktop/qt6_641/qt.qt6.641.gcc_64/6.4.1-0-202211101305icu-linux-Rhel7.2-x64.7z`,
|
||||
skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'libicuuc.so')),
|
||||
},
|
||||
],
|
||||
@ -106,7 +92,7 @@ const miniQt = {
|
||||
|
||||
const useCustomQt = Boolean(process.env.QT_INSTALL_DIR);
|
||||
const qtHome = useCustomQt ? process.env.QT_INSTALL_DIR : miniQt.qtHome;
|
||||
const qtCmakeDir = path.resolve(qtHome, 'lib', 'cmake', 'Qt5');
|
||||
const qtCmakeDir = path.resolve(qtHome, 'lib', 'cmake', 'Qt6');
|
||||
|
||||
module.exports = {
|
||||
qtHome,
|
||||
|
||||
10483
package-lock.json
generated
Normal file
10483
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -22,7 +22,7 @@
|
||||
"build:addon": "cross-env CMAKE_BUILD_PARALLEL_LEVEL=8 cmake-js compile",
|
||||
"test": "node ./scripts/qode.js ./node_modules/jest/bin/jest -i",
|
||||
"lint:cpp": "clang-format -i --glob=src/cpp/**/*.[h,c]*",
|
||||
"lint:ts": "tsc --noEmit && eslint './src/**/*.{ts,tsx,js,jsx}' --fix",
|
||||
"lint:ts": "tsc --noEmit && eslint ./src --fix",
|
||||
"docs": "typedoc && node ./website/docs/scripts/fixdocs.js",
|
||||
"qode": "node ./scripts/qode.js",
|
||||
"prepublishOnly": "npm run build"
|
||||
@ -46,20 +46,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bindings": "^1.5.1",
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/jest": "29.2.4",
|
||||
"@types/node": "^16.4.13",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
||||
"@typescript-eslint/parser": "^4.29.0",
|
||||
"clang-format": "^1.5.0",
|
||||
"typedoc": "^0.17.8",
|
||||
"typedoc-plugin-markdown": "^2.4.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"husky": "^7.0.1",
|
||||
"jest": "^27.0.6",
|
||||
"jest": "29.3.1",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^27.0.4",
|
||||
"ts-jest": "29.0.3",
|
||||
"typedoc": "^0.17.8",
|
||||
"typedoc-plugin-markdown": "^2.4.2",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"binary": {
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
QWIDGET_WRAPPED_METHODS_DECLARATION \
|
||||
Napi::Value animateClick(const Napi::CallbackInfo& info) { \
|
||||
Napi::Env env = info.Env(); \
|
||||
int msec = info[0].As<Napi::Number>().Int32Value(); \
|
||||
this->instance->animateClick(msec); \
|
||||
this->instance->animateClick(); \
|
||||
return env.Null(); \
|
||||
} \
|
||||
Napi::Value click(const Napi::CallbackInfo& info) { \
|
||||
|
||||
@ -15,12 +15,30 @@ class DLL_EXPORT NButtonGroup : public QButtonGroup, public EventWidget {
|
||||
virtual void connectSignalsToEventEmitter() {
|
||||
QOBJECT_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
connect(this, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
||||
[=](int id) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "buttonClicked"),
|
||||
Napi::Number::New(env, id)});
|
||||
});
|
||||
connect(this, &QButtonGroup::idClicked, [=](int id) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call(
|
||||
{Napi::String::New(env, "idClicked"), Napi::Number::New(env, id)});
|
||||
});
|
||||
connect(this, &QButtonGroup::idPressed, [=](int id) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call(
|
||||
{Napi::String::New(env, "idPressed"), Napi::Number::New(env, id)});
|
||||
});
|
||||
connect(this, &QButtonGroup::idReleased, [=](int id) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call(
|
||||
{Napi::String::New(env, "idReleased"), Napi::Number::New(env, id)});
|
||||
});
|
||||
connect(this, &QButtonGroup::idToggled, [=](int id, bool checked) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "idToggled"),
|
||||
Napi::Number::New(env, id),
|
||||
Napi::Boolean::New(env, checked)});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -38,14 +38,13 @@ class DLL_EXPORT NTextBrowser : public QTextBrowser, public NodeWidget {
|
||||
this->emitOnNode.Call({Napi::String::New(env, "forwardAvailable"),
|
||||
Napi::Boolean::New(env, available)});
|
||||
});
|
||||
QObject::connect(
|
||||
this, QOverload<const QString&>::of(&QTextBrowser::highlighted),
|
||||
[=](const QString& link) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "highlighted"),
|
||||
Napi::String::New(env, link.toStdString())});
|
||||
});
|
||||
QObject::connect(this, &QTextBrowser::highlighted, [=](const QUrl& link) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call(
|
||||
{Napi::String::New(env, "highlighted"),
|
||||
Napi::String::New(env, link.toString().toStdString())});
|
||||
});
|
||||
QObject::connect(this, &QTextBrowser::historyChanged, [=]() {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
@ -16,7 +16,7 @@ class DLL_EXPORT NWidget : public QWidget, public NodeWidget {
|
||||
// https://doc.qt.io/qt-5/stylesheet-reference.html
|
||||
void paintEvent(QPaintEvent* e) override {
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
opt.initFrom(this);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
@ -71,10 +71,10 @@ QVariant* extrautils::convertToQVariant(Napi::Env& env, Napi::Value& value) {
|
||||
} else if (value.IsObject()) {
|
||||
Napi::Object object = value.As<Napi::Object>();
|
||||
std::string className = getNapiObjectClassName(object);
|
||||
int typeId = QMetaType::type(className.c_str());
|
||||
QMetaType type = QMetaType::fromName(className.c_str());
|
||||
ComponentWrap* componentWrap =
|
||||
Napi::ObjectWrap<ComponentWrap>::Unwrap(object);
|
||||
return new QVariant(typeId, componentWrap->rawData);
|
||||
return new QVariant(type, componentWrap->rawData);
|
||||
|
||||
} else if (value.IsFunction()) {
|
||||
return new QVariant();
|
||||
|
||||
@ -12,7 +12,6 @@ Napi::Object QTimeWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
env, CLASSNAME,
|
||||
{InstanceMethod("addMSecs", &QTimeWrap::addMSecs),
|
||||
InstanceMethod("addSecs", &QTimeWrap::addSecs),
|
||||
InstanceMethod("elapsed", &QTimeWrap::elapsed),
|
||||
InstanceMethod("hour", &QTimeWrap::hour),
|
||||
InstanceMethod("isNull", &QTimeWrap::isNull),
|
||||
InstanceMethod("isValid", &QTimeWrap::isValid),
|
||||
@ -20,11 +19,9 @@ Napi::Object QTimeWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
InstanceMethod("msec", &QTimeWrap::msec),
|
||||
InstanceMethod("msecsSinceStartOfDay", &QTimeWrap::msecsSinceStartOfDay),
|
||||
InstanceMethod("msecsTo", &QTimeWrap::msecsTo),
|
||||
InstanceMethod("restart", &QTimeWrap::restart),
|
||||
InstanceMethod("second", &QTimeWrap::second),
|
||||
InstanceMethod("secsTo", &QTimeWrap::secsTo),
|
||||
InstanceMethod("setHMS", &QTimeWrap::setHMS),
|
||||
InstanceMethod("start", &QTimeWrap::start),
|
||||
InstanceMethod("toString$", &QTimeWrap::toString),
|
||||
StaticMethod("currentTime", &StaticTimeWrapMethods::currentTime),
|
||||
StaticMethod("fromMSecsSinceStartOfDay",
|
||||
@ -81,11 +78,6 @@ Napi::Value QTimeWrap::addSecs(const Napi::CallbackInfo& info) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
Napi::Value QTimeWrap::elapsed(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
return Napi::Value::From(env, this->instance->elapsed());
|
||||
}
|
||||
|
||||
Napi::Value QTimeWrap::hour(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
return Napi::Value::From(env, this->instance->hour());
|
||||
@ -124,12 +116,6 @@ Napi::Value QTimeWrap::msecsTo(const Napi::CallbackInfo& info) {
|
||||
return Napi::Value::From(env, result);
|
||||
}
|
||||
|
||||
Napi::Value QTimeWrap::restart(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
int result = this->instance->restart();
|
||||
return Napi::Value::From(env, result);
|
||||
}
|
||||
|
||||
Napi::Value QTimeWrap::second(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
return Napi::Value::From(env, this->instance->second());
|
||||
@ -153,12 +139,6 @@ Napi::Value QTimeWrap::setHMS(const Napi::CallbackInfo& info) {
|
||||
return Napi::Value::From(env, result);
|
||||
}
|
||||
|
||||
Napi::Value QTimeWrap::start(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
this->instance->start();
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QTimeWrap::toString(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
QString result;
|
||||
|
||||
@ -141,13 +141,13 @@ Napi::Value QFontWrap::stretch(const Napi::CallbackInfo& info) {
|
||||
Napi::Value QFontWrap::setWeight(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
int weight = info[0].As<Napi::Number>().Int32Value();
|
||||
this->instance->setWeight(weight);
|
||||
this->instance->setWeight(static_cast<QFont::Weight>(weight));
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QFontWrap::weight(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
return Napi::Value::From(env, this->instance->weight());
|
||||
return Napi::Value::From(env, static_cast<int>(this->instance->weight()));
|
||||
}
|
||||
|
||||
Napi::Value QFontWrap::setItalic(const Napi::CallbackInfo& info) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#include "QtWidgets/QMainWindow/qmainwindow_wrap.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "Extras/Utils/nutils.h"
|
||||
#include "QtWidgets/QMenuBar/qmenubar_wrap.h"
|
||||
@ -21,7 +20,6 @@ Napi::Object QMainWindowWrap::init(Napi::Env env, Napi::Object exports) {
|
||||
InstanceMethod("setMenuBar", &QMainWindowWrap::setMenuBar),
|
||||
InstanceMethod("menuBar", &QMainWindowWrap::menuBar),
|
||||
InstanceMethod("setMenuWidget", &QMainWindowWrap::setMenuWidget),
|
||||
InstanceMethod("center", &QMainWindowWrap::center),
|
||||
InstanceMethod("setStatusBar", &QMainWindowWrap::setStatusBar),
|
||||
InstanceMethod("statusBar", &QMainWindowWrap::statusBar),
|
||||
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QMainWindowWrap)});
|
||||
@ -116,17 +114,6 @@ Napi::Value QMainWindowWrap::setMenuWidget(const Napi::CallbackInfo& info) {
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QMainWindowWrap::center(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
auto window = this->getInternalInstance();
|
||||
// https://wiki.qt.io/How_to_Center_a_Window_on_the_Screen
|
||||
window->setGeometry(
|
||||
QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, window->size(),
|
||||
QApplication::desktop()->availableGeometry(window)));
|
||||
|
||||
return env.Null();
|
||||
}
|
||||
|
||||
Napi::Value QMainWindowWrap::setStatusBar(const Napi::CallbackInfo& info) {
|
||||
Napi::Env env = info.Env();
|
||||
Napi::Object statusBarArg = info[0].As<Napi::Object>();
|
||||
|
||||
@ -50,7 +50,7 @@ std::unordered_map<std::string, int> NodeStyle::NodeWrap{
|
||||
|
||||
NodeValueUnit NodeStyle::parseMeasurement(QString rawValue) {
|
||||
float value = std::stof(rawValue.toStdString());
|
||||
if (rawValue.back() == "%") {
|
||||
if (rawValue.back() == '%') {
|
||||
return NodeValueUnit(value, YGUnitPercent);
|
||||
}
|
||||
return NodeValueUnit(value, YGUnitPoint);
|
||||
|
||||
@ -23,9 +23,6 @@ export class QTime extends Component {
|
||||
addSecs(s: number): QTime {
|
||||
return new QTime(this.native.addSecs(s));
|
||||
}
|
||||
elapsed(): number {
|
||||
return this.native.elapsed();
|
||||
}
|
||||
hour(): number {
|
||||
return this.native.hour();
|
||||
}
|
||||
@ -47,9 +44,6 @@ export class QTime extends Component {
|
||||
msecsTo(t: QTime): number {
|
||||
return this.native.msecsTo(t.native);
|
||||
}
|
||||
restart(): number {
|
||||
return this.native.restart();
|
||||
}
|
||||
second(): number {
|
||||
return this.native.second();
|
||||
}
|
||||
@ -59,9 +53,6 @@ export class QTime extends Component {
|
||||
setHMS(h: number, m: number, s: number, ms = 0): boolean {
|
||||
return this.native.setHMS(h, m, s, ms);
|
||||
}
|
||||
start(): void {
|
||||
this.native.start();
|
||||
}
|
||||
toString(format: string | DateFormat): string {
|
||||
return this.native.toString$(format);
|
||||
}
|
||||
|
||||
@ -100,13 +100,13 @@ export enum QFontCapitalization {
|
||||
Capitalize = 4,
|
||||
}
|
||||
export enum QFontWeight {
|
||||
Thin = 0,
|
||||
ExtraLight = 12,
|
||||
Light = 25,
|
||||
Normal = 50,
|
||||
Medium = 57,
|
||||
DemiBold = 63,
|
||||
Bold = 75,
|
||||
ExtraBold = 81,
|
||||
Black = 87,
|
||||
Thin = 100,
|
||||
ExtraLight = 200,
|
||||
Light = 300,
|
||||
Normal = 400,
|
||||
Medium = 500,
|
||||
DemiBold = 600,
|
||||
Bold = 700,
|
||||
ExtraBold = 800,
|
||||
Black = 900,
|
||||
}
|
||||
|
||||
@ -14,8 +14,8 @@ It is inherited by QCheckBox, QPushButton, QRadioButton, and QToolButton.
|
||||
|
||||
*/
|
||||
export abstract class QAbstractButton<Signals extends QAbstractButtonSignals> extends QWidget<Signals> {
|
||||
animateClick(msec: number): void {
|
||||
this.native.animateClick(msec);
|
||||
animateClick(): void {
|
||||
this.native.animateClick();
|
||||
}
|
||||
click(): void {
|
||||
this.native.click();
|
||||
|
||||
@ -7,7 +7,10 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { wrapperCache } from '../core/WrapperCache';
|
||||
|
||||
export interface QButtonGroupSignals extends QObjectSignals {
|
||||
buttonClicked: (id?: number) => void;
|
||||
idClicked: (id: number) => void;
|
||||
idPressed: (id: number) => void;
|
||||
idReleased: (id: number) => void;
|
||||
idToggled: (id: number, checked: boolean) => void;
|
||||
}
|
||||
|
||||
export class QButtonGroup extends QObject<any> {
|
||||
|
||||
@ -89,9 +89,6 @@ export class QMainWindow extends QWidget<QMainWindowSignals> {
|
||||
}
|
||||
return super.layout();
|
||||
}
|
||||
center(): void {
|
||||
this.native.center();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status bar for the main window to statusbar.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user