Skip to content

Commit

Permalink
Add setWindowFlags to QMainWindowWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
maciek134 committed Aug 13, 2020
1 parent 594cae6 commit a48423f
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 41 deletions.
50 changes: 50 additions & 0 deletions lib/qt.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,54 @@ qt.AspectRatioMode = {
};
Object.freeze(qt.AspectRatioMode);

qt.WindowType = {
Widget: 0x00000000,
Window: 0x00000001,
SubWindow: 0x00000012,

WindowType_Mask: 0x000000ff,
MSWindowsFixedSizeDialogHint: 0x00000100,
MSWindowsOwnDC: 0x00000200,
BypassWindowManagerHint: 0x00000400,
FramelessWindowHint: 0x00000800,
WindowTitleHint: 0x00001000,
WindowSystemMenuHint: 0x00002000,
WindowMinimizeButtonHint: 0x00004000,
WindowMaximizeButtonHint: 0x00008000,
WindowContextHelpButtonHint: 0x00010000,
WindowShadeButtonHint: 0x00020000,
WindowStaysOnTopHint: 0x00040000,
WindowTransparentForInput: 0x00080000,
WindowOverridesSystemGestures: 0x00100000,
WindowDoesNotAcceptFocus: 0x00200000,
MaximizeUsingFullscreenGeometryHint: 0x00400000,

CustomizeWindowHint: 0x02000000,
WindowStaysOnBottomHint: 0x04000000,
WindowCloseButtonHint: 0x08000000,
MacWindowToolBarButtonHint: 0x10000000,
BypassGraphicsProxyWidget: 0x20000000,
NoDropShadowWindowHint: 0x40000000,
WindowFullscreenButtonHint: 0x80000000
};
qt.WindowType = {
...qt.WindowType,
Dialog: 0x00000002 | qt.WindowType.Window,
Sheet: 0x00000004 | qt.WindowType.Window,
Popup: 0x00000008 | qt.WindowType.Window,
Desktop: 0x00000010 | qt.WindowType.Window,
ForeignWindow: 0x00000020 | qt.WindowType.Window,
CoverWindow: 0x00000040 | qt.WindowType.Window,
X11BypassWindowManagerHint: qt.WindowType.BypassWindowManagerHint,
WindowMinMaxButtonsHint: qt.WindowType.WindowMinimizeButtonHint | qt.WindowType.WindowMaximizeButtonHint,
};
qt.WindowType = {
...qt.WindowType,
Drawer: qt.WindowType.Sheet | qt.WindowType.Dialog,
Tool: qt.WindowType.Popup | qt.WindowType.Dialog,
ToolTip: qt.WindowType.Popup | qt.WindowType.Sheet,
SplashScreen: qt.WindowType.Popup | qt.WindowType.Sheet | qt.WindowType.Dialog,
}
Object.freeze(qt.WindowType);

