bhs-ittech
18th August 2006, 13:27
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:
class Conn : public QHttp {};
and a dialog like this:
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:
if(c==0) {
conn = new Conn;
} else {
conn = c;
}
connect(conn,SIGNAL(done(bool)),this,SLOT(HttpDone (bool)));
Login::HttpDone looks like this:
void
Login::HttpDone(bool err)
{
if(err) { return; }
QTemporaryFile *file;
XmlHnd *hnd = new XmlHnd();
QXmlSimpleReader xml;
xml.setContentHandler(hnd);
if(conn->Data()->size() < 2)
{
file = conn->Data();
QXmlInputSource XFile(file);
if(xml.parse(XFile))
{
if(hnd->srvErr())
{
QMessageBox *mb = new QMessageBox("Helhed",
hnd->getValue("error"),QMessageBox::Critical,
QMessageBox::Ok,QMessageBox::NoButton,QMessageBox: :NoButton);
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?
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:
class Conn : public QHttp {};
and a dialog like this:
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:
if(c==0) {
conn = new Conn;
} else {
conn = c;
}
connect(conn,SIGNAL(done(bool)),this,SLOT(HttpDone (bool)));
Login::HttpDone looks like this:
void
Login::HttpDone(bool err)
{
if(err) { return; }
QTemporaryFile *file;
XmlHnd *hnd = new XmlHnd();
QXmlSimpleReader xml;
xml.setContentHandler(hnd);
if(conn->Data()->size() < 2)
{
file = conn->Data();
QXmlInputSource XFile(file);
if(xml.parse(XFile))
{
if(hnd->srvErr())
{
QMessageBox *mb = new QMessageBox("Helhed",
hnd->getValue("error"),QMessageBox::Critical,
QMessageBox::Ok,QMessageBox::NoButton,QMessageBox: :NoButton);
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?