signals-slots

Qt Signal-Slot intercation.

Whan I want to use a signal of a private object in order to arise a signal of its parent object I do the following: 1. I create a signal and a slot (named, let's say, ParentSignal, ParentSlot) 2. connect(private_objcet, SIGNAL(someSignal()), this, SLOT(ParentSlot())); 3. and define parent slot like this: void ParentSlot() { emit ...

[Qt] I'm trying to make server/client but I don't know how to connect signals and slots

Hello, I'm trying to make server/client in Qt. TCP Server takes maximum 4 connections from client. To create... // server.h class Server : public QTcpServer{ ... QList<QTcpSocket *> list; } // server.cpp Server::start(){ QTcpSocket *curr = nextPendingConnection(); connect(curr, SIGNAL(disconnected()), curr, SLOT(delet...

why append Slot doesn't work?

Hi all, I have got a problem when I try to make following simple connections QSpinBox *spinBox = new QSpinBox; QSlider *slider = new QSlider(Qt::Horizontal); QTextEdit *text = new QTextEdit("Hello QT!"); QObject::connect(spinBox, SIGNAL(valueChanged(int)),slider, SLOT(setValue(int))); QObject::connect(slider, SIGNAL(valueChanged(in...

Deletion of objects send by signals, Ownership of objects in signals, Qt

Here, my signal declaration: signals: void mySignal(MyClass *); And how I'm using it: MyClass *myObject=new myClass(); emit mySignal(myObject); Here comes my problem: Who is responsible for deletion of myObject: 1-)Sender code, what if it deletes before myObject is used? Dangling Pointer 2-)The slot connected to signal, what ...

problem with replacing a background image using signal / slot in qt

Hi i want to make a simple chess program. So far i've made the board using QTableWidget and loaded the piece pictures in the cells of table. Now i wnat to use signal and slot so that when user clicks a cell and then click another cell the piece picture from first cell goes to second cell, But I don't know how to do it. Note that i don'...

qt signals/slots in a plugin

I have an app with such structure: all the datatypes (class INode) are stored in plugins (DLLs). Some of the datatypes can be drawn (if they're IDrawable). To load an object of, e.g. class PointCloudNode: public INode I have a special input plugin (DLL) which is called class PointCloudParser: public IIOPlugin and IIOPlugin is a thread ...

Qt4 slots and signals: Qt4 has trouble finding the signal.

Hi, I am trying to get the statusbar to update with the FPS of the contents of a QGLWidget. I have connected them as follows (In class MainWin): glWidget = new GLWidget; ui.verticalLayout->addWidget(glWidget); connect(glWidget, SIGNAL( updateFPSSignal(float) ), this, SLOT( updateFPSSlot(float) )); } The ...

Qt signals inheritance?

EDIT: I provided an answer but I'd be happy to accept another one that provides an explanation. I subclassed QPushButton to add some functionality, but after connection the clicked signal to a slot, it doesn't get called. If I use a vanilla QPushButton, and don't change anything else, it works. Here's the code: /// --- imagebutton.h #...

Clean up QThread after calling quit()

I have a problem. If I call Abort(), run function will return without complexMath instance have enough time to do clean up. What i want is, after calling Abort(), complexMath instance have enough time to shutdown itself, clearing all pending signal and slot(inside complexMath, it also have it own signal and slots) before it return. vo...

how to force matplotlib to update a plot

I am trying to construct a little GUI that has a plot which updates every time a new data sample is read. I would prefer not to run it with a timer, since the data will be arriving at differing intervals. Instead, I'm trying to make an implementation using signals, where the data collection function will emit a signal when data is read...

Prevent Firing Signals in Qt

We have a QCheckBox object, when user checks it or removes check we want to call a function so we connect our function to stateChanged ( int state ) signal. On the other hand, according to some condition we also change the state of QCheckBox object inside code, and this causes the unwanted signal. Is there any way to prevent firing sig...

No such signal in QT4

I have a signal and a slot that should fit together quite nicely. class MemberVisitor: public QObject { Q_OBJECT signals: void processMember(Member* member, bool &breakLoop); public: void processList(QList<Member*>* list); }; along with: class MemberFinder: public QObject { Q_OBJECT public slots: void processMembe...

What are the principles of an event system in C++ ?

First of all, I know there are excellent implementations (Qt, Boost, cpp-event, etc.), but I ask the question because I want to know how it works ! If I understand correctly, the "event system" uses the Observer pattern : some objects are observing, waiting for something to happen... and some others send signals. All right. So, let's s...

signals and slots vs. events and event listeners

Straight to the point! How do signals/slots and event/event-listeners compare? Are there any pros and cons? Which one should I consider and why? Thanks in advance! ...

Debug Qt signals, slots and connections

Is there a way to see which signals are fired, and if there is a slot connected to them? Ideally, we'd like to see all signals, not just those of a particular class or method; e.g. QSignalSpy only allows us to track specific signals of specific instances. In our application, we've seen performance problems because of a signal being emi...

PyQt_PyObject equivalent when using new-style signals/slots?

Hi. 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 'object' (pos 1) not found I have worked out how to do this with the old-style signal...

Signaling failure in qt slots

I have a 'producer' object, that steps through some data and emits various signals depending on what data item is next in the queue. Each of those signals are processed by at most one 'consumer' object at a time (it takes care to disconnect its slots before attaching the producer's signals to the other consumer). If the processing on t...

Is there a way to call a function right before a PyQt application ends?

I am collecting usage stats for my applications which include how much each session lasts. However, I can't seem to be able to save this information because None Of the signals I tried yet actually succeeds to call my report_session function. This are the signals I have already tried: lastWindowClosed() aboutToQuit() destroyed() Ei...

Can anyone give me same someting to keep in mind while using signals and slots in Qt?

I am learning to program using Qt framework. When I writes some code have signals and slots involved, the events didn't seem to fire and the signals and slots didn't seem to work. It really me make me annoyed. Can you give me some cautions and warnnings about signals and slots in Qt? slot declarations: private slots: void...

PyQt and QSignalMapper/lambdas - multiple signals, single slot

Hi. 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 tha...