Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling a QObject signal from python doesn't work! #98

Closed
NikkSaan opened this issue Jan 26, 2019 · 4 comments
Closed

Calling a QObject signal from python doesn't work! #98

NikkSaan opened this issue Jan 26, 2019 · 4 comments

Comments

@NikkSaan
Copy link

Calling a regular method works, calling a signal doesn't. It prints: RuntimeError: QObject method call failed

Is this normal?

@thp
Copy link
Owner

thp commented Jan 26, 2019

Can you post a Short, Self Contained, Correct Example that demonstrates the issue? Also, in Qt when calling signals, AFAIR it just "emits" the signal, so you have to connect something to the signal for it to work. In QML, see this: http://doc.qt.io/qt-5/qtqml-syntax-signals.html#connecting-signals-to-methods-and-signals

@NikkSaan
Copy link
Author

I'm running "test.qml" in a slightly modified "qmlscene"-kind of a program, more suited for my embedded platform. But the program just adds Pyotherside's import path to the QML Engine, and sets some QPA parameters. Also, Pyotherside is compiled against musl-libc.

Here is the test I ran, I can't make it more self-contained than that. I also tried using the "onCallSignal" handler, it still wouldn't work.

test.qml : https://pastebin.com/KuQFRbdf
TestModule.py : https://pastebin.com/GjyJp7TP

Result : https://pastebin.com/B3kBKgat

I'll assume it's a problem with my setup, and do without calling signals. I want to continue working on my project. I really just wanted to know If calling a signal was supported.

Sorry, I have to use Pastebin.

@thp thp closed this as completed in dab1576 Jan 27, 2019
@thp
Copy link
Owner

thp commented Jan 27, 2019

Thanks for that, the QMetaMethod::invoke() failed on the signal, because we tried to do a direct connection, and that apparently doesn't work with signals. As signals don't have any return value, instead we use Qt::AutoConnection for signals now, and only return true or false depending on whether it worked or now.

@NikkSaan
Copy link
Author

Wow, you're welcome! I didn't expect that this would result in a bug fix, and so quickly. Thank you!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants