Closed matkuki closed 1 year ago
Example battle_testing.nim:
battle_testing.nim
import os import nimqt import nimqt/[qpushbutton, qboxlayout] nimqt.init let app = newQApplication(os.commandLineParams()) inheritQObject(GuiHandler, QObject): var a: int slot_decl on_helloWorld_clicked() let guiHandler: ptr GuiHandler = newGuiHandler() let win: ptr QWidget = newQWidget() guiHandler.a = 12 let stylesheet: QString = newQString("background: red;") win.makeLayout: - newQPushButton(Q "Click me!!"): setStyleSheet(stylesheet) connect(SIGNAL "clicked()", guiHandler, SLOT "on_helloWorld_clicked()") - newQPushButton( Q "Click me!!"): connect(SIGNAL "clicked()", guiHandler, SLOT "on_helloWorld_clicked()") proc on_helloWorld_clicked(this: ptr GuiHandler) = let sender = cast[ ptr QPushButton]( this.get_sender()) sender.setText( Q "Hello world!") win.show() discard app.exec()
... compiles without problems, but running it throws:
$ .\battle_testing.exe C:\Users\matic\.nimble\pkgs\nimqt-0.1\nimqt.nim(333) battle_testing C:\Users\matic\.choosenim\toolchains\nim-1.6.10\lib\pure\collections\tables.nim(246) [] C:\Users\matic\.choosenim\toolchains\nim-1.6.10\lib\pure\collections\tables.nim(236) raiseKeyError Error: unhandled exception: key not found [KeyError]
Yes, forgetfulness from my side. Should be fixed now!
Works now 👍
Example
battle_testing.nim
:... compiles without problems, but running it throws: