| *** zbenjamin_ is now known as zbenjamin | 01:49 | |
| *** nyov is now known as Guest83851 | 03:27 | |
| *** frinring_ is now known as frinring | 07:38 | |
| bionade24 | Hi, 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 | 
|---|---|---|
| attah | I assume you mean signal, or could that be your issue? | 12:07 | 
| bionade24 | attah: Yeh sorry, I'm emitting a signal, of course. | 12:12 | 
| attah | and 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 | 
| bionade24 | attah: I have someSignal(int result) and then in QML onSomeSignal: { console.log(result) } | 12:16 | 
| attah | can you show code? | 12:16 | 
| attah | or maybe compare to something like this https://stackoverflow.com/questions/51674625/receiving-a-signal-with-parameter-from-c-class-in-qml | 12:20 | 
| bionade24 | attah: The relevant signal is regTokenRecieved(qint32 result). I tried qint32 instead of int afterwards, but didn't helped. https://bpa.st/NDDQ | 12:21 | 
| bionade24 | attah: 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 | 
| bionade24 | attah: Sorry wait seems like QtCreator Vim mode has blocked me copying the right files. | 12:23 | 
| attah | was just about to say | 12:23 | 
| bionade24 | attah: Correct one: https://bpa.st/EHJA | 12:24 | 
| bionade24 | AARrgh! I hate this copy thing. QML stuff: https://bpa.st/NOVQ | 12:25 | 
| attah | try passing it without reference | 12:25 | 
| attah | still no hits for "regTokenRecieved" | 12:26 | 
| bionade24 | attah: sorry it's regTokenRetrieved | 12:29 | 
| attah | 0 hits still | 12:29 | 
| bionade24 | attah: My brain is mud today. I mean testResultRetrieved. And yes, that exists :) Sorry | 12:31 | 
| attah | so what's the emit call like? | 12:32 | 
| bionade24 | attah: Thx. After I removed the reference, it works. testResultRetrieved( qint32 &result) didn't work, but testResultRetrieved( qint32 result) works | 12:33 | 
| attah | no 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 | 
| bionade24 | attah: Then it would be undefind behaviour and not 0, I guess? Nevermind. | 12:43 | 
| attah | Javascriptisms of QML would probably save that somehow | 12:44 | 
| bionade24 | attah: JS has undefined, too | 13:37 | 
| bionade24 | attah: More like they explicitly map it to zero. | 13:37 | 
| antis | bionade24: 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 karmar | 17:35 | |
Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!