Questions tagged [signals-slots]

Signals and slots is a mechanism for implementing the observer pattern.

Signals and slots is a mechanism for implementing the observer pattern. It has many implementations in various languages:

See also:

1653 questions
10
votes
2 answers

Disable old (Qt4-style) Signal-Slot syntax in Qt5 code

Is there any way to prevent or discourage the use of the old Signal-Slot syntax from Qt4 in projects solely written in Qt5? In our current project, there are no occurrences of the old syntax and I don't see any reason to support them either. Thus we…
perivesta
  • 3,417
  • 1
  • 10
  • 25
10
votes
2 answers

PyQt_PyObject equivalent when using new-style signals/slots?

So I have a need to pass around a numpy array in my PyQt Application. I first tried using the new-style signals/slots, defining my signal with: newChunkToProcess = pyqtSignal(np.array()), however this gives the error: TypeError: Required argument…
Jords
  • 1,855
  • 3
  • 18
  • 28
10
votes
3 answers

QMetaObject::connectSlotsByName: No matching signal

I set a QT menu, which is automatically connected with action function on_actionOpen_triggered(). Later I want to pass a filename string to this function in order to call this function manually in a special condition. So I changed the function…
jhy
  • 193
  • 1
  • 2
  • 9
10
votes
1 answer

How does Qt handle a suposedly infinite loop of event emits?

I have both a QSlider and a QSpinBox, and I wanted their values to be always equal, so I connected the slider's valueChanged(int) signal to the spinbox' setValue(int) slot, and vice versa: (of course, I also set the min and max values to be…
fonini
  • 2,989
  • 3
  • 21
  • 39
10
votes
2 answers

Can you cause Qt to assert, segfault, or otherwise crash when a QObject::connect() fails?

I'm using Qt 4.8.x so I don't have access to the new connect interface from Qt5, but I want to be alerted better when a signal/slot connection fails because I misspelled a signal or slot name. Currently, all Qt does is spit out an error message when…
Cory Klein
  • 51,188
  • 43
  • 183
  • 243
10
votes
3 answers

How do I find out if a goroutine is done, without blocking?

All the examples I've seen so far involve blocking to get the result (via the <-chan operator). My current approach involves passing a pointer to a struct: type goresult struct { result resultType; finished bool; } which the goroutine…
György Andrasek
  • 8,187
  • 4
  • 48
  • 76
10
votes
7 answers

Qt GUI app: warning if QObject::connect() failed?

I recently migrated my Qt project from Linux to Vista, and now I'm debugging signals blindly. On Linux, if QObject::connect() fails in a debug build, I get a warning message on stderr. On Windows, there is no console output for GUI applications,…
György Andrasek
  • 8,187
  • 4
  • 48
  • 76
10
votes
4 answers

Qt connect "no such slot" when slot definitely does exist

Qt v4.8.0, VC2010 compiler I have a QMainWindow based class and I'm trying to send it signals involving QUuid However, every time I run it I get the errors: Object::connect: No such slot MainWindow::on_comp_connected(QUuid) in…
Richard1403832
  • 673
  • 1
  • 9
  • 16
9
votes
2 answers

How to implement a signal/slot defined in Qt Designer

I am trying to connect the click() signal of a button to my own function. The button is in a widget that I created with QT Designer. I load the .ui file with QUiLoader like so: class MyWidget(QtGui.QMainWindow): def __init__(self, *args): …
Sven
  • 985
  • 1
  • 11
  • 27
9
votes
6 answers

How can I do a check of the signal/slot connect's during compilation?

Checking the Qt signal slot connect calls at runtime is a worry for me. I should be possible to run a static check of the connect statements. Does such a tool exist?
Phil Hannent
  • 12,047
  • 17
  • 71
  • 118
9
votes
1 answer

applying python functions directly to Qt designer as signals

I am new to Qt and GUI programming overall but i have done a fair bit of coding in python - writing modules and so on. I need to develop simple GUIs for some of my old modules. What i am trying to do can be represented by the following simple…
linuS
  • 171
  • 1
  • 8
9
votes
2 answers

How to get calling button from a clicked event

I'm trying to make an small gui to deploy .ear and .war files on my local glassfish installation. SO i have made five rows containing a file name field, a checkbox and a button to bring up a file dialogbox to locate the war/ear file. It would be…
Buzzzz
  • 887
  • 3
  • 11
  • 18
9
votes
3 answers

Visualize QT Signals and Slots

I'm currently working with a lot of custom widgets which provide different signals and slots for communicating with each other. E.g. there is one widget which establishes a network connection and then emits a signal to the others which then change…
MOnsDaR
  • 8,401
  • 8
  • 49
  • 70
9
votes
1 answer

PyQt5 signal-slot decorator example

I am currently in the process of creating a class that produces a pyqtSignal(int) and pyqtSlot(int). The difficulty lies in creating a signal that emits a specific value. Suppose I want to produce something similar to the following simple…
Max
  • 2,072
  • 5
  • 26
  • 42
9
votes
2 answers

Connect QT Signals declared in interface

Is there any way to use Qt5 style Signal & Slot connection if the signals are declared in interfaces ?. My Interfaces: class IMyInterfaces{ protected: IMyInterfaces() {} //Prohibit instantiate interfaces public: virtual ~IMyInterfaces(){}…
sng
  • 113
  • 3
  • 7