qthread

Can I create a new style pyqt signal that isn't a field member of a class?

爷,独闯天下 提交于 2019-12-24 01:52:07
问题 So for the only way that I can see to create a style signal with PyQt4 is as follows: class MyCustomClass(QtCore.QThread): custom_signal = QtCore.pyqtSignal(str) My beef is if I declare that signal anywhere else, pyqt throws an error at me about how custom_signal doesn't have a connect() function. I would like to create a helper function to help remove the boilerplate/repeated code when I want to do something as simple as: starting a new thread, doing work in that thread, sending the result

Interrupting QThread sleep

强颜欢笑 提交于 2019-12-24 01:13:04
问题 I would like to know how to pause a QThread and then resume when I get a signal. I have read and know that I can do something like this: def run(self): ... self.ready=False while not self.ready: self.sleep(1) ... ... @QtCore.Slot() def set_ready(self): self.ready = True However, what I want to do is avoid the polling in the thread. I don't want to have to set the sleep to a short amount of time and keep checking. I want to go to sleep until I get a signal from my main thread to continue. What

QThread updating UI statusbar?

本小妞迷上赌 提交于 2019-12-23 23:14:16
问题 I have a simple pyqt gui which creates a qthread to open a file and read some information. I want to update the statusbar of my gui. Normally, this would be my function call to update a message on the statusbar: class gui1(QtGui.QMainWindow): def __init__(self, parent=None): super(gui1, self).__init__(parent) self.statusBar().showMessage("hello world") ... # create thread here self.mythread = WorkThread(text) # create instance and pass some text self.mythread.finished.connect(self.threadDone)

How to properly delete and terminate QThread

会有一股神秘感。 提交于 2019-12-23 21:10:40
问题 I have got a subclass MyClass which inherits from QThread . I create it like this with a parent to the MainWindow instance (this): mMyClass = new MyClass("some_value", 1, 5L, this); My understanding of how Qt deals with object deletion is that every QObject , which has a parent gets deleted when the parent gets deleted. If my program does finish I get a warning QThread: Destroyed while thread is still running How can I fix this one up? I tried it with the following code in the deconstructor

Advice on GUI timer to display background thread's elapsed time?

拟墨画扇 提交于 2019-12-23 19:15:06
问题 Issue I have a PyQt GUI where the user presses a button to start a background thread ( workerThread , which is subclassed from QThread ). I would like to have a timer display (in the form of a QLabel ) to show how much time has elapsed since workerThread started, and I would like this timer to stop as soon as the workerThread exits. Possible solution I've thought about creating another independent thread ( timerThread ) that uses a QTimer to send a signal to a slot to update the QLabel in the

PyQt get value from GUI

谁说我不能喝 提交于 2019-12-23 12:45:25
问题 I've built an User Interface using QtDesigner and then converted the .ui to .py . The User Interface has different comboBox and textBox from which I want to read the values once the Run button is clicked. Run a function and then populate other text boxes of the user interface once the calculations are completed. However when I change the value of the comboBox and click the button the script still reads the initial value. I did a simple GUI with a comboBox with two items and a textBox. I'm

connecting signal/slot across different threads between QObjects

天大地大妈咪最大 提交于 2019-12-23 03:57:13
问题 I wanted to know what is the best practice to connect signal/slots between two QObjects created in the contructor of MainWindow but moved to different threads later...default connections seems not working then when I connect with the option Qt::Directconnection things start working...but sometimes the signal/slot fails...following is my code pattern..please let me know if I need to change my class design... MainWindow.cpp MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), {

connecting signal/slot across different threads between QObjects

流过昼夜 提交于 2019-12-23 03:57:06
问题 I wanted to know what is the best practice to connect signal/slots between two QObjects created in the contructor of MainWindow but moved to different threads later...default connections seems not working then when I connect with the option Qt::Directconnection things start working...but sometimes the signal/slot fails...following is my code pattern..please let me know if I need to change my class design... MainWindow.cpp MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), {

use QThread exclusively for an object

只谈情不闲聊 提交于 2019-12-23 02:39:31
问题 EDIT2 Here is the solution that works for the following problem of giving a QThread exclusively to the object. I've changed the approach for the problem. I don't want to close QThread in MyClass anymore, cause the following solution seems easier and not too bad looking. My solution is modification of the solution given here: http://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/ The problem with that solution was that QObject worker wasn't really

place external live video frames from non supported V4L file into Gstreamer Qt , C++ Qthreads

空扰寡人 提交于 2019-12-22 13:34:52
问题 OS : Ubuntu 14.04 SDK : Qt GStreamer : > 1.0 I am wondering how would I put continuously captured frames from a non supported V4L camera into GStreamer. Actually my task is to grab frames from the camera and use only GStreamer to send them to different computer via UDP. But at the moment, I just want to display it on my machine. What I did so far: a) Implemented code in Qt for an IDS camera that captures frames and displays then on Qt as live streaming. b) Separately, I have written ( or