* Moves qt integration solely to the nodegui core addon * Adds lint fixes * moved to integration core * cleans up export snippet * revert package.json * Add exit if app->exec finishes. * lint fix * Makes QApplication custom * adds qobject to wrap of qapp * Adds working qt run looper * Adds font default * Adds qt installer * Updates qode integration to v2.0.1 * fix cpp lints * Fixes lint and deps * Adds miniqt installation * adds setup mini qt script * skips tests due to issues with jest * fix config and download path for linux and windows * Adds multiple artifact downloader * fix qt config and compilation * Fixes qode path for windows (now it can load dll's easily) * Add compilation * fix windows path setup * use scripts directly * enabled tests back * fix ubuntu deps * update to alpha release * fix workflow * adds more artifacts and funding field * change to alpha v2 * update prebuild yml * revert build action * disabling prebuild for now * switch to stable release 5.14.1 * version bump
51 lines
2.0 KiB
C++
51 lines
2.0 KiB
C++
#pragma once
|
|
#include <QCalendarWidget>
|
|
|
|
#include "Extras/Export/export.h"
|
|
#include "QtCore/QDate/qdate_wrap.h"
|
|
#include "QtWidgets/QWidget/qwidget_macro.h"
|
|
#include "core/NodeWidget/nodewidget.h"
|
|
#include "napi.h"
|
|
|
|
class DLL_EXPORT NCalendarWidget : public QCalendarWidget, public NodeWidget {
|
|
Q_OBJECT
|
|
NODEWIDGET_IMPLEMENTATIONS(QCalendarWidget)
|
|
public:
|
|
// inherit all constructors of QCalendarWidget
|
|
using QCalendarWidget::QCalendarWidget;
|
|
|
|
void connectSignalsToEventEmitter() {
|
|
// Qt Connects: Implement all signal connects here
|
|
QWIDGET_SIGNALS
|
|
QObject::connect(this, &QCalendarWidget::activated, [=](const QDate &date) {
|
|
Napi::Env env = this->emitOnNode.Env();
|
|
Napi::HandleScope scope(env);
|
|
|
|
auto instance = QDateWrap::constructor.New({Napi::External<QDate>::New(
|
|
env, new QDate(date.year(), date.month(), date.day()))});
|
|
this->emitOnNode.Call({Napi::String::New(env, "activated"), instance});
|
|
});
|
|
QObject::connect(this, &QCalendarWidget::clicked, [=](const QDate &date) {
|
|
Napi::Env env = this->emitOnNode.Env();
|
|
Napi::HandleScope scope(env);
|
|
|
|
auto instance = QDateWrap::constructor.New({Napi::External<QDate>::New(
|
|
env, new QDate(date.year(), date.month(), date.day()))});
|
|
this->emitOnNode.Call({Napi::String::New(env, "clicked"), instance});
|
|
});
|
|
QObject::connect(
|
|
this, &QCalendarWidget::currentPageChanged, [=](int year, int month) {
|
|
Napi::Env env = this->emitOnNode.Env();
|
|
Napi::HandleScope scope(env);
|
|
this->emitOnNode.Call({Napi::String::New(env, "currentPageChanged"),
|
|
Napi::Value::From(env, year),
|
|
Napi::Value::From(env, month)});
|
|
});
|
|
QObject::connect(this, &QCalendarWidget::selectionChanged, [=]() {
|
|
Napi::Env env = this->emitOnNode.Env();
|
|
Napi::HandleScope scope(env);
|
|
this->emitOnNode.Call({Napi::String::New(env, "selectionChanged")});
|
|
});
|
|
}
|
|
};
|