PyQt: connecting slots with custom objects via Qt Designer


I have a PyQt widget that sends signals with numpy.ndarray data. And I have another PyQt widget that has a slot with numpy.ndarray data.

Both widget are located on my main window, that is compiled from *.ui file. The widgets are set as promoted widgets.

Cannot I somehow connect the signal and slot in Qt Creator?

Just now it gives me the next error:

TypeError: C++ type 'ndarray' is not supported as a slot argument type


Reason for this is Qt only support the datatype defined in QMetaType passed as argument of signal, looks here <a href="http://pyqt.sourceforge.net/Docs/PyQt4/qmetatype.html#Q_DECLARE_METATYPE" rel="nofollow">http://pyqt.sourceforge.net/Docs/PyQt4/qmetatype.html#Q_DECLARE_METATYPE</a> According to ekhumoro's POST, I update the following code, it should work for PyQt4, not tested on PyQt5.

from PyQt4.QtGui import * from PyQt4.QtCore import * from numpy import * class MyThread(QThread): mysignal = pyqtSignal(ndarray) def __init__(self, parent=None): super(MyThread, self).__init__(parent) def run(self): while True: QThread.msleep(100) self.mysignal.emit(array((1, 2, 3, 4))) class MyWidget(QWidget): def __init__(self, parent=None): super(MyWidget, self).__init__(parent) self.thread = MyThread() self.thread.mysignal.connect(self.handleSignal) self.thread.start() def handleSignal(self, data): print data if __name__ == '__main__': import sys app = QApplication(sys.argv) w = MyWidget() w.show() app.exec_()


  • Looping on values, creating dynamic query and adding to result set
  • webpack and react jsx - hot loading not working with docker container
  • OpenGL and threading
  • How to generate key hash for Facebook?
  • Update references to a submodule in parent repository after submodule's git history is re-writt
  • Determine repeat characters in a php string
  • wxpython notebook inside boxsizer
  • Error sending text message Android
  • Google maps error during visualization
  • Split string and numbers
  • three.js transparent png texture strange border webgl
  • matplotlib and transparency figure
  • ARKit – Rendering a 3D object under an invisible plane
  • How to populate a Mutation for a different Cassandra table in a trigger
  • Eclipse ADT Plugin crashed after updating to version 22.0
  • Migrating MOSS 2007 from SQL 2000 to SQL 2005 [closed]
  • Newtonsoft.json serializing and deserializing base/inheirited where classes are from shared projects
  • Preloading webView doesn't work - trying to reduce loading time
  • Finding all XML nodes between each two processing instructions
  • Inet6Address valid for invalid IPv6 Address
  • why 'read' command in shell script is missing initial characters? [duplicate]
  • Google Compute instance receiving email
  • Compiling and linking NASM and 64-bit C code together into a bootloader [duplicate]
  • Use 2D Text into 3D scenes in JavaFX results in blurry texts
  • On unchecking a checkbox trigger an event
  • internal javascript not works in angular2
  • How to use Typescript with libraries like Ampersand.js that parse configs to build prototypes
  • Stop an element moving with padding on hover
  • Creating 2d platforms using JavaScript
  • I am consuming a WCF service that requires headers from a .NET 2 website. How can I programmatically
  • how do i compare two rows and store the similarities of the two rows in another column
  • How to use Streams api peek() function and make it work?
  • How do I add a mouse over tooltip to an Image using .DrawImage()
  • Google App Engine Datastore: Dealing with eventual consistency
  • How to decleare char *const argv[] in swift [duplicate]
  • How to get rgb from transparent pixel in js
  • ssh remote server login script
  • How to call different template for different category archive page in woocommerce
  • WPF custom control and direct content support
  • Create/delete users from text file using Bash script