Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to load a text file from a web server
Forum Updated to NodeBB v4.3 + New Features

How to load a text file from a web server

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ReDKiiL
    wrote on last edited by
    #1

    Hi Guys,

    I wonder how I could load a txt file or a way out of my php from my web server and put in a string.
    I googled and found nothing.

    Ty

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      QNetworkAccessManager comes to mind for that

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ReDKiiL
        wrote on last edited by
        #3

        SGaist

        I tried and I am getting this error.

        @C:\TheAllChat\logincls.cpp:7: error: no matching function for call to 'QNetworkAccessManager::QNetworkAccessManager(Logincls* const)'
        mng = new QNetworkAccessManager(this);
        ^@

        Line 7:
        @ mng = new QNetworkAccessManager(this);@

        All code:
        http://pastebin.com/777gaJ2e

        What to do? I'm newbie.

        Thanks.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Does Logincls inherit from QObject ? If not, you can't set it as parent of QNAM.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            ReDKiiL
            wrote on last edited by
            #5

            Fix:
            I change:
            @class Logincls@
            to
            @class Logincls : public QObject@

            and

            @public:
            Logincls();
            bool verificarsenha(QString nck,QString pass);
            void replyFinished(QNetworkReply* reply);@
            to
            @public:
            Logincls();
            bool verificarsenha(QString nck,QString pass);
            private slots:
            void replyFinished(QNetworkReply* reply);
            @

            and remove from header
            @ QNetworkAccessManager* mng;@

            and change source to
            @QNetworkAccessManager* mng = new QNetworkAccessManager(this);@

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You are missing the Q_OBJECT macro to use signals & slots. Don't forget to run qmake after you added it and before you build again.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved