Results 1 to 6 of 6

Thread: QNetworkAccessManager does not signal finished

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QNetworkAccessManager does not signal finished

    Hello all,
    I begin to play with Qt and got stuck with QNetworkAccessManager.
    I can not find any difference to the provided example (googlesuggest), but the example works and my code does not

    It seems that the network manager doesn't emit finished signal.

    The project consists of two classes, one is GUI, second should should access web.

    debugging output is:
    Qt Code:
    1. Starting D:\documents\programming\slovnik-prekladac-qt\Dict-build-desktop\debug\Dict.exe...
    2. translateText called
    3. translateText ends
    4. D:\documents\programming\slovnik-prekladac-qt\Dict-build-desktop\debug\Dict.exe exited with code 0
    To copy to clipboard, switch view to plain text mode 

    header:
    Qt Code:
    1. #ifndef TRANSLATE_H
    2. #define TRANSLATE_H
    3. #include <QString>
    4. #include <QtNetwork>
    5. class Translate :public QObject
    6. {
    7. Q_OBJECT
    8. public:
    9. Translate();
    10. void translateText(QString which);
    11. public slots:
    12. void dataRcd(QNetworkReply *nt);
    13. signals:
    14. void textTranslated(QString *result);
    15.  
    16. private:
    17. QNetworkAccessManager netmanager;
    18. };
    19. #endif // TRANSLATE_H
    To copy to clipboard, switch view to plain text mode 
    code:
    Qt Code:
    1. #include "translate.h"
    2. #include <QtDebug>
    3. Translate::Translate()
    4. {
    5. QObject::connect(&netmanager,SIGNAL(finished(QNetworkReply*)),this,SLOT(dataRcd(QNetworkReply*)));
    6. }
    7.  
    8. void Translate::dataRcd(QNetworkReply *nt){
    9. qDebug()<<"dataRcd called";
    10. emit textTranslated(new QString ("slot dataRcd called"));
    11. }
    12.  
    13. void Translate::translateText(QString which){
    14. qDebug() <<"translateText called";
    15. emit textTranslated(new QString("pre network manager"));
    16. QNetworkRequest req(QUrl("http://www.google.com"));
    17. netmanager.get(req);
    18. qDebug()<<"translateText ends";
    19. }
    To copy to clipboard, switch view to plain text mode 

    Any advice or hint would be a great help.

    Cheers
    lukas
    Attached Files Attached Files

Similar Threads

  1. QFutureWatcher finished() signal not working
    By DiamonDogX in forum Qt Programming
    Replies: 13
    Last Post: 25th October 2011, 18:27
  2. Replies: 0
    Last Post: 24th May 2010, 08:11
  3. get finished signal from a thread
    By ProTonS in forum Qt Programming
    Replies: 4
    Last Post: 21st August 2009, 14:17
  4. QProcess object not emitting finished(int) signal
    By Tiansen in forum Qt Programming
    Replies: 13
    Last Post: 14th November 2008, 12:17
  5. QUrlOperator doesn't emit finished signal
    By hayati in forum Qt Programming
    Replies: 16
    Last Post: 26th March 2007, 20:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.