Upgrade to Qt 6.4.1

This commit is contained in:
Simon Edwards 2022-12-26 11:54:21 +01:00
parent 47083b4a86
commit bbb0951525
19 changed files with 117 additions and 117 deletions

View File

@ -271,8 +271,9 @@ endif()
target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE target_link_libraries(${CORE_WIDGETS_ADDON} PRIVATE
"${CMAKE_JS_LIB}" "${CMAKE_JS_LIB}"
Qt5::Widgets Qt6::Widgets
Qt5::Core Qt6::Core
Qt5::Gui Qt6::Gui
Qt5::Svg Qt6::Svg
Qt6::SvgWidgets
) )

View File

@ -7,7 +7,7 @@
Build **performant**, **native** and **cross-platform** desktop applications with **Node.js** and **CSS like styling**.🚀 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)**. <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)**.

View File

@ -17,9 +17,9 @@ macro(AddQtSupport addonName)
string(REPLACE "\n" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}") string(REPLACE "\n" "" QT_CMAKE_HOME_DIR "${QT_CMAKE_HOME_DIR}")
string(REPLACE "\"" "" 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}") message(STATUS "Using Qt installation for ${addonName} QT_CMAKE_HOME_DIR:${QT_CMAKE_HOME_DIR}")
set(Qt5_DIR ${QT_CMAKE_HOME_DIR}) list(APPEND CMAKE_PREFIX_PATH "${QT_CMAKE_HOME_DIR}/../../..")
find_package(Qt5 COMPONENTS Widgets Gui Core Svg REQUIRED) find_package(Qt6 REQUIRED COMPONENTS Widgets Gui Core Svg SvgWidgets)
endmacro(AddQtSupport addonName) endmacro(AddQtSupport addonName)

View File

