Qt Signal Slot Infinite Loop

4/14/2022by admin
Qt Signal Slot Infinite Loop Average ratng: 4,6/5 7164 votes
Qt Signal Slot Infinite Loop

Since the Worker object is inside the infinite loop, it never processes this 'quit' slot (or at least I think that's what's happening). Yes, that's exactly what's happening. Event loops (which process signals/slots) and infinite loops are incompatible with each other; you cannot have both in the same thread. Qt events signals and slots. An infinite loop must be stopped – no signal is. Custom signals and slots class AngleObject: public QObject.

It looks like reply.abort triggers 'fiished' signal, which in turn triggers MIME sniffing, and then sniffer tries to read from a closed reply, and for some reason 'finished' is fired again. If all 'finished' handlers are disconnect from reply before calling reply.abort (this line is commented out in example), then there is no infinite loop. QtCore.SIGNAL and QtCore.SLOT macros allow Python to interface with Qt signal and slot delivery mechanisms. This is the old way of using signals and slots. The example below uses the well known clicked signal from a QPushButton. The connect method has a non python-friendly syntax. It is necessary to inform the object, its signal (via macro.

Qt Signal Slot Infinite Loop Maker

I managed to cobble together a macro that will read values from a selected spreadsheet and create multiple PartDesign bodies from it. I used Qt Designer to make a Form/Widget/DockWidget (I'm new to all this and not sure what the differences are between these), when I run my macro this will appear on the right as a docked widget. I have various pushButtons that when clicked will make the various parts. This is all working good. Now I want to expand the functionality, adding some checkboxes maybe some radio buttons etc.

When I change the signal and slot from QString to char. the main thread stays alive, just like expected. When I printed the char. in the working thread before entering the infinite loop, it only shows bogus.


My workflow so far is:
1) do layout in Qt Designer
2) save
3) run pyside2-uic to convert .ui to .py
4) run sed on it to replace QtWidgets

Qt Signal Slot Infinite Loop Tutorial

with QtGui
5) copy and paste into my macro
Qt signal slot infinite looper6) add in the code to make the buttons etc 'do things'
The problem with this is step 6
Here is an example form with a single button:

Qt Signal Slot Infinite Loop Tool

To make it 'do things' I would normally have this:

Code: Select all

The problem is whenever the ui changes I have to make a copy of 'added 1' part, delete old 'class Ui_Form', insert new 'class Ui_Form', then finally insert back 'added 1' part.
What seems to be a better way of doing things is to have Qt Designer add the 'added 1' parts. If I use the Signals/Slots editor to link the button to itself the resulting file looks like

Qt Signal Slot Infinite Looper

With this format I can simply add my functions after that code, and whenever the ui changes I just need to replace ui with a simple copy and paste. Which brings me to my question: how do I 'def self.pushButton.click'?
I tried the following:

Code: Select all

When I click on the button it segfaults and coredumps
Comments are closed.