From 8793f172e3f1ab5b6bbf4d30a73d32f94b58dd83 Mon Sep 17 00:00:00 2001 From: Atul R Date: Thu, 19 Dec 2019 23:10:32 +0530 Subject: [PATCH] Cleanup and bump version (#285) * Cleans up and bumps version * Change to npm blacklist * geometry now returns QRect --- .npmignore | 9 + package-lock.json | 2 +- package.json | 10 +- .../nodegui/QtWidgets/QWidget/qwidget_macro.h | 12 - src/cpp/lib/core/Events/eventsmap.cpp | 472 ------------------ src/demo.ts | 4 +- src/lib/QtWidgets/QWidget.ts | 15 +- src/lib/QtWidgets/__tests__/QWidget.test.ts | 8 +- 8 files changed, 21 insertions(+), 511 deletions(-) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..0d8352b32 --- /dev/null +++ b/.npmignore @@ -0,0 +1,9 @@ +*.test.* +build +website +.* +!dist +extras/* +!extras/legal +src/* +!src/cpp \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5b51d29b3..f1af6dfad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@nodegui/nodegui", - "version": "0.10.0", + "version": "0.11.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a8d92817f..d4c0ff57f 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,9 @@ { "name": "@nodegui/nodegui", - "version": "0.10.0", + "version": "0.11.0", "description": "A cross platform library to build native desktop apps.", "main": "dist/index.js", "typings": "dist/index.d.ts", - "files": [ - "dist", - "config", - "CMakeLists.txt", - "src/cpp", - "extras/legal", - "plugin" - ], "author": "Atul R ", "license": "MIT", "private": false, diff --git a/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h index 6131ae108..e9962513e 100644 --- a/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h +++ b/src/cpp/include/nodegui/QtWidgets/QWidget/qwidget_macro.h @@ -174,17 +174,6 @@ this->instance->setGeometry(x, y, width, height); \ return env.Null(); \ } \ - Napi::Value geometry(const Napi::CallbackInfo& info) { \ - Napi::Env env = info.Env(); \ - Napi::HandleScope scope(env); \ - QRect geometry = this->instance->geometry(); \ - Napi::Object geometryObj = Napi::Object::New(env); \ - geometryObj.Set("width", geometry.width()); \ - geometryObj.Set("height", geometry.height()); \ - geometryObj.Set("x", geometry.x()); \ - geometryObj.Set("y", geometry.y()); \ - return geometryObj; \ - } \ Napi::Value setMaximumSize(const Napi::CallbackInfo& info) { \ Napi::Env env = info.Env(); \ Napi::HandleScope scope(env); \ @@ -352,7 +341,6 @@ InstanceMethod("isEnabled", &WidgetWrapName::isEnabled), \ InstanceMethod("setFixedSize", &WidgetWrapName::setFixedSize), \ InstanceMethod("setGeometry", &WidgetWrapName::setGeometry), \ - InstanceMethod("geometry", &WidgetWrapName::geometry), \ InstanceMethod("setMaximumSize", &WidgetWrapName::setMaximumSize), \ InstanceMethod("setMinimumSize", &WidgetWrapName::setMinimumSize), \ InstanceMethod("repaint", &WidgetWrapName::repaint), \ diff --git a/src/cpp/lib/core/Events/eventsmap.cpp b/src/cpp/lib/core/Events/eventsmap.cpp index 1e0a6340d..ebca377b6 100644 --- a/src/cpp/lib/core/Events/eventsmap.cpp +++ b/src/cpp/lib/core/Events/eventsmap.cpp @@ -150,475 +150,3 @@ std::unordered_map EventsMap::eventTypes{ {"WinIdChange", QEvent::WinIdChange}, {"ZOrderChange", QEvent::ZOrderChange}, }; - -// std::unordered_map keyEvents { -// {Qt::Key_Escape: 'Key_Escape'}, -// {Qt::Key_Tab: 'Key_Tab'}, -// {Qt::Key_Backtab: 'Key_Backtab'}, -// {Qt::Key_Backspace: 'Key_Backspace'}, -// {Qt::Key_Return: 'Key_Return'}, -// {Qt::Key_Enter: 'Key_Enter'}, -// {Qt::Key_Insert: 'Key_Insert'}, -// {Qt::Key_Delete: 'Key_Delete'}, -// {Qt::Key_Pause: 'Key_Pause'}, -// {Qt::Key_Print: 'Key_Print'}, -// {Qt::Key_SysReq: 'Key_SysReq'}, -// {Qt::Key_Clear: 'Key_Clear'}, -// {Qt::Key_Home: 'Key_Home'}, -// {Qt::Key_End: 'Key_End'}, -// {Qt::Key_Left: 'Key_Left'}, -// {Qt::Key_Up: 'Key_Up'}, -// {Qt::Key_Right: 'Key_Right'}, -// {Qt::Key_Down: 'Key_Down'}, -// {Qt::Key_PageUp: 'Key_PageUp'}, -// {Qt::Key_PageDown: 'Key_PageDown'}, -// {Qt::Key_Shift: 'Key_Shift'}, -// {Qt::Key_Control: 'Key_Control'}, -// {Qt::Key_Meta: 'Key_Meta'}, -// {Qt::Key_Alt: 'Key_Alt'}, -// {Qt::Key_AltGr: 'Key_AltGr'}, -// {Qt::Key_CapsLock: 'Key_CapsLock'}, -// {Qt::Key_NumLock: 'Key_NumLock'}, -// {Qt::Key_ScrollLock: 'Key_ScrollLock'}, -// {Qt::Key_F1: 'Key_F1'}, -// {Qt::Key_F2: 'Key_F2'}, -// {Qt::Key_F3: 'Key_F3'}, -// {Qt::Key_F4: 'Key_F4'}, -// {Qt::Key_F5: 'Key_F5'}, -// {Qt::Key_F6: 'Key_F6'}, -// {Qt::Key_F7: 'Key_F7'}, -// {Qt::Key_F8: 'Key_F8'}, -// {Qt::Key_F9: 'Key_F9'}, -// {Qt::Key_F10: 'Key_F10'}, -// {Qt::Key_F11: 'Key_F11'}, -// {Qt::Key_F12: 'Key_F12'}, -// {Qt::Key_F13: 'Key_F13'}, -// {Qt::Key_F14: 'Key_F14'}, -// {Qt::Key_F15: 'Key_F15'}, -// {Qt::Key_F16: 'Key_F16'}, -// {Qt::Key_F17: 'Key_F17'}, -// {Qt::Key_F18: 'Key_F18'}, -// {Qt::Key_F19: 'Key_F19'}, -// {Qt::Key_F20: 'Key_F20'}, -// {Qt::Key_F21: 'Key_F21'}, -// {Qt::Key_F22: 'Key_F22'}, -// {Qt::Key_F23: 'Key_F23'}, -// {Qt::Key_F24: 'Key_F24'}, -// {Qt::Key_F25: 'Key_F25'}, -// {Qt::Key_F26: 'Key_F26'}, -// {Qt::Key_F27: 'Key_F27'}, -// {Qt::Key_F28: 'Key_F28'}, -// {Qt::Key_F29: 'Key_F29'}, -// {Qt::Key_F30: 'Key_F30'}, -// {Qt::Key_F31: 'Key_F31'}, -// {Qt::Key_F32: 'Key_F32'}, -// {Qt::Key_F33: 'Key_F33'}, -// {Qt::Key_F34: 'Key_F34'}, -// {Qt::Key_F35: 'Key_F35'}, -// {Qt::Key_Super_L: 'Key_Super_L'}, -// {Qt::Key_Super_R: 'Key_Super_R'}, -// {Qt::Key_Menu: 'Key_Menu'}, -// {Qt::Key_Hyper_L: 'Key_Hyper_L'}, -// {Qt::Key_Hyper_R: 'Key_Hyper_R'}, -// {Qt::Key_Help: 'Key_Help'}, -// {Qt::Key_Direction_L: 'Key_Direction_L'}, -// {Qt::Key_Direction_R: 'Key_Direction_R'}, -// {Qt::Key_Space: 'Key_Space'}, -// {Qt::Key_Any: 'Key_Any'}, -// {Qt::Key_Exclam: 'Key_Exclam'}, -// {Qt::Key_QuoteDbl: 'Key_QuoteDbl'}, -// {Qt::Key_NumberSign: 'Key_NumberSign'}, -// {Qt::Key_Dollar: 'Key_Dollar'}, -// {Qt::Key_Percent: 'Key_Percent'}, -// {Qt::Key_Ampersand: 'Key_Ampersand'}, -// {Qt::Key_Apostrophe: 'Key_Apostrophe'}, -// {Qt::Key_ParenLeft: 'Key_ParenLeft'}, -// {Qt::Key_ParenRight: 'Key_ParenRight'}, -// {Qt::Key_Asterisk: 'Key_Asterisk'}, -// {Qt::Key_Plus: 'Key_Plus'}, -// {Qt::Key_Comma: 'Key_Comma'}, -// {Qt::Key_Minus: 'Key_Minus'}, -// {Qt::Key_Period: 'Key_Period'}, -// {Qt::Key_Slash: 'Key_Slash'}, -// {Qt::Key_0: 'Key_0'}, -// {Qt::Key_1: 'Key_1'}, -// {Qt::Key_2: 'Key_2'}, -// {Qt::Key_3: 'Key_3'}, -// {Qt::Key_4: 'Key_4'}, -// {Qt::Key_5: 'Key_5'}, -// {Qt::Key_6: 'Key_6'}, -// {Qt::Key_7: 'Key_7'}, -// {Qt::Key_8: 'Key_8'}, -// {Qt::Key_9: 'Key_9'}, -// {Qt::Key_Colon: 'Key_Colon'}, -// {Qt::Key_Semicolon: 'Key_Semicolon'}, -// {Qt::Key_Less: 'Key_Less'}, -// {Qt::Key_Equal: 'Key_Equal'}, -// {Qt::Key_Greater: 'Key_Greater'}, -// {Qt::Key_Question: 'Key_Question'}, -// {Qt::Key_At: 'Key_At'}, -// {Qt::Key_A: 'Key_A'}, -// {Qt::Key_B: 'Key_B'}, -// {Qt::Key_C: 'Key_C'}, -// {Qt::Key_D: 'Key_D'}, -// {Qt::Key_E: 'Key_E'}, -// {Qt::Key_F: 'Key_F'}, -// {Qt::Key_G: 'Key_G'}, -// {Qt::Key_H: 'Key_H'}, -// {Qt::Key_I: 'Key_I'}, -// {Qt::Key_J: 'Key_J'}, -// {Qt::Key_K: 'Key_K'}, -// {Qt::Key_L: 'Key_L'}, -// {Qt::Key_M: 'Key_M'}, -// {Qt::Key_N: 'Key_N'}, -// {Qt::Key_O: 'Key_O'}, -// {Qt::Key_P: 'Key_P'}, -// {Qt::Key_Q: 'Key_Q'}, -// {Qt::Key_R: 'Key_R'}, -// {Qt::Key_S: 'Key_S'}, -// {Qt::Key_T: 'Key_T'}, -// {Qt::Key_U: 'Key_U'}, -// {Qt::Key_V: 'Key_V'}, -// {Qt::Key_W: 'Key_W'}, -// {Qt::Key_X: 'Key_X'}, -// {Qt::Key_Y: 'Key_Y'}, -// {Qt::Key_Z: 'Key_Z'}, -// {Qt::Key_BracketLeft: 'Key_BracketLeft'}, -// {Qt::Key_Backslash: 'Key_Backslash'}, -// {Qt::Key_BracketRight: 'Key_BracketRight'}, -// {Qt::Key_AsciiCircum: 'Key_AsciiCircum'}, -// {Qt::Key_Underscore: 'Key_Underscore'}, -// {Qt::Key_QuoteLeft: 'Key_QuoteLeft'}, -// {Qt::Key_BraceLeft: 'Key_BraceLeft'}, -// {Qt::Key_Bar: 'Key_Bar'}, -// {Qt::Key_BraceRight: 'Key_BraceRight'}, -// {Qt::Key_AsciiTilde: 'Key_AsciiTilde'}, -// {Qt::Key_nobreakspace: 'Key_nobreakspace'}, -// {Qt::Key_exclamdown: 'Key_exclamdown'}, -// {Qt::Key_cent: 'Key_cent'}, -// {Qt::Key_sterling: 'Key_sterling'}, -// {Qt::Key_currency: 'Key_currency'}, -// {Qt::Key_yen: 'Key_yen'}, -// {Qt::Key_brokenbar: 'Key_brokenbar'}, -// {Qt::Key_section: 'Key_section'}, -// {Qt::Key_diaeresis: 'Key_diaeresis'}, -// {Qt::Key_copyright: 'Key_copyright'}, -// {Qt::Key_ordfeminine: 'Key_ordfeminine'}, -// {Qt::Key_guillemotleft: 'Key_guillemotleft'}, -// {Qt::Key_notsign: 'Key_notsign'}, -// {Qt::Key_hyphen: 'Key_hyphen'}, -// {Qt::Key_registered: 'Key_registered'}, -// {Qt::Key_macron: 'Key_macron'}, -// {Qt::Key_degree: 'Key_degree'}, -// {Qt::Key_plusminus: 'Key_plusminus'}, -// {Qt::Key_twosuperior: 'Key_twosuperior'}, -// {Qt::Key_threesuperior: 'Key_threesuperior'}, -// {Qt::Key_acute: 'Key_acute'}, -// {Qt::Key_mu: 'Key_mu'}, -// {Qt::Key_paragraph: 'Key_paragraph'}, -// {Qt::Key_periodcentered: 'Key_periodcentered'}, -// {Qt::Key_cedilla: 'Key_cedilla'}, -// {Qt::Key_onesuperior: 'Key_onesuperior'}, -// {Qt::Key_masculine: 'Key_masculine'}, -// {Qt::Key_guillemotright: 'Key_guillemotright'}, -// {Qt::Key_onequarter: 'Key_onequarter'}, -// {Qt::Key_onehalf: 'Key_onehalf'}, -// {Qt::Key_threequarters: 'Key_threequarters'}, -// {Qt::Key_questiondown: 'Key_questiondown'}, -// {Qt::Key_Agrave: 'Key_Agrave'}, -// {Qt::Key_Aacute: 'Key_Aacute'}, -// {Qt::Key_Acircumflex: 'Key_Acircumflex'}, -// {Qt::Key_Atilde: 'Key_Atilde'}, -// {Qt::Key_Adiaeresis: 'Key_Adiaeresis'}, -// {Qt::Key_Aring: 'Key_Aring'}, -// {Qt::Key_AE: 'Key_AE'}, -// {Qt::Key_Ccedilla: 'Key_Ccedilla'}, -// {Qt::Key_Egrave: 'Key_Egrave'}, -// {Qt::Key_Eacute: 'Key_Eacute'}, -// {Qt::Key_Ecircumflex: 'Key_Ecircumflex'}, -// {Qt::Key_Ediaeresis: 'Key_Ediaeresis'}, -// {Qt::Key_Igrave: 'Key_Igrave'}, -// {Qt::Key_Iacute: 'Key_Iacute'}, -// {Qt::Key_Icircumflex: 'Key_Icircumflex'}, -// {Qt::Key_Idiaeresis: 'Key_Idiaeresis'}, -// {Qt::Key_ETH: 'Key_ETH'}, -// {Qt::Key_Ntilde: 'Key_Ntilde'}, -// {Qt::Key_Ograve: 'Key_Ograve'}, -// {Qt::Key_Oacute: 'Key_Oacute'}, -// {Qt::Key_Ocircumflex: 'Key_Ocircumflex'}, -// {Qt::Key_Otilde: 'Key_Otilde'}, -// {Qt::Key_Odiaeresis: 'Key_Odiaeresis'}, -// {Qt::Key_multiply: 'Key_multiply'}, -// {Qt::Key_Ooblique: 'Key_Ooblique'}, -// {Qt::Key_Ugrave: 'Key_Ugrave'}, -// {Qt::Key_Uacute: 'Key_Uacute'}, -// {Qt::Key_Ucircumflex: 'Key_Ucircumflex'}, -// {Qt::Key_Udiaeresis: 'Key_Udiaeresis'}, -// {Qt::Key_Yacute: 'Key_Yacute'}, -// {Qt::Key_THORN: 'Key_THORN'}, -// {Qt::Key_ssharp: 'Key_ssharp'}, -// {Qt::Key_division: 'Key_division'}, -// {Qt::Key_ydiaeresis: 'Key_ydiaeresis'}, -// {Qt::Key_Multi_key: 'Key_Multi_key'}, -// {Qt::Key_Codeinput: 'Key_Codeinput'}, -// {Qt::Key_SingleCandidate: 'Key_SingleCandidate'}, -// {Qt::Key_MultipleCandidate: 'Key_MultipleCandidate'}, -// {Qt::Key_PreviousCandidate: 'Key_PreviousCandidate'}, -// {Qt::Key_Mode_switch: 'Key_Mode_switch'}, -// {Qt::Key_Kanji: 'Key_Kanji'}, -// {Qt::Key_Muhenkan: 'Key_Muhenkan'}, -// {Qt::Key_Henkan: 'Key_Henkan'}, -// {Qt::Key_Romaji: 'Key_Romaji'}, -// {Qt::Key_Hiragana: 'Key_Hiragana'}, -// {Qt::Key_Katakana: 'Key_Katakana'}, -// {Qt::Key_Hiragana_Katakana: 'Key_Hiragana_Katakana'}, -// {Qt::Key_Zenkaku: 'Key_Zenkaku'}, -// {Qt::Key_Hankaku: 'Key_Hankaku'}, -// {Qt::Key_Zenkaku_Hankaku: 'Key_Zenkaku_Hankaku'}, -// {Qt::Key_Touroku: 'Key_Touroku'}, -// {Qt::Key_Massyo: 'Key_Massyo'}, -// {Qt::Key_Kana_Lock: 'Key_Kana_Lock'}, -// {Qt::Key_Kana_Shift: 'Key_Kana_Shift'}, -// {Qt::Key_Eisu_Shift: 'Key_Eisu_Shift'}, -// {Qt::Key_Eisu_toggle: 'Key_Eisu_toggle'}, -// {Qt::Key_Hangul: 'Key_Hangul'}, -// {Qt::Key_Hangul_Start: 'Key_Hangul_Start'}, -// {Qt::Key_Hangul_End: 'Key_Hangul_End'}, -// {Qt::Key_Hangul_Hanja: 'Key_Hangul_Hanja'}, -// {Qt::Key_Hangul_Jamo: 'Key_Hangul_Jamo'}, -// {Qt::Key_Hangul_Romaja: 'Key_Hangul_Romaja'}, -// {Qt::Key_Hangul_Jeonja: 'Key_Hangul_Jeonja'}, -// {Qt::Key_Hangul_Banja: 'Key_Hangul_Banja'}, -// {Qt::Key_Hangul_PreHanja: 'Key_Hangul_PreHanja'}, -// {Qt::Key_Hangul_PostHanja: 'Key_Hangul_PostHanja'}, -// {Qt::Key_Hangul_Special: 'Key_Hangul_Special'}, -// {Qt::Key_Dead_Grave: 'Key_Dead_Grave'}, -// {Qt::Key_Dead_Acute: 'Key_Dead_Acute'}, -// {Qt::Key_Dead_Circumflex: 'Key_Dead_Circumflex'}, -// {Qt::Key_Dead_Tilde: 'Key_Dead_Tilde'}, -// {Qt::Key_Dead_Macron: 'Key_Dead_Macron'}, -// {Qt::Key_Dead_Breve: 'Key_Dead_Breve'}, -// {Qt::Key_Dead_Abovedot: 'Key_Dead_Abovedot'}, -// {Qt::Key_Dead_Diaeresis: 'Key_Dead_Diaeresis'}, -// {Qt::Key_Dead_Abovering: 'Key_Dead_Abovering'}, -// {Qt::Key_Dead_Doubleacute: 'Key_Dead_Doubleacute'}, -// {Qt::Key_Dead_Caron: 'Key_Dead_Caron'}, -// {Qt::Key_Dead_Cedilla: 'Key_Dead_Cedilla'}, -// {Qt::Key_Dead_Ogonek: 'Key_Dead_Ogonek'}, -// {Qt::Key_Dead_Iota: 'Key_Dead_Iota'}, -// {Qt::Key_Dead_Voiced_Sound: 'Key_Dead_Voiced_Sound'}, -// {Qt::Key_Dead_Semivoiced_Sound: 'Key_Dead_Semivoiced_Sound'}, -// {Qt::Key_Dead_Belowdot: 'Key_Dead_Belowdot'}, -// {Qt::Key_Dead_Hook: 'Key_Dead_Hook'}, -// {Qt::Key_Dead_Horn: 'Key_Dead_Horn'}, -// {Qt::Key_Dead_Stroke: 'Key_Dead_Stroke'}, -// {Qt::Key_Dead_Abovecomma: 'Key_Dead_Abovecomma'}, -// {Qt::Key_Dead_Abovereversedcomma: 'Key_Dead_Abovereversedcomma'}, -// {Qt::Key_Dead_Doublegrave: 'Key_Dead_Doublegrave'}, -// {Qt::Key_Dead_Belowring: 'Key_Dead_Belowring'}, -// {Qt::Key_Dead_Belowmacron: 'Key_Dead_Belowmacron'}, -// {Qt::Key_Dead_Belowcircumflex: 'Key_Dead_Belowcircumflex'}, -// {Qt::Key_Dead_Belowtilde: 'Key_Dead_Belowtilde'}, -// {Qt::Key_Dead_Belowbreve: 'Key_Dead_Belowbreve'}, -// {Qt::Key_Dead_Belowdiaeresis: 'Key_Dead_Belowdiaeresis'}, -// {Qt::Key_Dead_Invertedbreve: 'Key_Dead_Invertedbreve'}, -// {Qt::Key_Dead_Belowcomma: 'Key_Dead_Belowcomma'}, -// {Qt::Key_Dead_Currency: 'Key_Dead_Currency'}, -// {Qt::Key_Dead_a: 'Key_Dead_a'}, -// {Qt::Key_Dead_A: 'Key_Dead_A'}, -// {Qt::Key_Dead_e: 'Key_Dead_e'}, -// {Qt::Key_Dead_E: 'Key_Dead_E'}, -// {Qt::Key_Dead_i: 'Key_Dead_i'}, -// {Qt::Key_Dead_I: 'Key_Dead_I'}, -// {Qt::Key_Dead_o: 'Key_Dead_o'}, -// {Qt::Key_Dead_O: 'Key_Dead_O'}, -// {Qt::Key_Dead_u: 'Key_Dead_u'}, -// {Qt::Key_Dead_U: 'Key_Dead_U'}, -// {Qt::Key_Dead_Small_Schwa: 'Key_Dead_Small_Schwa'}, -// {Qt::Key_Dead_Capital_Schwa: 'Key_Dead_Capital_Schwa'}, -// {Qt::Key_Dead_Greek: 'Key_Dead_Greek'}, -// {Qt::Key_Dead_Lowline: 'Key_Dead_Lowline'}, -// {Qt::Key_Dead_Aboveverticalline: 'Key_Dead_Aboveverticalline'}, -// {Qt::Key_Dead_Belowverticalline: 'Key_Dead_Belowverticalline'}, -// {Qt::Key_Dead_Longsolidusoverlay: 'Key_Dead_Longsolidusoverlay'}, -// {Qt::Key_Back: 'Key_Back'}, -// {Qt::Key_Forward: 'Key_Forward'}, -// {Qt::Key_Stop: 'Key_Stop'}, -// {Qt::Key_Refresh: 'Key_Refresh'}, -// {Qt::Key_VolumeDown: 'Key_VolumeDown'}, -// {Qt::Key_VolumeMute: 'Key_VolumeMute'}, -// {Qt::Key_VolumeUp: 'Key_VolumeUp'}, -// {Qt::Key_BassBoost: 'Key_BassBoost'}, -// {Qt::Key_BassUp: 'Key_BassUp'}, -// {Qt::Key_BassDown: 'Key_BassDown'}, -// {Qt::Key_TrebleUp: 'Key_TrebleUp'}, -// {Qt::Key_TrebleDown: 'Key_TrebleDown'}, -// {Qt::Key_MediaPlay: 'Key_MediaPlay'}, -// {Qt::Key_MediaStop: 'Key_MediaStop'}, -// {Qt::Key_MediaPrevious: 'Key_MediaPrevious'}, -// {Qt::Key_MediaNext: 'Key_MediaNext'}, -// {Qt::Key_MediaRecord: 'Key_MediaRecord'}, -// {Qt::Key_MediaPause: 'Key_MediaPause'}, -// {Qt::Key_MediaTogglePlayPause: 'Key_MediaTogglePlayPause'}, -// {Qt::Key_HomePage: 'Key_HomePage'}, -// {Qt::Key_Favorites: 'Key_Favorites'}, -// {Qt::Key_Search: 'Key_Search'}, -// {Qt::Key_Standby: 'Key_Standby'}, -// {Qt::Key_OpenUrl: 'Key_OpenUrl'}, -// {Qt::Key_LaunchMail: 'Key_LaunchMail'}, -// {Qt::Key_LaunchMedia: 'Key_LaunchMedia'}, -// {Qt::Key_Launch0: 'Key_Launch0'}, -// {Qt::Key_Launch1: 'Key_Launch1'}, -// {Qt::Key_Launch2: 'Key_Launch2'}, -// {Qt::Key_Launch3: 'Key_Launch3'}, -// {Qt::Key_Launch4: 'Key_Launch4'}, -// {Qt::Key_Launch5: 'Key_Launch5'}, -// {Qt::Key_Launch6: 'Key_Launch6'}, -// {Qt::Key_Launch7: 'Key_Launch7'}, -// {Qt::Key_Launch8: 'Key_Launch8'}, -// {Qt::Key_Launch9: 'Key_Launch9'}, -// {Qt::Key_LaunchA: 'Key_LaunchA'}, -// {Qt::Key_LaunchB: 'Key_LaunchB'}, -// {Qt::Key_LaunchC: 'Key_LaunchC'}, -// {Qt::Key_LaunchD: 'Key_LaunchD'}, -// {Qt::Key_LaunchE: 'Key_LaunchE'}, -// {Qt::Key_LaunchF: 'Key_LaunchF'}, -// {Qt::Key_LaunchG: 'Key_LaunchG'}, -// {Qt::Key_LaunchH: 'Key_LaunchH'}, -// {Qt::Key_MonBrightnessUp: 'Key_MonBrightnessUp'}, -// {Qt::Key_MonBrightnessDown: 'Key_MonBrightnessDown'}, -// {Qt::Key_KeyboardLightOnOff: 'Key_KeyboardLightOnOff'}, -// {Qt::Key_KeyboardBrightnessUp: 'Key_KeyboardBrightnessUp'}, -// {Qt::Key_KeyboardBrightnessDown: 'Key_KeyboardBrightnessDown'}, -// {Qt::Key_PowerOff: 'Key_PowerOff'}, -// {Qt::Key_WakeUp: 'Key_WakeUp'}, -// {Qt::Key_Eject: 'Key_Eject'}, -// {Qt::Key_ScreenSaver: 'Key_ScreenSaver'}, -// {Qt::Key_WWW: 'Key_WWW'}, -// {Qt::Key_Memo: 'Key_Memo'}, -// {Qt::Key_LightBulb: 'Key_LightBulb'}, -// {Qt::Key_Shop: 'Key_Shop'}, -// {Qt::Key_History: 'Key_History'}, -// {Qt::Key_AddFavorite: 'Key_AddFavorite'}, -// {Qt::Key_HotLinks: 'Key_HotLinks'}, -// {Qt::Key_BrightnessAdjust: 'Key_BrightnessAdjust'}, -// {Qt::Key_Finance: 'Key_Finance'}, -// {Qt::Key_Community: 'Key_Community'}, -// {Qt::Key_AudioRewind: 'Key_AudioRewind'}, -// {Qt::Key_BackForward: 'Key_BackForward'}, -// {Qt::Key_ApplicationLeft: 'Key_ApplicationLeft'}, -// {Qt::Key_ApplicationRight: 'Key_ApplicationRight'}, -// {Qt::Key_Book: 'Key_Book'}, -// {Qt::Key_CD: 'Key_CD'}, -// {Qt::Key_Calculator: 'Key_Calculator'}, -// {Qt::Key_ToDoList: 'Key_ToDoList'}, -// {Qt::Key_ClearGrab: 'Key_ClearGrab'}, -// {Qt::Key_Close: 'Key_Close'}, -// {Qt::Key_Copy: 'Key_Copy'}, -// {Qt::Key_Cut: 'Key_Cut'}, -// {Qt::Key_Display: 'Key_Display'}, -// {Qt::Key_DOS: 'Key_DOS'}, -// {Qt::Key_Documents: 'Key_Documents'}, -// {Qt::Key_Excel: 'Key_Excel'}, -// {Qt::Key_Explorer: 'Key_Explorer'}, -// {Qt::Key_Game: 'Key_Game'}, -// {Qt::Key_Go: 'Key_Go'}, -// {Qt::Key_iTouch: 'Key_iTouch'}, -// {Qt::Key_LogOff: 'Key_LogOff'}, -// {Qt::Key_Market: 'Key_Market'}, -// {Qt::Key_Meeting: 'Key_Meeting'}, -// {Qt::Key_MenuKB: 'Key_MenuKB'}, -// {Qt::Key_MenuPB: 'Key_MenuPB'}, -// {Qt::Key_MySites: 'Key_MySites'}, -// {Qt::Key_News: 'Key_News'}, -// {Qt::Key_OfficeHome: 'Key_OfficeHome'}, -// {Qt::Key_Option: 'Key_Option'}, -// {Qt::Key_Paste: 'Key_Paste'}, -// {Qt::Key_Phone: 'Key_Phone'}, -// {Qt::Key_Calendar: 'Key_Calendar'}, -// {Qt::Key_Reply: 'Key_Reply'}, -// {Qt::Key_Reload: 'Key_Reload'}, -// {Qt::Key_RotateWindows: 'Key_RotateWindows'}, -// {Qt::Key_RotationPB: 'Key_RotationPB'}, -// {Qt::Key_RotationKB: 'Key_RotationKB'}, -// {Qt::Key_Save: 'Key_Save'}, -// {Qt::Key_Send: 'Key_Send'}, -// {Qt::Key_Spell: 'Key_Spell'}, -// {Qt::Key_SplitScreen: 'Key_SplitScreen'}, -// {Qt::Key_Support: 'Key_Support'}, -// {Qt::Key_TaskPane: 'Key_TaskPane'}, -// {Qt::Key_Terminal: 'Key_Terminal'}, -// {Qt::Key_Tools: 'Key_Tools'}, -// {Qt::Key_Travel: 'Key_Travel'}, -// {Qt::Key_Video: 'Key_Video'}, -// {Qt::Key_Word: 'Key_Word'}, -// {Qt::Key_Xfer: 'Key_Xfer'}, -// {Qt::Key_ZoomIn: 'Key_ZoomIn'}, -// {Qt::Key_ZoomOut: 'Key_ZoomOut'}, -// {Qt::Key_Away: 'Key_Away'}, -// {Qt::Key_Messenger: 'Key_Messenger'}, -// {Qt::Key_WebCam: 'Key_WebCam'}, -// {Qt::Key_MailForward: 'Key_MailForward'}, -// {Qt::Key_Pictures: 'Key_Pictures'}, -// {Qt::Key_Music: 'Key_Music'}, -// {Qt::Key_Battery: 'Key_Battery'}, -// {Qt::Key_Bluetooth: 'Key_Bluetooth'}, -// {Qt::Key_WLAN: 'Key_WLAN'}, -// {Qt::Key_UWB: 'Key_UWB'}, -// {Qt::Key_AudioForward: 'Key_AudioForward'}, -// {Qt::Key_AudioRepeat: 'Key_AudioRepeat'}, -// {Qt::Key_AudioRandomPlay: 'Key_AudioRandomPlay'}, -// {Qt::Key_Subtitle: 'Key_Subtitle'}, -// {Qt::Key_AudioCycleTrack: 'Key_AudioCycleTrack'}, -// {Qt::Key_Time: 'Key_Time'}, -// {Qt::Key_Hibernate: 'Key_Hibernate'}, -// {Qt::Key_View: 'Key_View'}, -// {Qt::Key_TopMenu: 'Key_TopMenu'}, -// {Qt::Key_PowerDown: 'Key_PowerDown'}, -// {Qt::Key_Suspend: 'Key_Suspend'}, -// {Qt::Key_ContrastAdjust: 'Key_ContrastAdjust'}, -// {Qt::Key_TouchpadToggle: 'Key_TouchpadToggle'}, -// {Qt::Key_TouchpadOn: 'Key_TouchpadOn'}, -// {Qt::Key_TouchpadOff: 'Key_TouchpadOff'}, -// {Qt::Key_MicMute: 'Key_MicMute'}, -// {Qt::Key_Red: 'Key_Red'}, -// {Qt::Key_Green: 'Key_Green'}, -// {Qt::Key_Yellow: 'Key_Yellow'}, -// {Qt::Key_Blue: 'Key_Blue'}, -// {Qt::Key_ChannelUp: 'Key_ChannelUp'}, -// {Qt::Key_ChannelDown: 'Key_ChannelDown'}, -// {Qt::Key_Guide: 'Key_Guide'}, -// {Qt::Key_Info: 'Key_Info'}, -// {Qt::Key_Settings: 'Key_Settings'}, -// {Qt::Key_MicVolumeUp: 'Key_MicVolumeUp'}, -// {Qt::Key_MicVolumeDown: 'Key_MicVolumeDown'}, -// {Qt::Key_New: 'Key_New'}, -// {Qt::Key_Open: 'Key_Open'}, -// {Qt::Key_Find: 'Key_Find'}, -// {Qt::Key_Undo: 'Key_Undo'}, -// {Qt::Key_Redo: 'Key_Redo'}, -// {Qt::Key_MediaLast: 'Key_MediaLast'}, -// {Qt::Key_unknown: 'Key_unknown'}, -// {Qt::Key_Call: 'Key_Call'}, -// {Qt::Key_Camera: 'Key_Camera'}, -// {Qt::Key_CameraFocus: 'Key_CameraFocus'}, -// {Qt::Key_Context1: 'Key_Context1'}, -// {Qt::Key_Context2: 'Key_Context2'}, -// {Qt::Key_Context3: 'Key_Context3'}, -// {Qt::Key_Context4: 'Key_Context4'}, -// {Qt::Key_Flip: 'Key_Flip'}, -// {Qt::Key_Hangup: 'Key_Hangup'}, -// {Qt::Key_No: 'Key_No'}, -// {Qt::Key_Select: 'Key_Select'}, -// {Qt::Key_Yes: 'Key_Yes'}, -// {Qt::Key_ToggleCallHangup: 'Key_ToggleCallHangup'}, -// {Qt::Key_VoiceDial: 'Key_VoiceDial'}, -// {Qt::Key_LastNumberRedial: 'Key_LastNumberRedial'}, -// {Qt::Key_Execute: 'Key_Execute'}, -// {Qt::Key_Printer: 'Key_Printer'}, -// {Qt::Key_Play: 'Key_Play'}, -// {Qt::Key_Sleep: 'Key_Sleep'}, -// {Qt::Key_Zoom: 'Key_Zoom'}, -// {Qt::Key_Exit: 'Key_Exit'}, -// {Qt::Key_Cancel: 'Key_Cancel'}, -// } \ No newline at end of file diff --git a/src/demo.ts b/src/demo.ts index 5f9e28bb1..e9823f106 100644 --- a/src/demo.ts +++ b/src/demo.ts @@ -23,7 +23,7 @@ const secondColor = new QColor(0, 0, 0); center.setLayout(layout); win.setWindowTitle('Analog Clock'); win.resize(200, 200); -const side = Math.min(win.geometry().width, win.geometry().height); +const side = Math.min(win.geometry().width(), win.geometry().height()); function repaint(): void { win.repaint(); @@ -36,7 +36,7 @@ win.addEventListener(QMainWindowEvents.Paint, () => { const painter = new QPainter(win); painter.setRenderHint(RenderHint.Antialiasing); - painter.translate(win.geometry().width / 2, win.geometry().height / 2); + painter.translate(win.geometry().width() / 2, win.geometry().height() / 2); painter.scale(side / 200.0, side / 200.0); painter.setPen(PenStyle.NoPen); diff --git a/src/lib/QtWidgets/QWidget.ts b/src/lib/QtWidgets/QWidget.ts index b8fcd5a03..4e0b5b2e9 100644 --- a/src/lib/QtWidgets/QWidget.ts +++ b/src/lib/QtWidgets/QWidget.ts @@ -11,6 +11,7 @@ import { StyleSheet, prepareInlineStyleSheet } from '../core/Style/StyleSheet'; import { checkIfNativeElement } from '../utils/helpers'; import { YogaWidget } from '../core/YogaWidget'; import { QSize } from '../QtCore/QSize'; +import { QRect } from '../QtCore/QRect'; // 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 YogaWidget { @@ -44,8 +45,8 @@ export abstract class NodeWidget extends YogaWidget { setGeometry(x: number, y: number, w: number, h: number): void { this.native.setGeometry(x, y, w, h); } - geometry(): Rect { - return this.native.geometry(); + geometry(): QRect { + return QRect.fromQVariant(this.property('geometry')); } setMouseTracking(isMouseTracked: boolean): void { this.native.setMouseTracking(isMouseTracked); @@ -171,17 +172,9 @@ export abstract class NodeWidget extends YogaWidget { } } -type Rect = { - x: number; - y: number; - width: number; - height: number; -}; -type arg = NodeWidget | NativeElement; - export class QWidget extends NodeWidget { native: NativeElement; - constructor(arg?: arg) { + constructor(arg?: NodeWidget | NativeElement) { let native; let parent; if (checkIfNativeElement(arg)) { diff --git a/src/lib/QtWidgets/__tests__/QWidget.test.ts b/src/lib/QtWidgets/__tests__/QWidget.test.ts index 66dbba4d8..56c5b6a06 100644 --- a/src/lib/QtWidgets/__tests__/QWidget.test.ts +++ b/src/lib/QtWidgets/__tests__/QWidget.test.ts @@ -51,10 +51,10 @@ describe('QWidget', () => { it('setGeometry', () => { view.setGeometry(10, 11, 12, 13); const rect = view.geometry(); - expect(rect.x).toEqual(10); - expect(rect.y).toEqual(11); - expect(rect.width).toEqual(12); - expect(rect.height).toEqual(13); + expect(rect.left()).toEqual(10); + expect(rect.top()).toEqual(11); + expect(rect.width()).toEqual(12); + expect(rect.height()).toEqual(13); }); it('setObjectName', () => { view.setObjectName('abcd');