Unsolved QT Udp socket
-
@Tibet said in QT Udp socket:
QObject::connect: No such signal QUdpSocket::Read
And that's correct - QUdpSocket has no such signal.
/edit: and please fix your post to use the code tags to make the code more readable!
-
QObject::connect: No such signal QUdpSocket::Read
Not only as @Christian-Ehrlicher says, but in addition tell us clearly which line you get this error on, and what the code of the line is? Because I don't see any call at all to
QUdpSocket::Read
anywhere in the code you show, so I don't even see how you could get that error message; if I didn't know better, I'd say you either have not copied & pasted the error message, or your code is not as shown.... -
14:15:32: Starting /home/tibet/build-qtDeneme12-Desktop-Debug/qtDeneme12 ...
QObject::connect: No such signal QUdpSocket::Read1() in ../qtDeneme12/MainWindow.cpp:19
QObject::connect: (receiver name: 'MainWindow')
QObject::connect: No such signal QUdpSocket::Read1() in ../qtDeneme12/MainWindow.cpp:19
QObject::connect: (receiver name: 'MainWindow') -
@Tibet Again: there is no such signal in QUdpSocket!
-
@Tibet
So, as suspected, what you said was the error message never was the error message.... Please, if you post questions take the time to copy & paste the correct code and the correct error message, else people waste time trying to help you.And again additional to @Christian-Ehrlicher .
I'm sorry, but if you have not already done so you really need to read Signals & Slots and have a proper understanding before you will get anywhere in Qt. Just trying things won't help you.
Also I strongly advise that you change over to the New Signal Slot Syntax before you go further. It will hep you by generating compiler messages when you have done something wrong.
-
I'm very new at Qt. I guess the error might be about signal and slot. because ---- connect (socket, SIGNAL (Read1 ()), this, SLOT (Read1 ())); --- this part doesn't work. I don't know exactly about MyUDP.h
-
@Tibet said in QT Udp socket:
connect (socket, SIGNAL (Read1 ()), this, SLOT (Read1 ())); --- this part doesn't work
And again: we know that it does not work because QUdpSocket has no such signal (said already two times before but you're ignoring it). The documentation has a working code snippet so why don't you follow them?
-
connect (socket, SIGNAL (Read1 ()), this, SLOT (Read1 ()));
Yes, it does not work. Because
socket
is aQUdpSocket
, and as per that documentation page there is no such signal (or any method) asQUdpSocket::Read1
. There is a signalQUdpSocket::readRead
, and there is a methodQUdpSocket::readDatagram()
which you might want to call in a slot on that signal.... -
@JonB thank u. I get it now <3. I used readyRead() and it was fixed.
-
@Tibet said in QT Udp socket:
it was fixed.
so if your issue is solved now, please don't forget to mark your post as such!