Results 1 to 2 of 2

Thread: PYQT4 - Trying to pass a list to QProcess

  1. #1
    Join Date
    Jan 2015
    Posts
    1
    Qt products
    Platforms
    Windows

    Default PYQT4 - Trying to pass a list to QProcess

    I have Form A which starts a QProcess B (matplotlib widget).
    When events come into Form A, I need to pass a list of data over the the
    QProcess B. I am assuming I can do this using signal/slots.

    Is this possible?

    Code in Form A:
    Qt Code:
    1. # define signal to emit
    2. PressureDataReady = QtCore.pyqtSignal()
    3.  
    4. # starts process
    5. self.qPSCGraph = QProcess()
    6. self.qPSCGraph.setProcessChannelMode(QProcess.SeparateChannels);
    7. self.qPSCGraph.start('python', ['SmartCableGraphsPressureSensorData.py'])
    8. self.qPSCGraph.finished.connect(self.PSCGraphFinished)
    9.  
    10. Method xyz(self):
    11. self.emit(QtCore.SIGNAL("PressureDataReady(PyQt_PyObject)"), pressureList)
    To copy to clipboard, switch view to plain text mode 
    Code In Form B:
    ???? not sure what is needed to receive signal and call method
    Qt Code:
    1. self.connect(self.qPSCGraph, QtCore.SIGNAL("PressureDataReady(PyQt_PyObject)"), ??????, 0)
    To copy to clipboard, switch view to plain text mode 

    any example to point out the correct directions would be appreciated.

    Chris
    Last edited by anda_skoa; 24th January 2015 at 09:30. Reason: missing [code] tags

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: PYQT4 - Trying to pass a list to QProcess

    To my knowledge, you cannot use Qt SIGNALS and SLOTS signals across separate processes.

    A few other approaches you might consider based on your platform:

    • Write to the stdin of your QProcess, read from stderr/stdout of your QProcess, etc.
    • Use a database to insert work to do into a table from your main program and your QProcess checks for new work using a timer, etc.
    • Use some type of message queueing system to publish/consume messages between processes
    • Use the Qt DBUS stuff


    Edit: A quick google found this page as well.

    Hope that helps.
    Last edited by jefftee; 23rd January 2015 at 23:49.

Similar Threads

  1. List the output of ls /dev/tty* using QProcess
    By arunkumaraymuo1 in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2013, 07:35
  2. How to use QMimeData to pass a list of pointers
    By Seishin in forum Qt Programming
    Replies: 5
    Last Post: 3rd May 2013, 22:14
  3. Cleaned event list of main app, when qprocess finished.
    By alnorte in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2013, 10:53
  4. Replies: 6
    Last Post: 30th November 2012, 03:58
  5. Replies: 5
    Last Post: 3rd February 2010, 23:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.