@ -3,7 +3,7 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const SETUP_DIR = path.resolve(__dirname, '..', 'miniqt'); 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 MIRROR = Boolean(process.env.QT_LINK_MIRROR) ? process.env.QT_LINK_MIRROR : 'https://download.qt.io';
const checkIfExists = (fullPath) => { const checkIfExists = (fullPath) => {
@ -14,13 +14,13 @@ function getMiniQtConfig() {
switch (os.platform()) { switch (os.platform()) {
case 'darwin': { case 'darwin': {
if (os.arch() === 'arm64') { if (os.arch() === 'arm64') {
const qtHome = path.resolve(SETUP_DIR, 'Qt-5.15.3'); const qtHome = path.resolve(SETUP_DIR, 'Qt-6.4.1');
return { return {
qtHome, qtHome,
artifacts: [ artifacts: [
{ {
name: 'Mini Qt Bundle', name: 'Mini Qt Bundle',
link: `https://github.com/nodegui/nodegui/releases/download/miniQtm1-5153/Qt-5.15.3.zip`, link: `https://github.com/nodegui/nodegui/releases/download/miniQtm1-5153/Qt-6.4.1.zip`,
skipSetup: checkIfExists(path.resolve(qtHome, 'plugins', 'platforms', 'libqcocoa.dylib')), skipSetup: checkIfExists(path.resolve(qtHome, 'plugins', 'platforms', 'libqcocoa.dylib')),
}, },
], ],
@ -32,17 +32,17 @@ function getMiniQtConfig() {
artifacts: [ artifacts: [
{ {
name: 'Qt Base', 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`, 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')), skipSetup: checkIfExists(path.resolve(qtHome, 'plugins', 'platforms', 'libqcocoa.dylib')),
}, },
{ {
name: 'Qt Svg', 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`, 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')), skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'QtSvg.framework', 'QtSvg')),
}, },
{ {
name: 'Qt Tools', 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`, 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')), skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'macdeployqt')),
}, },
], ],
@ -56,17 +56,17 @@ function getMiniQtConfig() {
artifacts: [ artifacts: [
{ {
name: 'Qt Base', 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`, 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', 'Qt5Core.dll')), skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'Qt6Core.dll')),
}, },
{ {
name: 'Qt SVG', 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`, 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', 'Qt5Svg.dll')), skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'Qt6Svg.dll')),
}, },
{ {
name: 'Qt Tools', 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')), skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'windeployqt.exe')),
}, },
], ],
@ -79,17 +79,17 @@ function getMiniQtConfig() {
artifacts: [ artifacts: [
{ {
name: 'Qt Base', 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')), skipSetup: checkIfExists(path.resolve(qtHome, 'bin', 'moc')),
}, },
{ {
name: 'Qt SVG', 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`, 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', 'libQt5Svg.so')), skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'libQt6Svg.so')),
}, },
{ {
name: 'Qt ICU', 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')), skipSetup: checkIfExists(path.resolve(qtHome, 'lib', 'libicuuc.so')),
}, },
], ],
@ -106,7 +106,7 @@ const miniQt = {
const useCustomQt = Boolean(process.env.QT_INSTALL_DIR); const useCustomQt = Boolean(process.env.QT_INSTALL_DIR);
const qtHome = useCustomQt ? process.env.QT_INSTALL_DIR : miniQt.qtHome; 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 = { module.exports = {
qtHome, qtHome,

View File

@ -16,8 +16,7 @@
QWIDGET_WRAPPED_METHODS_DECLARATION \ QWIDGET_WRAPPED_METHODS_DECLARATION \
Napi::Value animateClick(const Napi::CallbackInfo& info) { \ Napi::Value animateClick(const Napi::CallbackInfo& info) { \
Napi::Env env = info.Env(); \ Napi::Env env = info.Env(); \
int msec = info[0].As<Napi::Number>().Int32Value(); \ this->instance->animateClick(); \
this->instance->animateClick(msec); \
return env.Null(); \ return env.Null(); \
} \ } \
Napi::Value click(const Napi::CallbackInfo& info) { \ Napi::Value click(const Napi::CallbackInfo& info) { \

View File

@ -15,12 +15,34 @@ class DLL_EXPORT NButtonGroup : public QButtonGroup, public EventWidget {
virtual void connectSignalsToEventEmitter() { virtual void connectSignalsToEventEmitter() {
QOBJECT_SIGNALS QOBJECT_SIGNALS
// Qt Connects: Implement all signal connects here // Qt Connects: Implement all signal connects here
connect(this, QOverload<int>::of(&QButtonGroup::buttonClicked), connect(this, &QButtonGroup::idClicked,
[=](int id) { [=](int id) {
Napi::Env env = this->emitOnNode.Env(); Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env); Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "buttonClicked"), this->emitOnNode.Call({Napi::String::New(env, "idClicked"),
Napi::Number::New(env, id)}); 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)});
});
} }
}; };

View File

@ -39,12 +39,12 @@ class DLL_EXPORT NTextBrowser : public QTextBrowser, public NodeWidget {
Napi::Boolean::New(env, available)}); Napi::Boolean::New(env, available)});
}); });
QObject::connect( QObject::connect(
this, QOverload<const QString&>::of(&QTextBrowser::highlighted), this, &QTextBrowser::highlighted,
[=](const QString& link) { [=](const QUrl& link) {
Napi::Env env = this->emitOnNode.Env(); Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env); Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "highlighted"), this->emitOnNode.Call({Napi::String::New(env, "highlighted"),
Napi::String::New(env, link.toStdString())}); Napi::String::New(env, link.toString().toStdString())});
}); });
QObject::connect(this, &QTextBrowser::historyChanged, [=]() { QObject::connect(this, &QTextBrowser::historyChanged, [=]() {
Napi::Env env = this->emitOnNode.Env(); Napi::Env env = this->emitOnNode.Env();

View File

@ -16,7 +16,7 @@ class DLL_EXPORT NWidget : public QWidget, public NodeWidget {
// https://doc.qt.io/qt-5/stylesheet-reference.html // https://doc.qt.io/qt-5/stylesheet-reference.html
void paintEvent(QPaintEvent* e) override { void paintEvent(QPaintEvent* e) override {
QStyleOption opt; QStyleOption opt;
opt.init(this); opt.initFrom(this);
QPainter p(this); QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(e); QWidget::paintEvent(e);

View File

@ -71,10 +71,10 @@ QVariant* extrautils::convertToQVariant(Napi::Env& env, Napi::Value& value) {
} else if (value.IsObject()) { } else if (value.IsObject()) {
Napi::Object object = value.As<Napi::Object>(); Napi::Object object = value.As<Napi::Object>();
std::string className = getNapiObjectClassName(object); std::string className = getNapiObjectClassName(object);
int typeId = QMetaType::type(className.c_str()); QMetaType type = QMetaType::fromName(className.c_str());
ComponentWrap* componentWrap = ComponentWrap* componentWrap =
Napi::ObjectWrap<ComponentWrap>::Unwrap(object); Napi::ObjectWrap<ComponentWrap>::Unwrap(object);
return new QVariant(typeId, componentWrap->rawData); return new QVariant(type, componentWrap->rawData);
} else if (value.IsFunction()) { } else if (value.IsFunction()) {
return new QVariant(); return new QVariant();

View File

@ -12,7 +12,6 @@ Napi::Object QTimeWrap::init(Napi::Env env, Napi::Object exports) {
env, CLASSNAME, env, CLASSNAME,
{InstanceMethod("addMSecs", &QTimeWrap::addMSecs), {InstanceMethod("addMSecs", &QTimeWrap::addMSecs),
InstanceMethod("addSecs", &QTimeWrap::addSecs), InstanceMethod("addSecs", &QTimeWrap::addSecs),
InstanceMethod("elapsed", &QTimeWrap::elapsed),
InstanceMethod("hour", &QTimeWrap::hour), InstanceMethod("hour", &QTimeWrap::hour),
InstanceMethod("isNull", &QTimeWrap::isNull), InstanceMethod("isNull", &QTimeWrap::isNull),
InstanceMethod("isValid", &QTimeWrap::isValid), InstanceMethod("isValid", &QTimeWrap::isValid),
@ -20,11 +19,9 @@ Napi::Object QTimeWrap::init(Napi::Env env, Napi::Object exports) {
InstanceMethod("msec", &QTimeWrap::msec), InstanceMethod("msec", &QTimeWrap::msec),
InstanceMethod("msecsSinceStartOfDay", &QTimeWrap::msecsSinceStartOfDay), InstanceMethod("msecsSinceStartOfDay", &QTimeWrap::msecsSinceStartOfDay),
InstanceMethod("msecsTo", &QTimeWrap::msecsTo), InstanceMethod("msecsTo", &QTimeWrap::msecsTo),
InstanceMethod("restart", &QTimeWrap::restart),
InstanceMethod("second", &QTimeWrap::second), InstanceMethod("second", &QTimeWrap::second),
InstanceMethod("secsTo", &QTimeWrap::secsTo), InstanceMethod("secsTo", &QTimeWrap::secsTo),
InstanceMethod("setHMS", &QTimeWrap::setHMS), InstanceMethod("setHMS", &QTimeWrap::setHMS),
InstanceMethod("start", &QTimeWrap::start),
InstanceMethod("toString$", &QTimeWrap::toString), InstanceMethod("toString$", &QTimeWrap::toString),
StaticMethod("currentTime", &StaticTimeWrapMethods::currentTime), StaticMethod("currentTime", &StaticTimeWrapMethods::currentTime),
StaticMethod("fromMSecsSinceStartOfDay", StaticMethod("fromMSecsSinceStartOfDay",
@ -81,11 +78,6 @@ Napi::Value QTimeWrap::addSecs(const Napi::CallbackInfo& info) {
return instance; 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::Value QTimeWrap::hour(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env(); Napi::Env env = info.Env();
return Napi::Value::From(env, this->instance->hour()); 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); 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::Value QTimeWrap::second(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env(); Napi::Env env = info.Env();
return Napi::Value::From(env, this->instance->second()); 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); 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::Value QTimeWrap::toString(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env(); Napi::Env env = info.Env();
QString result; QString result;

View File

@ -141,13 +141,13 @@ Napi::Value QFontWrap::stretch(const Napi::CallbackInfo& info) {
Napi::Value QFontWrap::setWeight(const Napi::CallbackInfo& info) { Napi::Value QFontWrap::setWeight(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env(); Napi::Env env = info.Env();
int weight = info[0].As<Napi::Number>().Int32Value(); int weight = info[0].As<Napi::Number>().Int32Value();
this->instance->setWeight(weight); this->instance->setWeight(static_cast<QFont::Weight>(weight));
return env.Null(); return env.Null();
} }
Napi::Value QFontWrap::weight(const Napi::CallbackInfo& info) { Napi::Value QFontWrap::weight(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env(); 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) { Napi::Value QFontWrap::setItalic(const Napi::CallbackInfo& info) {

View File

@ -1,7 +1,6 @@
#include "QtWidgets/QMainWindow/qmainwindow_wrap.h" #include "QtWidgets/QMainWindow/qmainwindow_wrap.h"
#include <QApplication> #include <QApplication>
#include <QDesktopWidget>
#include "Extras/Utils/nutils.h" #include "Extras/Utils/nutils.h"
#include "QtWidgets/QMenuBar/qmenubar_wrap.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("setMenuBar", &QMainWindowWrap::setMenuBar),
InstanceMethod("menuBar", &QMainWindowWrap::menuBar), InstanceMethod("menuBar", &QMainWindowWrap::menuBar),
InstanceMethod("setMenuWidget", &QMainWindowWrap::setMenuWidget), InstanceMethod("setMenuWidget", &QMainWindowWrap::setMenuWidget),
InstanceMethod("center", &QMainWindowWrap::center),
InstanceMethod("setStatusBar", &QMainWindowWrap::setStatusBar), InstanceMethod("setStatusBar", &QMainWindowWrap::setStatusBar),
InstanceMethod("statusBar", &QMainWindowWrap::statusBar), InstanceMethod("statusBar", &QMainWindowWrap::statusBar),
QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QMainWindowWrap)}); QWIDGET_WRAPPED_METHODS_EXPORT_DEFINE(QMainWindowWrap)});
@ -116,17 +114,6 @@ Napi::Value QMainWindowWrap::setMenuWidget(const Napi::CallbackInfo& info) {
return env.Null(); 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::Value QMainWindowWrap::setStatusBar(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env(); Napi::Env env = info.Env();
Napi::Object statusBarArg = info[0].As<Napi::Object>(); Napi::Object statusBarArg = info[0].As<Napi::Object>();

View File

@ -50,7 +50,7 @@ std::unordered_map<std::string, int> NodeStyle::NodeWrap{
NodeValueUnit NodeStyle::parseMeasurement(QString rawValue) { NodeValueUnit NodeStyle::parseMeasurement(QString rawValue) {
float value = std::stof(rawValue.toStdString()); float value = std::stof(rawValue.toStdString());
if (rawValue.back() == "%") { if (rawValue.back() == '%') {
return NodeValueUnit(value, YGUnitPercent); return NodeValueUnit(value, YGUnitPercent);
} }
return NodeValueUnit(value, YGUnitPoint); return NodeValueUnit(value, YGUnitPoint);

View File

@ -23,9 +23,6 @@ export class QTime extends Component {
addSecs(s: number): QTime { addSecs(s: number): QTime {
return new QTime(this.native.addSecs(s)); return new QTime(this.native.addSecs(s));
} }
elapsed(): number {
return this.native.elapsed();
}
hour(): number { hour(): number {
return this.native.hour(); return this.native.hour();
} }
@ -47,9 +44,6 @@ export class QTime extends Component {
msecsTo(t: QTime): number { msecsTo(t: QTime): number {
return this.native.msecsTo(t.native); return this.native.msecsTo(t.native);
} }
restart(): number {
return this.native.restart();
}
second(): number { second(): number {
return this.native.second(); return this.native.second();
} }
@ -59,9 +53,6 @@ export class QTime extends Component {
setHMS(h: number, m: number, s: number, ms = 0): boolean { setHMS(h: number, m: number, s: number, ms = 0): boolean {
return this.native.setHMS(h, m, s, ms); return this.native.setHMS(h, m, s, ms);
} }
start(): void {
this.native.start();
}
toString(format: string | DateFormat): string { toString(format: string | DateFormat): string {
return this.native.toString$(format); return this.native.toString$(format);
} }

View File

@ -100,13 +100,13 @@ export enum QFontCapitalization {
Capitalize = 4, Capitalize = 4,
} }
export enum QFontWeight { export enum QFontWeight {
Thin = 0, Thin = 100,
ExtraLight = 12, ExtraLight = 200,
Light = 25, Light = 300,
Normal = 50, Normal = 400,
Medium = 57, Medium = 500,
DemiBold = 63, DemiBold = 600,
Bold = 75, Bold = 700,
ExtraBold = 81, ExtraBold = 800,
Black = 87, Black = 900,
} }

View File

@ -14,8 +14,8 @@ It is inherited by QCheckBox, QPushButton, QRadioButton, and QToolButton.
*/ */
export abstract class QAbstractButton<Signals extends QAbstractButtonSignals> extends QWidget<Signals> { export abstract class QAbstractButton<Signals extends QAbstractButtonSignals> extends QWidget<Signals> {
animateClick(msec: number): void { animateClick(): void {
this.native.animateClick(msec); this.native.animateClick();
} }
click(): void { click(): void {
this.native.click(); this.native.click();

View File

@ -7,7 +7,10 @@ import { checkIfNativeElement } from '../utils/helpers';
import { wrapperCache } from '../core/WrapperCache'; import { wrapperCache } from '../core/WrapperCache';
export interface QButtonGroupSignals extends QObjectSignals { 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> { export class QButtonGroup extends QObject<any> {

View File

@ -89,9 +89,6 @@ export class QMainWindow extends QWidget<QMainWindowSignals> {
} }
return super.layout(); return super.layout();
} }
center(): void {
this.native.center();
}
/** /**
* Sets the status bar for the main window to statusbar. * Sets the status bar for the main window to statusbar.

View File

@ -545,10 +545,10 @@
"node-fetch" "^2.6.0" "node-fetch" "^2.6.0"
"progress" "^2.0.3" "progress" "^2.0.3"
"@nodegui/qode@^16.4.0": "@nodegui/qode@^16.4.3":
"integrity" "sha512-uNoTR9f02F/SmK+xzvlXJs/yuW0zYcuPZf99v4z7tPeugLukrPbE2MJfsq8edGNfWxu3d+pRwMN+UNYSq0dLgQ==" "integrity" "sha512-WllfJVXffr3Rn7BSfo5cubZ5hx4OnQ7iqY/kj+2jwqUepzlRFKCvn9/vAJ/VXmiB0GZGcaCGM0U3rZGADdU5mw=="
"resolved" "https://registry.npmjs.org/@nodegui/qode/-/qode-16.4.0.tgz" "resolved" "https://registry.npmjs.org/@nodegui/qode/-/qode-16.4.3.tgz"
"version" "16.4.0" "version" "16.4.3"
dependencies: dependencies:
"env-paths" "^2.2.1" "env-paths" "^2.2.1"
"make-dir" "^3.1.0" "make-dir" "^3.1.0"
@ -867,10 +867,10 @@
"resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" "resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"
"version" "2.1.1" "version" "2.1.1"
"ansi-regex@^5.0.0": "ansi-regex@^5.0.0", "ansi-regex@^5.0.1":
"integrity" "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" "integrity" "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
"resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz" "resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz"
"version" "5.0.0" "version" "5.0.1"
"ansi-styles@^3.2.1": "ansi-styles@^3.2.1":
"integrity" "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==" "integrity" "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="
@ -2934,9 +2934,11 @@
"version" "4.0.0" "version" "4.0.0"
"node-fetch@^2.6.0", "node-fetch@^2.6.1": "node-fetch@^2.6.0", "node-fetch@^2.6.1":
"integrity" "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" "integrity" "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ=="
"resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz" "resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz"
"version" "2.6.1" "version" "2.6.7"
dependencies:
"whatwg-url" "^5.0.0"
"node-int64@^0.4.0": "node-int64@^0.4.0":
"integrity" "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" "integrity" "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs="
@ -3493,13 +3495,13 @@
"strip-ansi" "^3.0.0" "strip-ansi" "^3.0.0"
"string-width@^4.1.0", "string-width@^4.2.0": "string-width@^4.1.0", "string-width@^4.2.0":
"integrity" "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==" "integrity" "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="
"resolved" "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz" "resolved" "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
"version" "4.2.2" "version" "4.2.3"
dependencies: dependencies:
"emoji-regex" "^8.0.0" "emoji-regex" "^8.0.0"
"is-fullwidth-code-point" "^3.0.0" "is-fullwidth-code-point" "^3.0.0"
"strip-ansi" "^6.0.0" "strip-ansi" "^6.0.1"
"strip-ansi@^3.0.0", "strip-ansi@^3.0.1": "strip-ansi@^3.0.0", "strip-ansi@^3.0.1":
"integrity" "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=" "integrity" "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8="
@ -3508,12 +3510,12 @@
dependencies: dependencies:
"ansi-regex" "^2.0.0" "ansi-regex" "^2.0.0"
"strip-ansi@^6.0.0": "strip-ansi@^6.0.0", "strip-ansi@^6.0.1":
"integrity" "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==" "integrity" "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="
"resolved" "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz" "resolved" "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
"version" "6.0.0" "version" "6.0.1"
dependencies: dependencies:
"ansi-regex" "^5.0.0" "ansi-regex" "^5.0.1"
"strip-bom@^4.0.0": "strip-bom@^4.0.0":
"integrity" "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==" "integrity" "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="
@ -3673,6 +3675,11 @@
dependencies: dependencies:
"punycode" "^2.1.1" "punycode" "^2.1.1"
"tr46@~0.0.3":
"integrity" "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
"resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"
"version" "0.0.3"
"traverse@>=0.3.0 <0.4": "traverse@>=0.3.0 <0.4":
"integrity" "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=" "integrity" "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk="
"resolved" "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz" "resolved" "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz"
@ -3867,6 +3874,11 @@
dependencies: dependencies:
"makeerror" "1.0.x" "makeerror" "1.0.x"
"webidl-conversions@^3.0.0":
"integrity" "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
"resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
"version" "3.0.1"
"webidl-conversions@^5.0.0": "webidl-conversions@^5.0.0":
"integrity" "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" "integrity" "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA=="
"resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz" "resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz"
@ -3889,6 +3901,14 @@
"resolved" "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz" "resolved" "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz"
"version" "2.3.0" "version" "2.3.0"
"whatwg-url@^5.0.0":
"integrity" "sha1-lmRU6HZUYuN2RNNib2dCzotwll0="
"resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"
"version" "5.0.0"
dependencies:
"tr46" "~0.0.3"
"webidl-conversions" "^3.0.0"
"whatwg-url@^8.0.0", "whatwg-url@^8.5.0": "whatwg-url@^8.0.0", "whatwg-url@^8.5.0":
"integrity" "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==" "integrity" "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg=="
"resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz" "resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz"