Sunday, 2021-03-28

*** zbenjamin_ is now known as zbenjamin01:49
*** nyov is now known as Guest8385103:27
*** frinring_ is now known as frinring07:38
bionade24Hi, when I'm emitting a slot with an int arg in C++ and receive it in QML, it always gets value 0. How can I fix this?12:04
attahI assume you mean signal, or could that be your issue?12:07
bionade24attah: Yeh sorry, I'm emitting a signal, of course.12:12
attahand i assume it is something like "signals: void someSignal(int foo);" in the header, and that you are passing the value to the emit call?12:14
bionade24attah: I have someSignal(int result) and then in QML onSomeSignal: { console.log(result) }12:16
attahcan you show code?12:16
attahor maybe compare to something like this https://stackoverflow.com/questions/51674625/receiving-a-signal-with-parameter-from-c-class-in-qml12:20
bionade24attah: The relevant signal is regTokenRecieved(qint32 result). I tried qint32 instead of int afterwards, but didn't helped. https://bpa.st/NDDQ12:21
bionade24attah: And yes, I know that I could solve this easier by making update a singleton, I just want to find out if it's actually broken.12:21
bionade24attah: Sorry wait seems like QtCreator Vim mode has blocked me copying the right files.12:23
attahwas just about to say12:23
bionade24attah: Correct one: https://bpa.st/EHJA12:24
bionade24AARrgh! I hate this copy thing. QML stuff: https://bpa.st/NOVQ12:25
attahtry passing it without reference12:25
attahstill no hits for "regTokenRecieved"12:26
bionade24attah: sorry it's regTokenRetrieved12:29
attah0 hits still12:29
bionade24attah: My brain is mud today. I mean testResultRetrieved. And yes, that exists :) Sorry12:31
attahso what's the emit call like?12:32
bionade24attah: Thx. After I removed the reference, it works. testResultRetrieved( qint32 &result) didn't work, but testResultRetrieved( qint32 result) works12:33
attahno idea how that works, but kinda inferred from that stackoverflow thing. But i guess the referenced variable goes out of scope before it is accessed.12:34
bionade24attah: Then it would be undefind behaviour and not 0, I guess? Nevermind.12:43
attahJavascriptisms of QML would probably save that somehow12:44
bionade24attah: JS has undefined, too13:37
bionade24attah: More like they explicitly map it to zero.13:37
antisbionade24: When talking QML it is a good idea to forget about "undefined" and use "null" instead. For an "int" type it cannot be "null" when passed to C++ (if you want to do that you need to use std::optional<int> type).14:35
*** karmar281_ is now known as karmar17:35

Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!