PDA

View Full Version : error: no matching function for call to 'QHttpRequestHeader::setValue(QString*, QStr



k.qasempour
10th June 2012, 12:22
im trying to set a QHTTPheader fields. and im using the QHttpHeader::setValue ( const QString & key, const QString & value )
function. but i face with this error. so whats the problem here!!?

this is the code and i defined the myReqHeader in hehader file as public.


void MainWindow::setReqHeaderFild()
{


QString a,b;
a= ui->comboBoxReqField->currentText();
b= ui->lineEditreqheader->text();

myReqHeader.setValue( &a, &b);
}

the error:::
error: no matching function for call to 'QHttpRequestHeader::setValue(QString*, QString*)'


what should i do to make this work?

mvuori
10th June 2012, 12:40
You need to learn about C++ pointers and references.

With myReqHeader.setValue( &a, &b) you pass the addresses, that is, pointers, of a and b to setValue, which would correspond with a prototype QHttpHeader::setValue ( QString *key, QString *value )

Drop the &s and use myReqHeader.setValue(a, b);

k.qasempour
10th June 2012, 12:48
i do it befor my friend ... but when i use
ui->textEdit_4->setText(myReqHeader.toString();
just HTTP/0.0 printed in textEdit_4 ...
did u get what i said?
what happens here?