PDA

View Full Version : Error with void QHttp::responseHeaderReceived ( const QHttpResponseHeader & resp )"



k.qasempour
7th June 2012, 06:20
hi friends. Im Working with http and im trying to show the recived response header in a texedit...
so im trying to use this signal void QHttp::responseHeaderReceived ( const QHttpResponseHeader & resp )

here is the code:
connect(&myHttp, SINGAL(QHttp::responseHeaderReceived(&myRespHeader)),
this, SLOT(showRespHeader()));


myHttp is an instance of QHttp
myRespHeader is an instance of QHttpResponseHeader
showResponseHeader() is a defined slot by myself

but i face with these errors ...

1. cannot call member function 'void QHttp::responseHeaderReceived(const QHttpResponseHeader&)' without object

2. 'SINGAL' was not declared in this scope


who knows ehats wrong here? help me plz
thnx alot

ChrisW67
7th June 2012, 06:43
The macro is called SIGNAL() not SINGAL().
The argument of the SIGNAL() macro is a prototype for the function not a call to it.
The slot should accept the argument passed with the signal if you expect to do anything useful with it.

Combining:


connect(&myHttp, SIGNAL(responseHeaderReceived(QHttpResponseHeader) ), this, SLOT(showRespHeader(QHttpResponseHeader));

// and
void showRespHeader(const QHttpResponseHeader& resp)
{
// do something with the HTTP response code you receive, e.g. 302, 404 etc.
}



My response to the first time you tried to ask this stands. Why didn't you just edit that first post?

k.qasempour
7th June 2012, 07:30
thnx alot man... it works correctly now... im new in QT.. would u plz give me some refrences to study?

Ali Reza
7th June 2012, 07:36
you can use socket programming to do your work,that socket connect to port 80 your host

ChrisW67
7th June 2012, 10:14
thnx alot man... it works correctly now... im new in QT.. would u plz give me some refrences to study?

There is a large set of documentation that comes with an copy of Qt. Run Assistant or look at the Help page in Qt Creator.

This particular problem is related to the information found in Signals and Slots