Hello!
Please, help me to solve this problem:
DownLoader.h:19: error: no matching function for call to 'Downloader::connect(std::shared_ptr<QNetworkReply >&, const char*, Downloader* const, const char*)'
* * * * * * * * *this, SLOT(replyFinished( ) ) );
#ifndef DOWNLOADER_H
#define DOWNLOADER_H
#include <memory>
#include <QObject>
#include <QString>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetWorkAccessManager>
{
* *Q_OBJECT
* *Downloader( )
* *{
* * * *connect( m_reply, SIGNAL( finished( ) ),
* * * * * * * * this, SLOT( replyFinished( ) ) );
* *}
* *void fetch
( const QString &url
) * *{
* * * *m_reply.
reset(m_manager
->get
( QNetworkRequest
( QUrl( url
) ) ) );
* *}
signals:
* *void signalWithContent
( QString * );
private slots:
* *void replyFinished( )
* *{
* * * *emit signalWithContent( &content );
* *}
private:
* *std::shared_ptr<QNetworkAccessManager> m_manager =
* * * * * *std::make_shared<QNetworkAccessManager>( new QNetworkAccessManager( this ) );
* *std::shared_ptr<QNetworkReply> m_reply;
};
#endif // DOWNLOADER_H
#ifndef DOWNLOADER_H
#define DOWNLOADER_H
#include <memory>
#include <QObject>
#include <QString>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetWorkAccessManager>
class Downloader : public QObject
{
* *Q_OBJECT
* *Downloader( )
* *{
* * * *connect( m_reply, SIGNAL( finished( ) ),
* * * * * * * * this, SLOT( replyFinished( ) ) );
* *}
* *void fetch( const QString &url )
* *{
* * * *m_reply.reset(m_manager->get( QNetworkRequest( QUrl( url ) ) ) );
* *}
signals:
* *void signalWithContent( QString * );
private slots:
* *void replyFinished( )
* *{
* * * *QByteArray data = m_reply->readAll( );
* * * *QString content( data );
* * * *emit signalWithContent( &content );
* *}
private:
* *std::shared_ptr<QNetworkAccessManager> m_manager =
* * * * * *std::make_shared<QNetworkAccessManager>( new QNetworkAccessManager( this ) );
* *std::shared_ptr<QNetworkReply> m_reply;
};
#endif // DOWNLOADER_H
To copy to clipboard, switch view to plain text mode
Bookmarks