Merge pull request #104 from nodegui/fix/cleanup-addons-import

Cleanup and exports for 3rd party addon support
This commit is contained in:
Atul R 2019-09-21 00:13:05 +02:00 committed by GitHub
commit b833fe89ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 37 additions and 502 deletions

View File

@ -21,7 +21,6 @@
"postinstall": "npm run build:addon",
"build": "tsc && npm run build:addon",
"build:addon": "cross-env CMAKE_BUILD_PARALLEL_LEVEL=8 cmake-js compile",
"automoc": "node ./scripts/automoc.js",
"docs": "serve docs"
},
"dependencies": {

View File

@ -1,75 +0,0 @@
const path = require("path");
const fs = require("fs");
const childProcess = require("child_process");
const { qtHome } = require("@nodegui/qode");
const ROOT_DIR = path.resolve(__dirname, "../");
const MOC_AUTOGEN_DIR = path.resolve(ROOT_DIR, "src/cpp/autogen");
const MOC_GYPI_FILE = path.resolve(ROOT_DIR, "config/moc.gypi");
const getConfig = () => {
const configFilePath = path.resolve(ROOT_DIR, "config/moc.json");
return JSON.parse(fs.readFileSync(configFilePath));
};
const generateCommand = (headerFilePath, includeFilePath) => {
const infilePath = path.resolve(ROOT_DIR, headerFilePath);
const parsed = path.parse(infilePath);
const outfilePath = path.format({
dir: MOC_AUTOGEN_DIR,
name: `${parsed.name}_moc`,
ext: ".cpp"
});
const command = `moc ${infilePath} -o ${outfilePath} --include ${includeFilePath}`;
return {
command,
infilePath,
outfilePath
};
};
const generateMocGypiFile = outFilePaths => {
const sources = outFilePaths.map(eachOutFilePath => {
return path.relative(path.parse(MOC_GYPI_FILE).dir, eachOutFilePath);
});
const gypiConfig = {
sources: sources
};
const comment = `# AUTOGENERATED FILE. DO NOT MODIFY . ALL CHANGES WILL BE LOST\n# RUN: npm run automoc after updating moc.json\n`;
console.log("Updating moc.gypi...");
const fileContent = JSON.stringify(gypiConfig, null, 4);
fs.writeFileSync(MOC_GYPI_FILE, comment.concat(fileContent));
console.log("Updated moc.gypi");
};
const main = () => {
const config = getConfig();
const includeFilePath = path.resolve(ROOT_DIR, config.include);
const outFiles = config.headers.map(eachHeaderPath => {
const { command, outfilePath } = generateCommand(
eachHeaderPath,
includeFilePath
);
const mocPath = path.resolve(process.env.QT_INSTALL_DIR || qtHome, "bin");
childProcess.exec(
command,
{
env: {
...process.env,
PATH: `${mocPath}${path.delimiter}${process.env.PATH}`
}
},
error => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
}
);
return outfilePath;
});
generateMocGypiFile(outFiles);
};
main();

View File

