I have a command line application, with no event loop.

I also have a function where I need the tool to send a HTML request out, and 
not care about the result..

There is 1 and only 1 QNAM.

I know what the issue is, there is NO event loop, what I would like to do is 
have a QThread (or a concurrent class equivalent) for the requests.  I just 
push a request into the thread, which has its own event loop.

Then I want to simply wait at the end of the command line tool, for the Thread 
to finish..

I have tried all sorts of crap (and yes I admit its crap) code for the QThread 
based approach.. Any help would be appreciated.

Scott

std::list< QNetworkReply * > replies;
void sendRequest()
{
    QNetworkReply * reply = nam.get( QNetworkRequest( QUrl( 
"http://www.google.com"; ) ) );
   replies.push_back( reply );
}

bool isRequstPending()
{
Bool hasPending = false;
For( std::list<QNetworkReply * >::iterator ii = replies.begin(); !hasPending && 
ii != replies.end(); ++ii )
{
    hasPending = (*ii)->isFinished();
}
return hasPending;
}

int main( int argc, char ** argv )
{
    QCoreApplication appl( argc, argv );
   sendRequest();
   sendRequest();
   sendRequest();
   sendRequest();

while( isRequestPending() )
{
}
}



_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to