PDA

View Full Version : QT5 connect server.cpp and window.cpp



nnead
27th July 2014, 00:05
Hello i am new to C++ and QT5.

I have build a application for displaying data, which are received via a server.

I would like to update the displayed data when the server reads a new file. I have successfully build a refresh via a button click and the connection to the client and the transmitting of the data is fully functional, but how can i connect the server (done()) with the window resetGrid()?
I tried something like

QObject::connect(server,SIGNAL(done()),window,SLOT (resetGrid()));

but it does not work :(

edit:
silly me.... just had to use references
-> QObject::connect(&server,SIGNAL(done()),&window,SLOT(resetGrid()));

Problem solved, just had to waste 4 hours for this :/

wysota
29th July 2014, 14:57
silly me.... just had to use references
-> QObject::connect(&server,SIGNAL(done()),&window,SLOT(resetGrid()));


No, you had to use pointers, not references.