signals-slots

PyQt and QSignalMapper/lambdas - multiple signals, single slot

≡放荡痞女 提交于 2019-12-01 10:42:06
问题 I have a list of actions on a menu in PyQt, one for each different feed I want to display. So I have a Y that sets the active feed to Y, Z sets it to Z, etc. (For a webcomic reading program). I have each on the menu, and felt that an automated approach might be better; rather than typing out each time. Something like a function that adds it to a dictionary, then connects it up with a signal for each to a single slot. However, I want that slot function, say it's called Foo, to take a parameter

How to use multicore python with PyQt4 process?

落爺英雄遲暮 提交于 2019-12-01 09:59:08
问题 I am writing an app in pyqt4 that has to read in and parse a lot of xml files. Done single-threaded it takes a while to do all that parsing and make the thousands of python objects corresponding to that incoming xml. I have profiled the code and as far as I can tell it's compute, not I/O, bound. I would like to convert the app to a multi-core model to spread the load around, using a worker-farm model (?Process.Pool in python). However, I would also like to be able to Signal progress from the

Qt/C++ QTableWidget: Doing something when a header is doubleclicked

瘦欲@ 提交于 2019-12-01 09:16:16
I have a QTableWidget in my form and I want to do something when a user doubleclicks on the header of a row or column. I am using the following connect statement: connect(ui->tblResults->horizontalHeader(),SIGNAL(doubleClicked(QModelIndex)),this,SLOT(tableDoubleClicked(QModelIndex))); Where this is the window class and ui->tblResults is the QTableWidget on the window's form. When I try doubleclicking the header, nothing happens. The slot I'm connecting to is: void wndSearch::tableDoubleClicked(QModelIndex tmp){ QMessageBox::information(0,"DERP!","TEST"); } Very simple, just testing to see if

How to connect custom signal to slot in pyside with the new syntax?

限于喜欢 提交于 2019-12-01 07:26:28
问题 This is an example from an video tutorial: #!/usr/bin/env python3 import sys from PySide.QtCore import * from PySide.QtGui import * class ZeroSpinBox(QSpinBox): zeros = 0 def __init__(self): super().__init__() self.valueChanged.connect(self.checkzero) def checkzero(self): if self.value() == 0: self.zeros += 1 self.emit(SIGNAL("atzero(int)"), self.zeros) class Form(QDialog): def __init__(self): super().__init__() dial = QDial() dial.setNotchesVisible(True) zerospinbox = ZeroSpinBox() layout =

Qt Designer - How to connect a signal to a static function?

守給你的承諾、 提交于 2019-12-01 07:03:49
Okay I'm using Qt Designer to build a GUI. I've managed to figure out how to make the menuBar and I've added some actions to the bar, but now I need to connect the actions to make them do something. Specifically, on my file menu, I have the simple open action. I want this action to run a function that calls my QFileDialog and so on, but I don't know how to do this. So, how do I connect my actionOpen to my static function? I am using the latest Qt, 5.0.2 I'm a little frustrated here. This is obviously one of the most basic things someone might need to do, yet I cannot find any real solution to

Python new style signals and slot between thread and gui app

…衆ロ難τιáo~ 提交于 2019-12-01 06:28:27
I am newbie to OOP and python. I am trying to emit signal from Qthread to Qt GUI main window using new style signals and slots. This is the thread. Inside I will emit signals for updating message dialog in GUI after clicking RUN button in GUI and 3 seconds after that. I am not sure if the inheritance is defined OK or is the signal defined in the right manner. class OptimThread (QtCore.QThread): signalUpdateMessageDialog = QtCore.SIGNAL("updateMessageDialog(PyQt_PyObject,QString)") def __init__(self): QtCore.QThread.__init__(self) def run(self): start = time.time() self.emit(self

Qt Signals/Slots and Threads

情到浓时终转凉″ 提交于 2019-12-01 05:51:41
I'm new to GUI programming and multithreading. I am in the process of creating a real-time app that receives information from my car and renders it in some meaningful way. My app is layed out as 3 threads, the GUI (main thread), the rendering thread and the hardware comm thread. Inbetwen the the render and the hardware threads is a shared ring buffer. In the render I have created a timer so that it draws the new interface 20 times a second. I would like the thread to notify the main thread that there is a new screen available and I was thinking a signal/slots method would work the best for

Qt/C++ QTableWidget: Doing something when a header is doubleclicked

牧云@^-^@ 提交于 2019-12-01 05:47:05
问题 I have a QTableWidget in my form and I want to do something when a user doubleclicks on the header of a row or column. I am using the following connect statement: connect(ui->tblResults->horizontalHeader(),SIGNAL(doubleClicked(QModelIndex)),this,SLOT(tableDoubleClicked(QModelIndex))); Where this is the window class and ui->tblResults is the QTableWidget on the window's form. When I try doubleclicking the header, nothing happens. The slot I'm connecting to is: void wndSearch:

Python new style signals and slot between thread and gui app

萝らか妹 提交于 2019-12-01 05:10:59
问题 I am newbie to OOP and python. I am trying to emit signal from Qthread to Qt GUI main window using new style signals and slots. This is the thread. Inside I will emit signals for updating message dialog in GUI after clicking RUN button in GUI and 3 seconds after that. I am not sure if the inheritance is defined OK or is the signal defined in the right manner. class OptimThread (QtCore.QThread): signalUpdateMessageDialog = QtCore.SIGNAL("updateMessageDialog(PyQt_PyObject,QString)") def __init_

Qt Designer - How to connect a signal to a static function?

廉价感情. 提交于 2019-12-01 04:12:41
问题 Okay I'm using Qt Designer to build a GUI. I've managed to figure out how to make the menuBar and I've added some actions to the bar, but now I need to connect the actions to make them do something. Specifically, on my file menu, I have the simple open action. I want this action to run a function that calls my QFileDialog and so on, but I don't know how to do this. So, how do I connect my actionOpen to my static function? I am using the latest Qt, 5.0.2 I'm a little frustrated here. This is