Inherit implemented Qt signals from base classes (#290)
* Adds abstract signals * basic layout and filedialogs * Adds all remaining signal heirarchies * fix lint
This commit is contained in:
parent
42e92ecbff
commit
d1e5d499fb
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <QMovie>
|
||||
|
||||
#include "QtCore/QObject/qobject_macro.h"
|
||||
#include "QtCore/QRect/qrect_wrap.h"
|
||||
#include "QtCore/QSize/qsize_wrap.h"
|
||||
#include "core/Events/eventwidget.h"
|
||||
@ -13,6 +14,7 @@ class NMovie : public QMovie, public EventWidget {
|
||||
using QMovie::QMovie;
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QOBJECT_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QMovie::error,
|
||||
[=](QImageReader::ImageReaderError error) {
|
||||
|
||||
@ -43,3 +43,8 @@
|
||||
InstanceMethod("viewport", &WidgetWrapName::viewport),
|
||||
|
||||
#endif // QABSTRACTSCROLLAREA_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
#ifndef QABSTRACTSCROLLAREA_SIGNALS
|
||||
#define QABSTRACTSCROLLAREA_SIGNALS QWIDGET_SIGNALS
|
||||
|
||||
#endif
|
||||
|
||||
@ -89,3 +89,45 @@
|
||||
InstanceMethod("value", &WidgetWrapName::value),
|
||||
|
||||
#endif // QABSTRACTSLIDER_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
#ifndef QABSTRACT_SLIDER_SIGNALS
|
||||
#define QABSTRACT_SLIDER_SIGNALS \
|
||||
QWIDGET_SIGNALS \
|
||||
QObject::connect(this, &QAbstractSlider::actionTriggered, [=](int action) { \
|
||||
Napi::Env env = this->emitOnNode.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->emitOnNode.Call({Napi::String::New(env, "actionTriggered"), \
|
||||
Napi::Value::From(env, action)}); \
|
||||
}); \
|
||||
QObject::connect(this, &QAbstractSlider::sliderPressed, [=]() { \
|
||||
Napi::Env env = this->emitOnNode.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->emitOnNode.Call({Napi::String::New(env, "sliderPressed")}); \
|
||||
}); \
|
||||
QObject::connect(this, &QAbstractSlider::sliderReleased, [=]() { \
|
||||
Napi::Env env = this->emitOnNode.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->emitOnNode.Call({Napi::String::New(env, "sliderReleased")}); \
|
||||
}); \
|
||||
QObject::connect(this, &QAbstractSlider::valueChanged, [=](int value) { \
|
||||
Napi::Env env = this->emitOnNode.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->emitOnNode.Call({Napi::String::New(env, "valueChanged"), \
|
||||
Napi::Value::From(env, value)}); \
|
||||
}); \
|
||||
QObject::connect(this, &QAbstractSlider::sliderMoved, [=](int value) { \
|
||||
Napi::Env env = this->emitOnNode.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->emitOnNode.Call({Napi::String::New(env, "sliderMoved"), \
|
||||
Napi::Value::From(env, value)}); \
|
||||
}); \
|
||||
QObject::connect( \
|
||||
this, &QAbstractSlider::rangeChanged, [=](int min, int max) { \
|
||||
Napi::Env env = this->emitOnNode.Env(); \
|
||||
Napi::HandleScope scope(env); \
|
||||
this->emitOnNode.Call({Napi::String::New(env, "rangeChanged"), \
|
||||
Napi::Value::From(env, min), \
|
||||
Napi::Value::From(env, max)}); \
|
||||
});
|
||||
|
||||
#endif
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include "QtCore/QObject/qobject_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NAction : public QAction, public EventWidget {
|
||||
using QAction::QAction; // inherit all constructors of QAction
|
||||
void connectSignalsToEventEmitter() {
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QOBJECT_SIGNALS
|
||||
QObject::connect(this, &QAction::triggered, [=](bool checked) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
#include <QBoxLayout>
|
||||
|
||||
#include "QtWidgets/QLayout/qlayout_macro.h"
|
||||
#include "core/Events/eventwidget_macro.h"
|
||||
|
||||
class NBoxLayout : public QBoxLayout, public EventWidget {
|
||||
public:
|
||||
Q_OBJECT
|
||||
public:
|
||||
EVENTWIDGET_IMPLEMENTATIONS(QBoxLayout)
|
||||
using QBoxLayout::QBoxLayout;
|
||||
void connectSignalsToEventEmitter() { QLAYOUT_SIGNALS }
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NComboBox : public QComboBox, public NodeWidget {
|
||||
using QComboBox::QComboBox;
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(
|
||||
this, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QDial>
|
||||
|
||||
#include "QtWidgets/QAbstractSlider/qabstractslider_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class NDial : public QDial, public NodeWidget {
|
||||
@ -12,34 +13,6 @@ class NDial : public QDial, public NodeWidget {
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QDial::valueChanged, [=](int value) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "valueChanged"),
|
||||
Napi::Number::New(env, value)});
|
||||
});
|
||||
QObject::connect(this, &QDial::rangeChanged, [=](int min, int max) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "rangeChanged"),
|
||||
Napi::Number::New(env, min),
|
||||
Napi::Number::New(env, max)});
|
||||
});
|
||||
QObject::connect(this, &QDial::sliderMoved, [=](int value) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "sliderMoved"),
|
||||
Napi::Number::New(env, value)});
|
||||
});
|
||||
QObject::connect(this, &QDial::sliderPressed, [=]() {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "sliderPressed")});
|
||||
});
|
||||
QObject::connect(this, &QDial::sliderReleased, [=]() {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "sliderReleased")});
|
||||
});
|
||||
QABSTRACT_SLIDER_SIGNALS
|
||||
}
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NFileDialog : public QFileDialog, public NodeWidget {
|
||||
using QFileDialog::QFileDialog;
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(
|
||||
this, &QFileDialog::currentChanged, [=](const QString &path) {
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
#include <QGridLayout>
|
||||
|
||||
#include "QtWidgets/QLayout/qlayout_macro.h"
|
||||
#include "core/Events/eventwidget_macro.h"
|
||||
|
||||
class NGridLayout : public QGridLayout, public EventWidget {
|
||||
public:
|
||||
Q_OBJECT
|
||||
public:
|
||||
EVENTWIDGET_IMPLEMENTATIONS(QGridLayout)
|
||||
using QGridLayout::QGridLayout;
|
||||
void connectSignalsToEventEmitter() { QLAYOUT_SIGNALS }
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QGroupBox>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NGroupBox : public QGroupBox, public NodeWidget {
|
||||
using QGroupBox::QGroupBox; // inherit all constructors of QGroupBox
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
QObject::connect(this, &QGroupBox::clicked, [=](bool checked) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
#pragma once
|
||||
#include <QLayout>
|
||||
|
||||
#include "QtWidgets/QLayout/qlayout_macro.h"
|
||||
#include "core/Events/eventwidget_macro.h"
|
||||
|
||||
class NLayout : public QLayout, public EventWidget {
|
||||
public:
|
||||
Q_OBJECT
|
||||
public:
|
||||
EVENTWIDGET_IMPLEMENTATIONS(NLayout)
|
||||
using QLayout::QLayout;
|
||||
void connectSignalsToEventEmitter() { QLAYOUT_SIGNALS }
|
||||
};
|
||||
|
||||
@ -45,3 +45,8 @@
|
||||
InstanceMethod("update", &LayoutWrapName::update),
|
||||
|
||||
#endif // QLAYOUT_WRAPPED_METHODS_EXPORT_DEFINE
|
||||
|
||||
#ifndef QLAYOUT_SIGNALS
|
||||
#define QLAYOUT_SIGNALS QOBJECT_SIGNALS
|
||||
|
||||
#endif // QLAYOUT_SIGNALS
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class NLineEdit : public QLineEdit, public NodeWidget {
|
||||
@ -11,6 +12,7 @@ class NLineEdit : public QLineEdit, public NodeWidget {
|
||||
using QLineEdit::QLineEdit; // inherit all constructors of QLineEdit
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QLineEdit::cursorPositionChanged,
|
||||
[=](int oldPost, int newPos) {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include <QEvent>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class NMainWindow : public QMainWindow, public NodeWidget {
|
||||
@ -10,4 +11,5 @@ class NMainWindow : public QMainWindow, public NodeWidget {
|
||||
NODEWIDGET_IMPLEMENTATIONS(QMainWindow)
|
||||
public:
|
||||
using QMainWindow::QMainWindow; // inherit all constructors of QMainWindow
|
||||
void connectSignalsToEventEmitter() { QWIDGET_SIGNALS }
|
||||
};
|
||||
|
||||
@ -4,9 +4,12 @@
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
|
||||
class NMenu : public QMenu, public NodeWidget {
|
||||
Q_OBJECT
|
||||
NODEWIDGET_IMPLEMENTATIONS(QMenu)
|
||||
public:
|
||||
using QMenu::QMenu; // inherit all constructors of QMenu
|
||||
void connectSignalsToEventEmitter() { QWIDGET_SIGNALS }
|
||||
};
|
||||
|
||||
@ -4,9 +4,12 @@
|
||||
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
|
||||
class NMenuBar : public QMenuBar, public NodeWidget {
|
||||
Q_OBJECT
|
||||
NODEWIDGET_IMPLEMENTATIONS(QMenuBar)
|
||||
public:
|
||||
using QMenuBar::QMenuBar; // inherit all constructors of QMenuBar
|
||||
void connectSignalsToEventEmitter() { QWIDGET_SIGNALS }
|
||||
};
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
#include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class NPlainTextEdit : public QPlainTextEdit, public NodeWidget {
|
||||
Q_OBJECT
|
||||
NODEWIDGET_IMPLEMENTATIONS(QPlainTextEdit)
|
||||
@ -12,6 +12,8 @@ class NPlainTextEdit : public QPlainTextEdit, public NodeWidget {
|
||||
// QPlainTextEdit
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QABSTRACTSCROLLAREA_SIGNALS
|
||||
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QPlainTextEdit::textChanged, [=]() {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
|
||||
@ -2,11 +2,22 @@
|
||||
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class NProgressBar : public QProgressBar, public NodeWidget {
|
||||
Q_OBJECT
|
||||
NODEWIDGET_IMPLEMENTATIONS(QProgressBar)
|
||||
public:
|
||||
NODEWIDGET_IMPLEMENTATIONS(QProgressBar)
|
||||
using QProgressBar::QProgressBar; // inherit all constructors of QProgressBar
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QProgressBar::valueChanged, [=](int value) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
this->emitOnNode.Call({Napi::String::New(env, "valueChanged"),
|
||||
Napi::Value::From(env, value)});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
|
||||
class NScrollArea : public QScrollArea, public NodeWidget {
|
||||
@ -9,4 +10,5 @@ class NScrollArea : public QScrollArea, public NodeWidget {
|
||||
NODEWIDGET_IMPLEMENTATIONS(QScrollArea)
|
||||
public:
|
||||
using QScrollArea::QScrollArea; // inherit all constructors of QScrollArea
|
||||
void connectSignalsToEventEmitter() { QABSTRACTSCROLLAREA_SIGNALS }
|
||||
};
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QShortcut>
|
||||
|
||||
#include "QtCore/QObject/qobject_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -11,6 +12,7 @@ class NShortcut : public QShortcut, public EventWidget {
|
||||
public:
|
||||
using QShortcut::QShortcut; // inherit all constructors of QShortcut
|
||||
void connectSignalsToEventEmitter() {
|
||||
QOBJECT_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QShortcut::activated, [=]() {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NSpinBox : public QSpinBox, public NodeWidget {
|
||||
using QSpinBox::QSpinBox; // inherit all constructors of QSpinBox
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(
|
||||
this, QOverload<int>::of(&QSpinBox::valueChanged), [=](int val) {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QStackedWidget>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -13,6 +14,7 @@ class NStackedWidget : public QStackedWidget, public NodeWidget {
|
||||
// QStackedWidget
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QStackedWidget::currentChanged, [=](int index) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#include "QtCore/QObject/qobject_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NSystemTrayIcon : public QSystemTrayIcon, public EventWidget {
|
||||
// inherit all constructors of QSystemTrayIcon
|
||||
using QSystemTrayIcon::QSystemTrayIcon;
|
||||
void connectSignalsToEventEmitter() {
|
||||
QOBJECT_SIGNALS
|
||||
QObject::connect(this, &QSystemTrayIcon::activated, [=](int reason) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QTabWidget>
|
||||
|
||||
#include "QtWidgets/QWidget/qwidget_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NTabWidget : public QTabWidget, public NodeWidget {
|
||||
using QTabWidget::QTabWidget; // inherit all constructors of QTabWidget
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QWIDGET_SIGNALS
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QObject::connect(this, &QTabWidget::currentChanged, [=](int index) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QTableWidget>
|
||||
|
||||
#include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -12,6 +13,7 @@ class NTableWidget : public QTableWidget, public NodeWidget {
|
||||
using QTableWidget::QTableWidget;
|
||||
void connectSignalsToEventEmitter() {
|
||||
// Qt Connects: Implement all signal connects here
|
||||
QABSTRACTSCROLLAREA_SIGNALS
|
||||
QObject::connect(
|
||||
this, &QTableWidget::cellActivated, [=](int row, int column) {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "QtWidgets/QAbstractScrollArea/qabstractscrollarea_macro.h"
|
||||
#include "core/NodeWidget/nodewidget.h"
|
||||
#include "napi.h"
|
||||
|
||||
@ -13,6 +14,7 @@ class NTreeWidget : public QTreeWidget, public NodeWidget {
|
||||
using QTreeWidget::QTreeWidget; // inherit all constructors of QTreeWidget
|
||||
|
||||
void connectSignalsToEventEmitter() {
|
||||
QABSTRACTSCROLLAREA_SIGNALS
|
||||
QObject::connect(this, &QTreeWidget::itemSelectionChanged, [=]() {
|
||||
Napi::Env env = this->emitOnNode.Env();
|
||||
Napi::HandleScope scope(env);
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include <QLayout>
|
||||
#include <QTimer>
|
||||
|
||||
#include "QtWidgets/QLayout/qlayout_macro.h"
|
||||
#include "core/Events/eventwidget_macro.h"
|
||||
#include "deps/yoga/YGNode.h"
|
||||
|
||||
@ -53,6 +54,7 @@ class FlexLayout : public QLayout, public EventWidget {
|
||||
bool hasHeightForWidth() const override;
|
||||
|
||||
EVENTWIDGET_IMPLEMENTATIONS(QLayout)
|
||||
void connectSignalsToEventEmitter();
|
||||
};
|
||||
|
||||
// class FlexLayoutWorker: public Q
|
||||
@ -216,4 +216,6 @@ void FlexLayout::restoreNodeMinStyle(YGValue& previousMinWidth,
|
||||
} else {
|
||||
YGNodeStyleSetMinWidth(this->node, previousMinWidth.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FlexLayout::connectSignalsToEventEmitter() { QLAYOUT_SIGNALS }
|
||||
|
||||
@ -18,13 +18,12 @@ export { QKeyEvent } from './lib/QtGui/QEvent/QKeyEvent';
|
||||
export { QMouseEvent } from './lib/QtGui/QEvent/QMouseEvent';
|
||||
export { WidgetEventTypes } from './lib/core/EventWidget';
|
||||
// Abstract:
|
||||
export { NodeWidget } from './lib/QtWidgets/QWidget';
|
||||
export { NodeLayout } from './lib/QtWidgets/QLayout';
|
||||
export { NodeWidget, QWidget, QWidgetSignals } from './lib/QtWidgets/QWidget';
|
||||
export { NodeLayout, QLayoutSignals } from './lib/QtWidgets/QLayout';
|
||||
export { QAbstractScrollArea } from './lib/QtWidgets/QAbstractScrollArea';
|
||||
export { QAbstractSlider } from './lib/QtWidgets/QAbstractSlider';
|
||||
export { QAbstractSlider, QAbstractSliderSignals } from './lib/QtWidgets/QAbstractSlider';
|
||||
export { QAbstractButton, QAbstractButtonSignals } from './lib/QtWidgets/QAbstractButton';
|
||||
// Widgets:
|
||||
export { QWidget, QWidgetSignals } from './lib/QtWidgets/QWidget';
|
||||
export { QCheckBox, QCheckBoxSignals } from './lib/QtWidgets/QCheckBox';
|
||||
export { QLabel, QLabelSignals } from './lib/QtWidgets/QLabel';
|
||||
export { QDial, QDialSignals } from './lib/QtWidgets/QDial';
|
||||
|
||||
@ -4,7 +4,7 @@ import { checkIfNativeElement } from '../utils/helpers';
|
||||
import addon from '../utils/addon';
|
||||
import { QVariant, QVariantType } from './QVariant';
|
||||
|
||||
export abstract class NodeObject<Signals> extends EventWidget<Signals> {
|
||||
export abstract class NodeObject<Signals extends QObjectSignals> extends EventWidget<Signals> {
|
||||
inherits(className: string): boolean {
|
||||
return this.native.inherits(className);
|
||||
}
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { QSize } from '../QtCore/QSize';
|
||||
import { QPixmap } from './QPixmap';
|
||||
|
||||
export interface QMovieSignals extends QObjectSignals {
|
||||
error: (error: ImageReaderError) => void;
|
||||
finished: () => void;
|
||||
frameChanged: (frameNumber?: number) => void;
|
||||
resized: (qSizeNative?: NativeElement) => void;
|
||||
started: () => void;
|
||||
stateChanged: (state: MovieState) => void;
|
||||
updated: (qRectNative: NativeElement) => void;
|
||||
}
|
||||
export class QMovie extends NodeObject<QMovieSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
@ -75,16 +85,6 @@ export class QMovie extends NodeObject<QMovieSignals> {
|
||||
}
|
||||
}
|
||||
|
||||
export interface QMovieSignals {
|
||||
error: (error: ImageReaderError) => void;
|
||||
finished: () => void;
|
||||
frameChanged: (frameNumber?: number) => void;
|
||||
resized: (qSizeNative?: NativeElement) => void;
|
||||
started: () => void;
|
||||
stateChanged: (state: MovieState) => void;
|
||||
updated: (qRectNative: NativeElement) => void;
|
||||
}
|
||||
|
||||
export enum CacheMode {
|
||||
CacheNone,
|
||||
CacheAll,
|
||||
|
||||
@ -2,7 +2,7 @@ import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QSize } from '../QtCore/QSize';
|
||||
|
||||
export abstract class QAbstractButton<Signals> extends NodeWidget<Signals> {
|
||||
export abstract class QAbstractButton<Signals extends QAbstractButtonSignals> extends NodeWidget<Signals> {
|
||||
setText(text: string): void {
|
||||
this.native.setText(text);
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { NodeWidget, QWidget } from './QWidget';
|
||||
import { NodeWidget, QWidget, QWidgetSignals } from './QWidget';
|
||||
import { ScrollBarPolicy } from '../QtEnums/ScrollBarPolicy';
|
||||
|
||||
export abstract class QAbstractScrollArea<Signals> extends NodeWidget<Signals> {
|
||||
export type QAbstractScrollAreaSignals = QWidgetSignals;
|
||||
export abstract class QAbstractScrollArea<Signals extends QAbstractScrollAreaSignals> extends NodeWidget<Signals> {
|
||||
viewportWidget?: NodeWidget<any>;
|
||||
setViewport(widget: NodeWidget<any>): void {
|
||||
this.viewportWidget = widget;
|
||||
|
||||
@ -1,7 +1,15 @@
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { Orientation } from '../QtEnums';
|
||||
|
||||
export abstract class QAbstractSlider<Signals> extends NodeWidget<Signals> {
|
||||
export interface QAbstractSliderSignals extends QWidgetSignals {
|
||||
actionTriggered: (action: number) => void;
|
||||
rangeChanged: (min: number, max: number) => void;
|
||||
sliderMoved: (value: number) => void;
|
||||
sliderPressed: () => void;
|
||||
sliderReleased: () => void;
|
||||
valueChanged: (value: number) => void;
|
||||
}
|
||||
export abstract class QAbstractSlider<Signals extends QAbstractSliderSignals> extends NodeWidget<Signals> {
|
||||
setSingleStep(step: number): void {
|
||||
this.native.setSingleStep(step);
|
||||
}
|
||||
|
||||
@ -5,10 +5,10 @@ import { QMenu } from './QMenu';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QKeySequence } from '../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../QtEnums';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export interface QActionSignals {
|
||||
export interface QActionSignals extends QObjectSignals {
|
||||
triggered: (checked: boolean) => void;
|
||||
changed: () => void;
|
||||
hovered: () => void;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { NodeLayout, QLayoutSignals } from './QLayout';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { Direction } from '../QtEnums';
|
||||
|
||||
export type QBoxLayoutSignals = {};
|
||||
export type QBoxLayoutSignals = QLayoutSignals;
|
||||
export class QBoxLayout extends NodeLayout<QBoxLayoutSignals> {
|
||||
native: NativeElement;
|
||||
childLayouts: Set<NodeLayout<any>>;
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { SizeAdjustPolicy } from '../QtEnums';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QVariant } from '../QtCore/QVariant';
|
||||
|
||||
export interface QComboBoxSignals {
|
||||
export interface QComboBoxSignals extends QWidgetSignals {
|
||||
//List all Signals below
|
||||
currentIndexChanged: (index: number) => void;
|
||||
currentTextChanged: (text: string) => void;
|
||||
|
||||
@ -1,15 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractSlider } from './QAbstractSlider';
|
||||
import { QAbstractSlider, QAbstractSliderSignals } from './QAbstractSlider';
|
||||
|
||||
export interface QDialSignals {
|
||||
valueChanged: (value: number) => void;
|
||||
rangeChanged: (min: number, max: number) => void;
|
||||
sliderMoved: (value: number) => void;
|
||||
sliderPressed: () => void;
|
||||
sliderReleased: () => void;
|
||||
}
|
||||
export type QDialSignals = QAbstractSliderSignals;
|
||||
export class QDial extends QAbstractSlider<QDialSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { AcceptMode, DialogLabel, FileMode, Option, ViewMode } from '../QtEnums';
|
||||
|
||||
export interface QFileDialogSignals {
|
||||
export interface QFileDialogSignals extends QWidgetSignals {
|
||||
currentChanged: (path: string) => void;
|
||||
currentUrlChanged: (url: string) => void;
|
||||
directoryEntered: (directory: string) => void;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { NodeLayout, QLayoutSignals } from './QLayout';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export type QGridLayoutSignals = {};
|
||||
export type QGridLayoutSignals = QLayoutSignals;
|
||||
|
||||
export class QGridLayout extends NodeLayout<QGridLayoutSignals> {
|
||||
native: NativeElement;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { AlignmentFlag } from '../QtEnums/AlignmentFlag';
|
||||
|
||||
export interface QGroupBoxSignals {
|
||||
export interface QGroupBoxSignals extends QWidgetSignals {
|
||||
clicked: (checked: boolean) => void;
|
||||
toggled: (on: boolean) => void;
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
// All Layouts should extend this abstract class.
|
||||
export abstract class NodeLayout<Signals> extends NodeObject<Signals> {
|
||||
export type QLayoutSignals = QObjectSignals;
|
||||
|
||||
export abstract class NodeLayout<Signals extends QLayoutSignals> extends NodeObject<Signals> {
|
||||
type = 'layout';
|
||||
abstract addWidget(childWidget: NodeWidget<any>, ...args: any[]): void;
|
||||
abstract removeWidget(childWidget: NodeWidget<any>): void;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export enum EchoMode {
|
||||
@ -8,7 +8,7 @@ export enum EchoMode {
|
||||
Password,
|
||||
PasswordEchoOnEdit,
|
||||
}
|
||||
export interface QLineEditSignals {
|
||||
export interface QLineEditSignals extends QWidgetSignals {
|
||||
cursorPositionChanged: (oldPos: number, newPos: number) => void;
|
||||
editingFinished: () => void;
|
||||
inputRejected: () => void;
|
||||
@ -19,7 +19,6 @@ export interface QLineEditSignals {
|
||||
}
|
||||
export class QLineEdit extends NodeWidget<QLineEditSignals> {
|
||||
native: NativeElement;
|
||||
placeholderText?: string;
|
||||
constructor();
|
||||
constructor(parent: NodeWidget<any>);
|
||||
constructor(parent?: NodeWidget<any>) {
|
||||
@ -34,24 +33,24 @@ export class QLineEdit extends NodeWidget<QLineEditSignals> {
|
||||
this.setNodeParent(parent);
|
||||
}
|
||||
setText(text: string): void {
|
||||
// react:✓
|
||||
text && this.native.setText(text);
|
||||
}
|
||||
text(): string {
|
||||
// react:✓
|
||||
return this.native.text();
|
||||
}
|
||||
setPlaceholderText(text: string): void {
|
||||
// react:✓ TODO://getter
|
||||
this.placeholderText = text;
|
||||
this.native.setPlaceholderText(text);
|
||||
}
|
||||
placeholderText(): string {
|
||||
return this.property('placeholderText').toString();
|
||||
}
|
||||
setReadOnly(isReadOnly: boolean): void {
|
||||
// react:✓ TODO://getter
|
||||
this.native.setReadOnly(isReadOnly);
|
||||
}
|
||||
isReadOnly(): boolean {
|
||||
return this.property('readOnly').toBool();
|
||||
}
|
||||
clear(): void {
|
||||
// react:✓
|
||||
this.native.clear();
|
||||
}
|
||||
setEchoMode(mode: EchoMode): void {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeLayout } from './QLayout';
|
||||
import { QMenuBar } from './QMenuBar';
|
||||
|
||||
export type QMainWindowSignals = {};
|
||||
export type QMainWindowSignals = QWidgetSignals;
|
||||
export class QMainWindow extends NodeWidget<QMainWindowSignals> {
|
||||
native: NativeElement;
|
||||
public centralWidget?: NodeWidget<any> | null;
|
||||
@ -32,13 +32,11 @@ export class QMainWindow extends NodeWidget<QMainWindowSignals> {
|
||||
};
|
||||
}
|
||||
setCentralWidget(widget: NodeWidget<any>): void {
|
||||
// react:✓
|
||||
this.native.setCentralWidget(widget.native);
|
||||
this.centralWidget = widget;
|
||||
this.centralWidget.setFlexNodeSizeControlled(true);
|
||||
}
|
||||
takeCentralWidget(): NodeWidget<any> | null {
|
||||
// react:✓
|
||||
const centralWidget = this.centralWidget;
|
||||
this.centralWidget = null;
|
||||
if (centralWidget) {
|
||||
@ -61,7 +59,6 @@ export class QMainWindow extends NodeWidget<QMainWindowSignals> {
|
||||
if (this.centralWidget) {
|
||||
return this.centralWidget.layout;
|
||||
}
|
||||
|
||||
return super.layout;
|
||||
}
|
||||
center(): void {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import addon from '../utils/addon';
|
||||
import { QAction } from './QAction';
|
||||
|
||||
export type QMenuSignals = {};
|
||||
export type QMenuSignals = QWidgetSignals;
|
||||
export class QMenu extends NodeWidget<QMenuSignals> {
|
||||
native: NativeElement;
|
||||
actions: Set<QAction>;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { QMenu } from './QMenu';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import addon from '../utils/addon';
|
||||
import { checkIfNativeElement } from '../utils/helpers';
|
||||
|
||||
export type QMenuBarSignals = {};
|
||||
export type QMenuBarSignals = QWidgetSignals;
|
||||
|
||||
export class QMenuBar extends NodeWidget<QMenuBarSignals> {
|
||||
native: NativeElement;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractScrollArea } from './QAbstractScrollArea';
|
||||
import { QAbstractScrollArea, QAbstractScrollAreaSignals } from './QAbstractScrollArea';
|
||||
import { QTextOptionWrapMode } from '../QtGui/QTextOption';
|
||||
|
||||
export interface QPlainTextEditSignals {
|
||||
export interface QPlainTextEditSignals extends QAbstractScrollAreaSignals {
|
||||
textChanged: () => void;
|
||||
blockCountChanged: (blockCount: number) => void;
|
||||
copyAvailable: (yes: boolean) => void;
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { Orientation } from '../QtEnums';
|
||||
|
||||
export type QProgressBarSignals = {};
|
||||
export interface QProgressBarSignals extends QWidgetSignals {
|
||||
valueChanged: (value: number) => void;
|
||||
}
|
||||
export class QProgressBar extends NodeWidget<QProgressBarSignals> {
|
||||
native: NativeElement;
|
||||
constructor();
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractScrollArea } from './QAbstractScrollArea';
|
||||
import { QAbstractScrollArea, QAbstractScrollAreaSignals } from './QAbstractScrollArea';
|
||||
|
||||
export type QScrollAreaSignals = {};
|
||||
export type QScrollAreaSignals = QAbstractScrollAreaSignals;
|
||||
export class QScrollArea extends QAbstractScrollArea<QScrollAreaSignals> {
|
||||
native: NativeElement;
|
||||
contentWidget?: NodeWidget<any> | null;
|
||||
|
||||
@ -3,9 +3,9 @@ import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QKeySequence } from '../QtGui/QKeySequence';
|
||||
import { ShortcutContext } from '../QtEnums';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
export interface QShortcutSignals {
|
||||
export interface QShortcutSignals extends QObjectSignals {
|
||||
activated: () => void;
|
||||
activatedAmbiguously: () => void;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export interface QSpinBoxSignals {
|
||||
export interface QSpinBoxSignals extends QWidgetSignals {
|
||||
valueChanged: (value: number) => void;
|
||||
}
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
|
||||
export interface QStackedWidgetSignals {
|
||||
export interface QStackedWidgetSignals extends QWidgetSignals {
|
||||
currentChanged: (index: number) => void;
|
||||
}
|
||||
|
||||
|
||||
@ -3,9 +3,9 @@ import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { QMenu } from './QMenu';
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
export interface QSystemTrayIconSignals {
|
||||
export interface QSystemTrayIconSignals extends QObjectSignals {
|
||||
activated: (reason: QSystemTrayIconActivationReason) => void;
|
||||
messageClicked: () => void;
|
||||
}
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QIcon } from '../QtGui/QIcon';
|
||||
import { TabPosition } from '../QtEnums';
|
||||
|
||||
export interface QTabWidgetSignals {
|
||||
export interface QTabWidgetSignals extends QWidgetSignals {
|
||||
currentChanged: (index: number) => void;
|
||||
tabBarClicked: (index: number) => void;
|
||||
tabBarDoubleClicked: (index: number) => void;
|
||||
|
||||
@ -3,9 +3,9 @@ import { NodeWidget } from './QWidget';
|
||||
import { NativeElement, Component } from '../core/Component';
|
||||
import { ScrollHint, SortOrder } from '../QtEnums';
|
||||
import { QTableWidgetItem } from './QTableWidgetItem';
|
||||
import { QAbstractScrollArea } from './QAbstractScrollArea';
|
||||
import { QAbstractScrollArea, QAbstractScrollAreaSignals } from './QAbstractScrollArea';
|
||||
|
||||
export interface QTableWidgetSignals {
|
||||
export interface QTableWidgetSignals extends QAbstractScrollAreaSignals {
|
||||
cellActivated: (row: number, col: number) => void;
|
||||
cellChanged: (row: number, col: number) => void;
|
||||
cellClicked: (row: number, col: number) => void;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from './QWidget';
|
||||
import { NativeElement } from '../core/Component';
|
||||
import { QAbstractScrollArea } from './QAbstractScrollArea';
|
||||
import { QAbstractScrollArea, QAbstractScrollAreaSignals } from './QAbstractScrollArea';
|
||||
import { QTreeWidgetItem } from './QTreeWidgetItem';
|
||||
|
||||
export interface QTreeWidgetSignals {
|
||||
export interface QTreeWidgetSignals extends QAbstractScrollAreaSignals {
|
||||
itemSelectionChanged: () => void;
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import { QRect } from '../QtCore/QRect';
|
||||
import { QObjectSignals } from '../QtCore/QObject';
|
||||
// All Widgets should extend from NodeWidget
|
||||
// Implement all native QWidget methods here so that all widgets get access to those aswell
|
||||
export abstract class NodeWidget<Signals> extends YogaWidget<Signals> {
|
||||
export abstract class NodeWidget<Signals extends QWidgetSignals> extends YogaWidget<Signals> {
|
||||
layout?: NodeLayout<Signals>;
|
||||
_rawInlineStyle = '';
|
||||
type = 'widget';
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import addon from '../utils/addon';
|
||||
import { NodeWidget } from '../QtWidgets/QWidget';
|
||||
import { NodeLayout } from '../QtWidgets/QLayout';
|
||||
import { NodeLayout, QLayoutSignals } from '../QtWidgets/QLayout';
|
||||
import { FlexNode } from './YogaWidget';
|
||||
import { NativeElement } from './Component';
|
||||
|
||||
export type FlexLayoutSignals = {};
|
||||
export type FlexLayoutSignals = QLayoutSignals;
|
||||
export class FlexLayout extends NodeLayout<FlexLayoutSignals> {
|
||||
native: NativeElement;
|
||||
protected flexNode?: FlexNode;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import postcss from 'postcss';
|
||||
import cuid from 'cuid';
|
||||
import nodeguiAutoPrefixer from 'postcss-nodegui-autoprefixer';
|
||||
import { NodeWidget } from '../../QtWidgets/QWidget';
|
||||
import { NodeWidget, QWidgetSignals } from '../../QtWidgets/QWidget';
|
||||
export class StyleSheet {
|
||||
static create(cssString: string): string {
|
||||
try {
|
||||
@ -13,7 +13,10 @@ export class StyleSheet {
|
||||
}
|
||||
}
|
||||
|
||||
export function prepareInlineStyleSheet<Signals>(widget: NodeWidget<Signals>, rawStyle: string): string {
|
||||
export function prepareInlineStyleSheet<Signals extends QWidgetSignals>(
|
||||
widget: NodeWidget<Signals>,
|
||||
rawStyle: string,
|
||||
): string {
|
||||
const inlineStyle = StyleSheet.create(rawStyle);
|
||||
// Make sure to not calculate ObjectName in the same pass of event loop as other props (incase of react) since the order will matter in that case
|
||||
// So doing it in multiple passes of event loop allows objectName to be set before using it. The above await solves it.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { NodeObject } from '../QtCore/QObject';
|
||||
import { NodeObject, QObjectSignals } from '../QtCore/QObject';
|
||||
|
||||
export type FlexNode = {};
|
||||
export abstract class YogaWidget<Signals> extends NodeObject<Signals> {
|
||||
export abstract class YogaWidget<Signals extends QObjectSignals> extends NodeObject<Signals> {
|
||||
getFlexNode(): FlexNode {
|
||||
return this.native.getFlexNode();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user