@ -3,8 +3,6 @@
#include <QWidget>
#include "deps/spdlog/spdlog.h"
void extrautils::noop(){}
YGSize extrautils::measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode){
FlexLayout::NodeContext *ctx = FlexLayout::getNodeContext(node);
if(ctx){

View File

@ -3,7 +3,6 @@
#include "src/cpp/core/FlexLayout/flexlayout.h"
namespace extrautils {
void noop();
YGSize measureQtWidget (YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode);
}

View File

@ -1,337 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'ntabwidget.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.13.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <memory>
#include "../QtWidgets/QTabWidget/ntabwidget.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'ntabwidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.13.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_NTabWidget_t {
QByteArrayData data[47];
char stringdata0[547];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_NTabWidget_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_NTabWidget_t qt_meta_stringdata_NTabWidget = {
{
QT_MOC_LITERAL(0, 0, 10), // "NTabWidget"
QT_MOC_LITERAL(1, 11, 8), // "yDisplay"
QT_MOC_LITERAL(2, 20, 11), // "yAlignItems"
QT_MOC_LITERAL(3, 32, 13), // "yAlignContent"
QT_MOC_LITERAL(4, 46, 10), // "yAlignSelf"
QT_MOC_LITERAL(5, 57, 15), // "yJustifyContent"
QT_MOC_LITERAL(6, 73, 10), // "yDirection"
QT_MOC_LITERAL(7, 84, 14), // "yFlexDirection"
QT_MOC_LITERAL(8, 99, 9), // "yOverflow"
QT_MOC_LITERAL(9, 109, 9), // "yPosition"
QT_MOC_LITERAL(10, 119, 9), // "yFlexWrap"
QT_MOC_LITERAL(11, 129, 5), // "yFlex"
QT_MOC_LITERAL(12, 135, 9), // "yFlexGrow"
QT_MOC_LITERAL(13, 145, 11), // "yFlexShrink"
QT_MOC_LITERAL(14, 157, 12), // "yAspectRatio"
QT_MOC_LITERAL(15, 170, 4), // "yTop"
QT_MOC_LITERAL(16, 175, 6), // "yRight"
QT_MOC_LITERAL(17, 182, 7), // "yBottom"
QT_MOC_LITERAL(18, 190, 5), // "yLeft"
QT_MOC_LITERAL(19, 196, 10), // "yFlexBasis"
QT_MOC_LITERAL(20, 207, 9), // "yMinWidth"
QT_MOC_LITERAL(21, 217, 10), // "yMinHeight"
QT_MOC_LITERAL(22, 228, 6), // "yWidth"
QT_MOC_LITERAL(23, 235, 7), // "yHeight"
QT_MOC_LITERAL(24, 243, 9), // "yMaxWidth"
QT_MOC_LITERAL(25, 253, 10), // "yMaxHeight"
QT_MOC_LITERAL(26, 264, 11), // "yPaddingTop"
QT_MOC_LITERAL(27, 276, 13), // "yPaddingRight"
QT_MOC_LITERAL(28, 290, 14), // "yPaddingBottom"
QT_MOC_LITERAL(29, 305, 12), // "yPaddingLeft"
QT_MOC_LITERAL(30, 318, 18), // "yPaddingHorizontal"
QT_MOC_LITERAL(31, 337, 16), // "yPaddingVertical"
QT_MOC_LITERAL(32, 354, 8), // "yPadding"
QT_MOC_LITERAL(33, 363, 10), // "yMarginTop"
QT_MOC_LITERAL(34, 374, 12), // "yMarginRight"
QT_MOC_LITERAL(35, 387, 13), // "yMarginBottom"
QT_MOC_LITERAL(36, 401, 11), // "yMarginLeft"
QT_MOC_LITERAL(37, 413, 17), // "yMarginHorizontal"
QT_MOC_LITERAL(38, 431, 15), // "yMarginVertical"
QT_MOC_LITERAL(39, 447, 7), // "yMargin"
QT_MOC_LITERAL(40, 455, 10), // "yBorderTop"
QT_MOC_LITERAL(41, 466, 12), // "yBorderRight"
QT_MOC_LITERAL(42, 479, 13), // "yBorderBottom"
QT_MOC_LITERAL(43, 493, 11), // "yBorderLeft"
QT_MOC_LITERAL(44, 505, 17), // "yBorderHorizontal"
QT_MOC_LITERAL(45, 523, 15), // "yBorderVertical"
QT_MOC_LITERAL(46, 539, 7) // "yBorder"
},
"NTabWidget\0yDisplay\0yAlignItems\0"
"yAlignContent\0yAlignSelf\0yJustifyContent\0"
"yDirection\0yFlexDirection\0yOverflow\0"
"yPosition\0yFlexWrap\0yFlex\0yFlexGrow\0"
"yFlexShrink\0yAspectRatio\0yTop\0yRight\0"
"yBottom\0yLeft\0yFlexBasis\0yMinWidth\0"
"yMinHeight\0yWidth\0yHeight\0yMaxWidth\0"
"yMaxHeight\0yPaddingTop\0yPaddingRight\0"
"yPaddingBottom\0yPaddingLeft\0"
"yPaddingHorizontal\0yPaddingVertical\0"
"yPadding\0yMarginTop\0yMarginRight\0"
"yMarginBottom\0yMarginLeft\0yMarginHorizontal\0"
"yMarginVertical\0yMargin\0yBorderTop\0"
"yBorderRight\0yBorderBottom\0yBorderLeft\0"
"yBorderHorizontal\0yBorderVertical\0"
"yBorder"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_NTabWidget[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
46, 14, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// properties: name, type, flags
1, QMetaType::QString, 0x00095103,
2, QMetaType::QString, 0x00095103,
3, QMetaType::QString, 0x00095103,
4, QMetaType::QString, 0x00095103,
5, QMetaType::QString, 0x00095103,
6, QMetaType::QString, 0x00095103,
7, QMetaType::QString, 0x00095103,
8, QMetaType::QString, 0x00095103,
9, QMetaType::QString, 0x00095103,
10, QMetaType::QString, 0x00095103,
11, QMetaType::Float, 0x00095103,
12, QMetaType::Float, 0x00095103,
13, QMetaType::Float, 0x00095103,
14, QMetaType::Float, 0x00095103,
15, QMetaType::QString, 0x00095003,
16, QMetaType::QString, 0x00095003,
17, QMetaType::QString, 0x00095003,
18, QMetaType::QString, 0x00095003,
19, QMetaType::QString, 0x00095103,
20, QMetaType::QString, 0x00095103,
21, QMetaType::QString, 0x00095103,
22, QMetaType::QString, 0x00095103,
23, QMetaType::QString, 0x00095103,
24, QMetaType::QString, 0x00095103,
25, QMetaType::QString, 0x00095103,
26, QMetaType::QString, 0x00095103,
27, QMetaType::QString, 0x00095103,
28, QMetaType::QString, 0x00095103,
29, QMetaType::QString, 0x00095103,
30, QMetaType::QString, 0x00095103,
31, QMetaType::QString, 0x00095103,
32, QMetaType::QString, 0x00095103,
33, QMetaType::QString, 0x00095103,
34, QMetaType::QString, 0x00095103,
35, QMetaType::QString, 0x00095103,
36, QMetaType::QString, 0x00095103,
37, QMetaType::QString, 0x00095103,
38, QMetaType::QString, 0x00095103,
39, QMetaType::QString, 0x00095003,
40, QMetaType::Float, 0x00095103,
41, QMetaType::Float, 0x00095103,
42, QMetaType::Float, 0x00095103,
43, QMetaType::Float, 0x00095103,
44, QMetaType::Float, 0x00095103,
45, QMetaType::Float, 0x00095103,
46, QMetaType::Float, 0x00095103,
0 // eod
};
void NTabWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
auto *_t = static_cast<NTabWidget *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = _t->_yDisplay; break;
case 1: *reinterpret_cast< QString*>(_v) = _t->_yAlignItems; break;
case 2: *reinterpret_cast< QString*>(_v) = _t->_yAlignContent; break;
case 3: *reinterpret_cast< QString*>(_v) = _t->_yAlignSelf; break;
case 4: *reinterpret_cast< QString*>(_v) = _t->_yJustifyContent; break;
case 5: *reinterpret_cast< QString*>(_v) = _t->_yDirection; break;
case 6: *reinterpret_cast< QString*>(_v) = _t->_yFlexDirection; break;
case 7: *reinterpret_cast< QString*>(_v) = _t->_yOverflow; break;
case 8: *reinterpret_cast< QString*>(_v) = _t->_yPosition; break;
case 9: *reinterpret_cast< QString*>(_v) = _t->_yFlexWrap; break;
case 10: *reinterpret_cast< float*>(_v) = _t->_yFlex; break;
case 11: *reinterpret_cast< float*>(_v) = _t->_yFlexGrow; break;
case 12: *reinterpret_cast< float*>(_v) = _t->_yFlexShrink; break;
case 13: *reinterpret_cast< float*>(_v) = _t->_yAspectRatio; break;
case 14: *reinterpret_cast< QString*>(_v) = _t->_yTop; break;
case 15: *reinterpret_cast< QString*>(_v) = _t->_yRight; break;
case 16: *reinterpret_cast< QString*>(_v) = _t->_yBottom; break;
case 17: *reinterpret_cast< QString*>(_v) = _t->_yLeft; break;
case 18: *reinterpret_cast< QString*>(_v) = _t->_yFlexBasis; break;
case 19: *reinterpret_cast< QString*>(_v) = _t->_yMinWidth; break;
case 20: *reinterpret_cast< QString*>(_v) = _t->_yMinHeight; break;
case 21: *reinterpret_cast< QString*>(_v) = _t->_yWidth; break;
case 22: *reinterpret_cast< QString*>(_v) = _t->_yHeight; break;
case 23: *reinterpret_cast< QString*>(_v) = _t->_yMaxWidth; break;
case 24: *reinterpret_cast< QString*>(_v) = _t->_yMaxHeight; break;
case 25: *reinterpret_cast< QString*>(_v) = _t->_yPaddingTop; break;
case 26: *reinterpret_cast< QString*>(_v) = _t->_yPaddingRight; break;
case 27: *reinterpret_cast< QString*>(_v) = _t->_yPaddingBottom; break;
case 28: *reinterpret_cast< QString*>(_v) = _t->_yPaddingLeft; break;
case 29: *reinterpret_cast< QString*>(_v) = _t->_yPaddingHorizontal; break;
case 30: *reinterpret_cast< QString*>(_v) = _t->_yPaddingVertical; break;
case 31: *reinterpret_cast< QString*>(_v) = _t->_yPadding; break;
case 32: *reinterpret_cast< QString*>(_v) = _t->_yMarginTop; break;
case 33: *reinterpret_cast< QString*>(_v) = _t->_yMarginRight; break;
case 34: *reinterpret_cast< QString*>(_v) = _t->_yMarginBottom; break;
case 35: *reinterpret_cast< QString*>(_v) = _t->_yMarginLeft; break;
case 36: *reinterpret_cast< QString*>(_v) = _t->_yMarginHorizontal; break;
case 37: *reinterpret_cast< QString*>(_v) = _t->_yMarginVertical; break;
case 38: *reinterpret_cast< QString*>(_v) = _t->_yMargin; break;
case 39: *reinterpret_cast< float*>(_v) = _t->_yBorderTop; break;
case 40: *reinterpret_cast< float*>(_v) = _t->_yBorderRight; break;
case 41: *reinterpret_cast< float*>(_v) = _t->_yBorderBottom; break;
case 42: *reinterpret_cast< float*>(_v) = _t->_yBorderLeft; break;
case 43: *reinterpret_cast< float*>(_v) = _t->_yBorderHorizontal; break;
case 44: *reinterpret_cast< float*>(_v) = _t->_yBorderVertical; break;
case 45: *reinterpret_cast< float*>(_v) = _t->_yBorder; break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
auto *_t = static_cast<NTabWidget *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setYDisplay(*reinterpret_cast< QString*>(_v)); break;
case 1: _t->setYAlignItems(*reinterpret_cast< QString*>(_v)); break;
case 2: _t->setYAlignContent(*reinterpret_cast< QString*>(_v)); break;
case 3: _t->setYAlignSelf(*reinterpret_cast< QString*>(_v)); break;
case 4: _t->setYJustifyContent(*reinterpret_cast< QString*>(_v)); break;
case 5: _t->setYDirection(*reinterpret_cast< QString*>(_v)); break;
case 6: _t->setYFlexDirection(*reinterpret_cast< QString*>(_v)); break;
case 7: _t->setYOverflow(*reinterpret_cast< QString*>(_v)); break;
case 8: _t->setYPosition(*reinterpret_cast< QString*>(_v)); break;
case 9: _t->setYFlexWrap(*reinterpret_cast< QString*>(_v)); break;
case 10: _t->setYFlex(*reinterpret_cast< float*>(_v)); break;
case 11: _t->setYFlexGrow(*reinterpret_cast< float*>(_v)); break;
case 12: _t->setYFlexShrink(*reinterpret_cast< float*>(_v)); break;
case 13: _t->setYAspectRatio(*reinterpret_cast< float*>(_v)); break;
case 14: _t->setYNodeTop(*reinterpret_cast< QString*>(_v)); break;
case 15: _t->setYNodeRight(*reinterpret_cast< QString*>(_v)); break;
case 16: _t->setYNodeBottom(*reinterpret_cast< QString*>(_v)); break;
case 17: _t->setYNodeLeft(*reinterpret_cast< QString*>(_v)); break;
case 18: _t->setYFlexBasis(*reinterpret_cast< QString*>(_v)); break;
case 19: _t->setYMinWidth(*reinterpret_cast< QString*>(_v)); break;
case 20: _t->setYMinHeight(*reinterpret_cast< QString*>(_v)); break;
case 21: _t->setYWidth(*reinterpret_cast< QString*>(_v)); break;
case 22: _t->setYHeight(*reinterpret_cast< QString*>(_v)); break;
case 23: _t->setYMaxWidth(*reinterpret_cast< QString*>(_v)); break;
case 24: _t->setYMaxHeight(*reinterpret_cast< QString*>(_v)); break;
case 25: _t->setYPaddingTop(*reinterpret_cast< QString*>(_v)); break;
case 26: _t->setYPaddingRight(*reinterpret_cast< QString*>(_v)); break;
case 27: _t->setYPaddingBottom(*reinterpret_cast< QString*>(_v)); break;
case 28: _t->setYPaddingLeft(*reinterpret_cast< QString*>(_v)); break;
case 29: _t->setYPaddingHorizontal(*reinterpret_cast< QString*>(_v)); break;
case 30: _t->setYPaddingVertical(*reinterpret_cast< QString*>(_v)); break;
case 31: _t->setYPadding(*reinterpret_cast< QString*>(_v)); break;
case 32: _t->setYMarginTop(*reinterpret_cast< QString*>(_v)); break;
case 33: _t->setYMarginRight(*reinterpret_cast< QString*>(_v)); break;
case 34: _t->setYMarginBottom(*reinterpret_cast< QString*>(_v)); break;
case 35: _t->setYMarginLeft(*reinterpret_cast< QString*>(_v)); break;
case 36: _t->setYMarginHorizontal(*reinterpret_cast< QString*>(_v)); break;
case 37: _t->setYMarginVertical(*reinterpret_cast< QString*>(_v)); break;
case 38: _t->setYMarginAll(*reinterpret_cast< QString*>(_v)); break;
case 39: _t->setYBorderTop(*reinterpret_cast< float*>(_v)); break;
case 40: _t->setYBorderRight(*reinterpret_cast< float*>(_v)); break;
case 41: _t->setYBorderBottom(*reinterpret_cast< float*>(_v)); break;
case 42: _t->setYBorderLeft(*reinterpret_cast< float*>(_v)); break;
case 43: _t->setYBorderHorizontal(*reinterpret_cast< float*>(_v)); break;
case 44: _t->setYBorderVertical(*reinterpret_cast< float*>(_v)); break;
case 45: _t->setYBorder(*reinterpret_cast< float*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
QT_INIT_METAOBJECT const QMetaObject NTabWidget::staticMetaObject = { {
&QTabWidget::staticMetaObject,
qt_meta_stringdata_NTabWidget.data,
qt_meta_data_NTabWidget,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *NTabWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *NTabWidget::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_NTabWidget.stringdata0))
return static_cast<void*>(this);
if (!strcmp(_clname, "NodeWidget"))
return static_cast< NodeWidget*>(this);
return QTabWidget::qt_metacast(_clname);
}
int NTabWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QTabWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 46;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 46;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 46;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 46;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 46;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 46;
}
#endif // QT_NO_PROPERTIES
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE

View File

@ -11,7 +11,7 @@ export { QTextOptionWrapMode } from "./lib/QtGui/QTextOption";
export { QClipboard, QClipboardMode } from "./lib/QtGui/QClipboard";
// Events: Maybe a separate module ?
export { QKeyEvent } from "./lib/QtGui/QEvent/QKeyEvent";
export { NativeEvent } from "./lib/core/EventWidget";
export { NativeEvent, BaseWidgetEvents } from "./lib/core/EventWidget";
// Abstract:
export { NodeWidget } from "./lib/QtWidgets/QWidget";
export { NodeLayout } from "./lib/QtWidgets/QLayout";
@ -40,3 +40,4 @@ export { QGridLayout } from "./lib/QtWidgets/QGridLayout";
export { FlexLayout } from "./lib/core/FlexLayout";
// Others:
export { StyleSheet } from "./lib/core/Style/StyleSheet";
export { NativeElement, Component } from "./lib/core/Component";

View File

@ -1,6 +1,6 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { Component, NativeElement } from "../../core/Component";
import { checkIfNativeElement } from "../../utils";
import { checkIfNativeElement } from "../../utils/helpers";
import { QClipboard } from "../QClipboard";
type arg = NativeElement;

View File

@ -1,5 +1,5 @@
import { Component, NativeElement } from "../../core/Component";
import { checkIfNativeElement } from "../../utils";
import { checkIfNativeElement } from "../../utils/helpers";
export class QClipboard extends Component {
native: NativeElement;

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { Component, NativeElement } from "../../core/Component";
import { QPixmap } from "../QPixmap";
@ -15,8 +15,8 @@ export class QCursor extends Component {
}
pos = (): { x: number; y: number } => {
return this.native.pos();
}
};
setPos = (x: number, y: number) => {
return this.native.setPos(x, y);
}
};
}

