nodeguy/src/cpp/include/nodegui/QtWidgets/QComboBox/ncombobox.hpp
Atul R 86c3ef089c
Integration with Qode 2.0 (#400)
* 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
2020-03-07 10:28:30 +01:00

43 lines
1.5 KiB
C++

#pragma once
#include <QComboBox>
#include "Extras/Export/export.h"
#include "QtWidgets/QWidget/qwidget_macro.h"
#include "core/NodeWidget/nodewidget.h"
#include "napi.h"
class DLL_EXPORT NComboBox : public QComboBox, public NodeWidget {
public:
Q_OBJECT
NODEWIDGET_IMPLEMENTATIONS(QComboBox)
using QComboBox::QComboBox;
void connectSignalsToEventEmitter() {
QWIDGET_SIGNALS
// Qt Connects: Implement all signal connects here
QObject::connect(
this, QOverload<int>::of(&QComboBox::currentIndexChanged),
[=](int index) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "currentIndexChanged"),
Napi::Number::From(env, index)});
});
QObject::connect(
this, QOverload<const QString &>::of(&QComboBox::currentTextChanged),
[=](const QString &text) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "currentTextChanged"),
Napi::String::New(env, text.toStdString())});
});
QObject::connect(
this, &QComboBox::editTextChanged, [=](const QString &text) {
Napi::Env env = this->emitOnNode.Env();
Napi::HandleScope scope(env);
this->emitOnNode.Call({Napi::String::New(env, "editTextChanged"),
Napi::String::New(env, text.toStdString())});
});
}
};