An Implemented QHttp Object
My problem is when I connect one of my login dialog's slots, which is to
be executed when my Conn object has completed it's http request, however
all it does is; making my dialog return Accepted().
I have an object like this:
Code:
class Conn
: public QHttp {};
and a dialog like this:
Code:
class Login
: public QDialog,
private Ui
::login{
Conn conn;
...
private slot:
void HttpDone(bool err);
};
and in the Login's constructor I call this connect:
Code:
if(c==0) {
conn = new Conn;
} else {
conn = c;
}
connect(conn,SIGNAL(done(bool)),this,SLOT(HttpDone(bool)));
Login::HttpDone looks like this:
Code:
void
Login::HttpDone(bool err)
{
if(err) { return; }
XmlHnd *hnd = new XmlHnd();
xml.setContentHandler(hnd);
if(conn->Data()->size() < 2)
{
file = conn->Data();
if(xml.parse(XFile))
{
if(hnd->srvErr())
{
mb->exec();
delete hnd;
return;
} else {
conn->setcid(hnd->getValue("cid"));
delete hnd;
accept();
}
}
}
}
To me it seems like the slot is called at the time it is being connected to the
http's done signal. Is this true, if so how can I make it behave different?
Re: An Implemented QHttp Object
void QHttp::done ( bool error ) [signal]
Quote:
This signal is emitted when the last pending request has finished; (it is emitted after the last request's requestFinished() signal). error is true if an error occurred during the processing; otherwise error is false.
This looks like erroneous to me. If everything went ok, you accept the dialog and the rest of the code in Login::HttpDone() becomes never executed...
Re: An Implemented QHttp Object
Do you invoke any conn's methods in that constructor?
Re: An Implemented QHttp Object
jacek: only Conn's constructor to make a pointer to it if there isn't one allready.
jpn: thanks, I miss read that one.
Edit: updated the code in HttpDone in my first post.
even with the changes it still accept the dialog almost before it displays it.
Re: An Implemented QHttp Object
Quote:
Originally Posted by bhs-ittech
even with the changes it still accept the dialog almost before it displays it.
But is this dialog really accepted or it just closes itself?
Re: An Implemented QHttp Object
Quote:
Originally Posted by jacek
But is this dialog really accepted or it just closes itself?
with a minor structual change to HttpDone, it should only accept if it recives
valid data from the web server. And it seem to behave that way.
Re: An Implemented QHttp Object
Quote:
Originally Posted by bhs-ittech
with a minor structual change to HttpDone, it should only accept if it recives
valid data from the web server. And it seem to behave that way.
I was asking about the dialog itself, not the way HttpDone works.
How do you create that dialog?
Re: An Implemented QHttp Object
Quote:
Originally Posted by jacek
I was asking about the dialog itself, not the way HttpDone works.
How do you create that dialog?
quote from 'int main(int,char**)
Code:
Login *l = new Login;
l->setServer("www.keenan.dk");
l->show();
// l->setFocus();
{
} else {
}
return mb->exec();
}
Re: An Implemented QHttp Object
Quote:
Originally Posted by bhs-ittech
Login *l = new Login;
l->setServer("www.keenan.dk");
l->show();
...
if(l->exec() == QDialog::Accepted)
You don't have to invoke show(), if you use exec().
What does setServer() do?
Re: An Implemented QHttp Object
Re: An Implemented QHttp Object
Quote:
Originally Posted by bhs-ittech
it calls QHttp's setHost
Only? In that case this "set host" request will be processed immediately and since it is the last request, QHttp::done() will be emitted.