[Qt-creator] QNetworkAccessManager hangs when running on windows
Hi, I am writing a small application to see how QNetworkAccessManager works. I have taken most of the code from the Qt Http example. On running the code in qtcreator it seems to hang atthe following line reply = qnam.get(QNetworkRequest(url)); Is there any additional initialization it have to do to get the QNetworkAccessManager running on windows destop using qtcreator? I am using qt 2010.04 Regards, John #include "mainwindow.h" #include "ui_authenticationdialog.h" HttpWindow::HttpWindow() { urlLineEdit = new QLineEdit("http://qt.nokia.com";); urlLabel = new QLabel(tr("&URL:")); urlLabel->setBuddy(urlLineEdit); statusLabel = new QLabel(tr("Please enter the URL of a file you want to download")); quitButton = new QPushButton(tr("Quit")) ; downloadButton = new QPushButton(tr("Download")); downloadButton->setDefault(true); progressDialog = new QProgressDialog(this); buttonBox= new QDialogButtonBox; buttonBox->addButton(downloadButton,QDialogButtonBox::ActionRole); buttonBox->addButton(quitButton,QDialogButtonBox::RejectRole); connect(urlLineEdit,SIGNAL(textChanged(QString)),this,SLOT(enableDownloadButton()) ); connect(&qnam,SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*))); connect (downloadButton,SIGNAL(clicked()),this, SLOT(downloadFile())); connect(progressDialog,SIGNAL(canceled()),this, SLOT(cancelDownload())); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *topLayout = new QHBoxLayout; topLayout->addWidget(urlLabel); topLayout->addWidget(urlLineEdit); QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->addLayout(topLayout); mainLayout->addWidget(statusLabel); mainLayout->addWidget(buttonBox); setLayout(mainLayout); setWindowTitle(tr("HTTP")); urlLineEdit->setFocus(); } void HttpWindow::enableDownloadButton() { downloadButton->setEnabled(!urlLineEdit->text().isEmpty()); } void HttpWindow::cancelDownload() { statusLabel->setText(tr("Download canceled.")); httpRequestAborted = true; reply->abort(); downloadButton->setEnabled(true); } void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator) { QDialog dlg; Ui::Dialog ui; ui.setupUi(&dlg); dlg.adjustSize(); ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host())); } void HttpWindow::downloadFile() { url = urlLineEdit->text(); QFileInfo fileInfo(url.path()); QString fileName = fileInfo.fileName(); if (fileName.isEmpty()) fileName="index.html"; if (QFile::exists(fileName)){ if(QMessageBox::question(this,tr("HTTP"),tr("There already exists a file called %1 in " "the current directory. Overwrite?").arg(fileName),QMessageBox::Yes|QMessageBox::No,QMessageBox::No) == QMessageBox::No) return; QFile::remove(fileName); } file = new QFile(fileName); if(!file->open(QIODevice::WriteOnly)){ QMessageBox::information(this,tr("HTTP"),tr("nable to save the file %1: %2.").arg(fileName).arg(file->errorString())); delete file; return; } progressDialog->setWindowTitle(tr("HTTP")); progressDialog->setLabelText(tr("Downloading %1.").arg(fileName)); downloadButton->setEnabled(false); startRequest(url); } void HttpWindow:: startRequest(QUrl url) { reply = qnam.get(QNetworkRequest(url)); connect(reply,SIGNAL(finished()),this,SLOT(httpFinished())); connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead())); connect (reply,SIGNAL(downloadProgress(qint64,qint64)),this , SLOT(updateDataReadProgress(qint64,qint64))); } void HttpWindow::httpReadyRead() { // this slot gets called everytime the QNetworkReply has new data. // We read all of its new data and write it into the file. // That way we use less RAM than when reading it at the finished() // signal of the QNetworkReply if (file) file->write(reply->readAll()); } void HttpWindow::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes) { progressDialog->setMaximum(totalBytes); progressDialog->setValue(bytesRead); } void HttpWindow::httpFinished() { progressDialog->hide(); file->flush(); file->close(); } ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] waiting for app trk to start error
Hi Robert , That helped !!! Thanks a lot :) Thanks Eike too for your response -John On 25 February 2010 13:40, Eike Ziller wrote: > > On Feb 25, 2010, at 12:29 PM, Loehning Robert (Nokia-D/Berlin) wrote: > > > Hi John, > > > > you could try setting a lower COM-port using Windows' device manager, > > e.g COM4. In some cases this helped. > > I don't know WHY this might help, though. If someone knows more about > > it, please contact me. > > Right. When using Qt Creator 1.3.1 that might be the problem. > Should be fixed in 1.3.80 dev snapshots though: > http://bugreports.qt.nokia.com/browse/QTCREATORBUG-568 > > ++ Eike > > > > > Good luck, > > Robert > > > > > > ext john Alvin Mathew schrieb: > >> Hi, > >> > >> Trk App is running on device and it is showed as Connected on the TRK > application in the phone. > >> > >> Connectiom :usb > >> > >> Port: 1 > >> > >> > >> -John > >> > >> On 25 February 2010 12:28, Eike Ziller eike.zil...@nokia.com>> wrote: > >> > >> On Feb 25, 2010, at 8:38 AM, ext john Alvin Mathew wrote: > >> > >>> Hi, > >>> > >>> I was working with TRK for many days. Then one fine day i am getting > this error. I am totally clueless about how to fix this. > >>> > >>> QT creator is detecting my phone correctly - Summary: Run on 'Nokia E63 > USB (COM20)' (self-signed certificate). > >> > >> Is App TRK running on the device and is in "connected" state using USB ? > >> > >> -- > >> Eike Ziller > >> Software Engineer > >> Nokia, Qt Development Frameworks > >> > >> Nokia gate5 GmbH > >> Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany > >> Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B > >> Umsatzsteueridentifikationsnummer: DE 812 845 193 > >> Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori > >> > >> > >> > >> > >> ___ > >> Qt-creator mailing list > >> Qt-creator@trolltech.com<mailto:Qt-creator@trolltech.com> > >> http://lists.trolltech.com/mailman/listinfo/qt-creator > >> > >> > >> > > > > > > -- > > Robert Löhning > > Software Engineer > > Nokia, Qt Development Frameworks > > > > Nokia gate5 GmbH > > Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany > > Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B > > Umsatzsteueridentifikationsnummer: DE 812 845 193 > > Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori > > ___ > > Qt-creator mailing list > > Qt-creator@trolltech.com > > http://lists.trolltech.com/mailman/listinfo/qt-creator > > -- > Eike Ziller > Software Engineer > Nokia, Qt Development Frameworks > > Nokia gate5 GmbH > Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany > Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B > Umsatzsteueridentifikationsnummer: DE 812 845 193 > Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori > > > > > ___ > Qt-creator mailing list > Qt-creator@trolltech.com > http://lists.trolltech.com/mailman/listinfo/qt-creator > ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
Re: [Qt-creator] waiting for app trk to start error
Hi, Trk App is running on device and it is showed as Connected on the TRK application in the phone. Connectiom :usb Port: 1 -John On 25 February 2010 12:28, Eike Ziller wrote: > > On Feb 25, 2010, at 8:38 AM, ext john Alvin Mathew wrote: > > > Hi, > > > > I was working with TRK for many days. Then one fine day i am getting this > error. I am totally clueless about how to fix this. > > > > QT creator is detecting my phone correctly - Summary: Run on 'Nokia E63 > USB (COM20)' (self-signed certificate). > > Is App TRK running on the device and is in "connected" state using USB ? > > -- > Eike Ziller > Software Engineer > Nokia, Qt Development Frameworks > > Nokia gate5 GmbH > Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany > Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B > Umsatzsteueridentifikationsnummer: DE 812 845 193 > Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori > > > > > ___ > Qt-creator mailing list > Qt-creator@trolltech.com > http://lists.trolltech.com/mailman/listinfo/qt-creator > ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator
[Qt-creator] waiting for app trk to start error
Hi, I was working with TRK for many days. Then one fine day i am getting this error. I am totally clueless about how to fix this. QT creator is detecting my phone correctly - Summary: Run on 'Nokia E63 USB (COM20)' (self-signed certificate). Please help!!! -John ___ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator