pythonqt
pythonqt copied to clipboard
Implementing signals and slots
I'm trying to implement a custom signal and slot but there seem to be a few errors.
I can't inherit from QObject(which seems to be the recommended way) as it doesn't exist. This example throws:
AttributeError: module 'PythonQt.QtCore' has no attribute 'QObject'
The discussion here doesn't seem to be resolved either.
If I do it without classes like so:
from PythonQt.QtCore import Signal
def slot():
print("something")
sig = Signal("QVariant") # also tried without QVariant
sig.connect(slot)
sig.emit()
It results in a crash due to segmentation fault. I'm new to Qt itself so would love any suggestions/right way of doing things. Thank You.