module.exports = qt;
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions src/QtGui/qapplication.moc
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/****************************************************************************
** Meta object code from reading C++ file 'qapplication.hpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.5)
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include <memory>
#include "qapplication.hpp"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qapplication.hpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.5. It"
#error "This file was generated using the moc from 5.15.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
Expand Down Expand Up @@ -44,7 +45,7 @@ QT_MOC_LITERAL(2, 39, 0) // ""
static const uint qt_meta_data_SlotHandlerApplication[] = {

// content:
7, // revision
8, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
Expand All @@ -66,7 +67,7 @@ static const uint qt_meta_data_SlotHandlerApplication[] = {
void SlotHandlerApplication::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SlotHandlerApplication *_t = static_cast<SlotHandlerApplication *>(_o);
auto *_t = static_cast<SlotHandlerApplication *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->aboutToQuitSlot(); break;
Expand All @@ -76,10 +77,14 @@ void SlotHandlerApplication::qt_static_metacall(QObject *_o, QMetaObject::Call _
Q_UNUSED(_a);
}

const QMetaObject SlotHandlerApplication::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_SlotHandlerApplication.data,
qt_meta_data_SlotHandlerApplication, qt_static_metacall, nullptr, nullptr}
};
QT_INIT_METAOBJECT const QMetaObject SlotHandlerApplication::staticMetaObject = { {
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
qt_meta_stringdata_SlotHandlerApplication.data,
qt_meta_data_SlotHandlerApplication,
qt_static_metacall,
nullptr,
nullptr
} };


const QMetaObject *SlotHandlerApplication::metaObject() const
Expand Down
21 changes: 13 additions & 8 deletions src/QtGui/qcombobox.moc
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/****************************************************************************
** Meta object code from reading C++ file 'qcombobox.hpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.5)
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include <memory>
#include "qcombobox.hpp"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qcombobox.hpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.5. It"
#error "This file was generated using the moc from 5.15.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
Expand Down Expand Up @@ -46,7 +47,7 @@ QT_MOC_LITERAL(4, 49, 13) // "activatedSlot"
static const uint qt_meta_data_SlotHandlerComboBox[] = {

// content:
7, // revision
8, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
Expand All @@ -70,7 +71,7 @@ static const uint qt_meta_data_SlotHandlerComboBox[] = {
void SlotHandlerComboBox::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SlotHandlerComboBox *_t = static_cast<SlotHandlerComboBox *>(_o);
auto *_t = static_cast<SlotHandlerComboBox *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->currentTextChangedSlot((*reinterpret_cast< const QString(*)>(_a[1]))); break;
Expand All @@ -80,10 +81,14 @@ void SlotHandlerComboBox::qt_static_metacall(QObject *_o, QMetaObject::Call _c,
}
}

const QMetaObject SlotHandlerComboBox::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_SlotHandlerComboBox.data,
qt_meta_data_SlotHandlerComboBox, qt_static_metacall, nullptr, nullptr}
};
QT_INIT_METAOBJECT const QMetaObject SlotHandlerComboBox::staticMetaObject = { {
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
qt_meta_stringdata_SlotHandlerComboBox.data,
qt_meta_data_SlotHandlerComboBox,
qt_static_metacall,
nullptr,
nullptr
} };


const QMetaObject *SlotHandlerComboBox::metaObject() const
Expand Down
21 changes: 13 additions & 8 deletions src/QtGui/qlineedit.moc
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/****************************************************************************
** Meta object code from reading C++ file 'qlineedit.hpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.5)
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include <memory>
#include "qlineedit.hpp"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qlineedit.hpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.5. It"
#error "This file was generated using the moc from 5.15.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
Expand Down Expand Up @@ -45,7 +46,7 @@ QT_MOC_LITERAL(3, 37, 4) // "text"
static const uint qt_meta_data_SlotHandlerLineEdit[] = {

// content:
7, // revision
8, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
Expand All @@ -67,7 +68,7 @@ static const uint qt_meta_data_SlotHandlerLineEdit[] = {
void SlotHandlerLineEdit::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SlotHandlerLineEdit *_t = static_cast<SlotHandlerLineEdit *>(_o);
auto *_t = static_cast<SlotHandlerLineEdit *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->textChangedSlot((*reinterpret_cast< const QString(*)>(_a[1]))); break;
Expand All @@ -76,10 +77,14 @@ void SlotHandlerLineEdit::qt_static_metacall(QObject *_o, QMetaObject::Call _c,
}
}

const QMetaObject SlotHandlerLineEdit::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_SlotHandlerLineEdit.data,
qt_meta_data_SlotHandlerLineEdit, qt_static_metacall, nullptr, nullptr}
};
QT_INIT_METAOBJECT const QMetaObject SlotHandlerLineEdit::staticMetaObject = { {
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
qt_meta_stringdata_SlotHandlerLineEdit.data,
qt_meta_data_SlotHandlerLineEdit,
qt_static_metacall,
nullptr,
nullptr
} };


const QMetaObject *SlotHandlerLineEdit::metaObject() const
Expand Down
17 changes: 17 additions & 0 deletions src/QtGui/qmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Napi::Object QMainWindowWrap::Init(Napi::Env env, Napi::Object exports)
// clang-format off
Napi::Function func = DefineClass(env, "QMainWindow", {
InstanceMethod("getClosed", &QMainWindowWrap::getClosed),
InstanceMethod("setWindowFlags", &QMainWindowWrap::setWindowFlags),
QWIDGET_JS_DEFINES(QMainWindowWrap)
});
// clang-format on
Expand Down Expand Up @@ -51,5 +52,21 @@ Napi::Value QMainWindowWrap::getClosed(const Napi::CallbackInfo &info)
return Napi::Boolean::New(env, q_->closed);
}

Napi::Value QMainWindowWrap::setWindowFlags(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
Napi::HandleScope scope(env);
Napi::Number flags;
if (info.Length() <= 0 || !info[0].IsNumber()) {
flags = Napi::Number::New(info.Env(), 0);
} else {
flags = info[0].As<Napi::Number>();
}

q_->setWindowFlags((Qt::WindowFlags)flags.Int32Value());

return Napi::Boolean::New(env, 1);
}

// QWidget functions
QWIDGET_BASE_FUNCS(QMainWindowWrap)
1 change: 1 addition & 0 deletions src/QtGui/qmainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class QMainWindowWrap : public Napi::ObjectWrap<QMainWindowWrap>
static Napi::FunctionReference constructor;

Napi::Value getClosed(const Napi::CallbackInfo &info);
Napi::Value setWindowFlags(const Napi::CallbackInfo &info);

// QWidget Funcs
QWIDGET_DEFS
Expand Down
21 changes: 13 additions & 8 deletions src/QtGui/qplaintextedit.moc
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/****************************************************************************
** Meta object code from reading C++ file 'qplaintextedit.hpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.5)
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include <memory>
#include "qplaintextedit.hpp"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qplaintextedit.hpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.5. It"
#error "This file was generated using the moc from 5.15.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
Expand Down Expand Up @@ -44,7 +45,7 @@ QT_MOC_LITERAL(2, 41, 0) // ""
static const uint qt_meta_data_SlotHandlerPlainTextEdit[] = {

// content:
7, // revision
8, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
Expand All @@ -66,7 +67,7 @@ static const uint qt_meta_data_SlotHandlerPlainTextEdit[] = {
void SlotHandlerPlainTextEdit::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SlotHandlerPlainTextEdit *_t = static_cast<SlotHandlerPlainTextEdit *>(_o);
auto *_t = static_cast<SlotHandlerPlainTextEdit *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->textChangedSlot(); break;
Expand All @@ -76,10 +77,14 @@ void SlotHandlerPlainTextEdit::qt_static_metacall(QObject *_o, QMetaObject::Call
Q_UNUSED(_a);
}

const QMetaObject SlotHandlerPlainTextEdit::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_SlotHandlerPlainTextEdit.data,
qt_meta_data_SlotHandlerPlainTextEdit, qt_static_metacall, nullptr, nullptr}
};
QT_INIT_METAOBJECT const QMetaObject SlotHandlerPlainTextEdit::staticMetaObject = { {
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
qt_meta_stringdata_SlotHandlerPlainTextEdit.data,
qt_meta_data_SlotHandlerPlainTextEdit,
qt_static_metacall,
nullptr,
nullptr
} };


const QMetaObject *SlotHandlerPlainTextEdit::metaObject() const
Expand Down
21 changes: 13 additions & 8 deletions src/QtGui/qpushbutton.moc
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/****************************************************************************
** Meta object code from reading C++ file 'qpushbutton.hpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.5)
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.15.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#include <memory>
#include "qpushbutton.hpp"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'qpushbutton.hpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.9.5. It"
#error "This file was generated using the moc from 5.15.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
Expand Down Expand Up @@ -44,7 +45,7 @@ QT_MOC_LITERAL(2, 41, 0) // ""
static const uint qt_meta_data_SlotHandlerPushButton[] = {

// content:
7, // revision
8, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
Expand All @@ -66,7 +67,7 @@ static const uint qt_meta_data_SlotHandlerPushButton[] = {
void SlotHandlerPushButton::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
SlotHandlerPushButton *_t = static_cast<SlotHandlerPushButton *>(_o);
auto *_t = static_cast<SlotHandlerPushButton *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->buttonReleasedSlot(); break;
Expand All @@ -76,10 +77,14 @@ void SlotHandlerPushButton::qt_static_metacall(QObject *_o, QMetaObject::Call _c
Q_UNUSED(_a);
}

const QMetaObject SlotHandlerPushButton::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_SlotHandlerPushButton.data,
qt_meta_data_SlotHandlerPushButton, qt_static_metacall, nullptr, nullptr}
};
QT_INIT_METAOBJECT const QMetaObject SlotHandlerPushButton::staticMetaObject = { {
QMetaObject::SuperData::link<QObject::staticMetaObject>(),
qt_meta_stringdata_SlotHandlerPushButton.data,
qt_meta_data_SlotHandlerPushButton,
qt_static_metacall,
nullptr,
nullptr
} };


const QMetaObject *SlotHandlerPushButton::metaObject() const
Expand Down

0 comments on commit a48423f

Please sign in to comment.