View File

@ -1,4 +1,4 @@
import addon from "../../../core/addon";
import addon from "../../../utils/addon";
import { NativeElement } from "../../../core/Component";
import { NativeEvent } from "../../../core/EventWidget";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { Component, NativeElement } from "../../core/Component";
import { QPixmap } from "../../QtGui/QPixmap";

View File

@ -1,7 +1,7 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { Component, NativeElement } from "../../core/Component";
import { AspectRatioMode } from "../../QtEnums";
import { checkIfNativeElement } from "../../utils";
import { checkIfNativeElement } from "../../utils/helpers";
type arg = string | NativeElement;
export class QPixmap extends Component {

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { NodeLayout } from "../QLayout";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../QWidget";
import { BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";

View File

@ -1,4 +1,4 @@
import addon from "../../core/addon";
import addon from "../../utils/addon";
import { NodeLayout } from "../QLayout";
import { EventWidget, BaseWidgetEvents } from "../../core/EventWidget";
import { NativeElement } from "../../core/Component";
@ -12,7 +12,7 @@ import {
StyleSheet,
prepareInlineStyleSheet
} from "../../core/Style/StyleSheet";
import { checkIfNativeElement } from "../../utils";
import { checkIfNativeElement } from "../../utils/helpers";
// 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 extends EventWidget {

View File

@ -1,4 +1,4 @@
import addon from "../addon";
import addon from "../../utils/addon";
import { NodeWidget } from "../../QtWidgets/QWidget";
import { NodeLayout } from "../../QtWidgets/QLayout";
import { FlexNode } from "../YogaWidget";

View File

@ -1,4 +1,4 @@
import { NativeElement } from "./core/Component";
import { NativeElement } from "../core/Component";
export const checkIfNativeElement = (arg: any) => {
const nativeArg = arg as NativeElement;

View File

@ -1,63 +1,13 @@
{
"compilerOptions": {
/* Basic Options */
"target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"declaration": true /* Generates corresponding '.d.ts' file. */,
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist" /* Redirect output structure to the directory. */,
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "incremental": true, /* Enable incremental compilation */
// "tsBuildInfoFile": ".cache/tsconfig.tsbuildinfo" /* Specify file to store incremental compilation information */,
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
// "paths": {} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [] /* Type declaration files to be included in compilation. */,
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"target": "ES2015",
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"outDir": "./dist",
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true
},
"include": ["src"]