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. QtFtp and QtHttp "compatibility add-ons", for QHttp, and QFtp classes in Qt 5

QtFtp and QtHttp "compatibility add-ons", for QHttp, and QFtp classes in Qt 5

Scheduled Pinned Locked Moved General and Desktop
25 Posts 12 Posters 32.5k Views
  • 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.
  • C Offline
    C Offline
    cppdeveloper
    wrote on last edited by
    #1

    From Qt 5.0.1 documentation:

    bq. The QFtp, QUrlInfo, QHttp classes are not public anymore. Use QNetworkAccessManager instead to avoid binary breaks in the future. Programs that require raw FTP/HTTP streams, can use the compatibility add-ons QtFtp and QtHttp which provides the QFtp and QHttp classes as they existed in Qt 4.

    How can we use these "compatibility add-ons"? I can't find the appropriate header files, for QHttp in particular.

    Thank you.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2
      • "QHttp":https://qt.gitorious.org/qt/qthttp
      • "QFtp":https://qt.gitorious.org/qt/qtftp

      The whole code is in there, including headers.

      (Z(:^

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cppdeveloper
        wrote on last edited by
        #3

        ΟΚ, perhaps I am missing something, however everything I tried did not work.

        My .pro file is:

        @
        TEMPLATE = app
        QT += network
        TARGET =
        DEPENDPATH += .
        INCLUDEPATH += .

        Input

        HEADERS += mainwindow.h
        FORMS += mainwindow.ui
        SOURCES += initialise_mirror_locations.cpp main.cpp mainwindow.cpp@

        #include <QHttp>, and #include <QtHttp> do not work.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          You need to download the sources and include "this file":https://qt.gitorious.org/qt/qthttp/blobs/master/modules/qt_http.pri in your .pro. Like this:
          @
          include(path/to/that/pri/file)
          @

          At least that is my guess. If not, try including the sources into you .pro, or just analyse what is in the repo. There has to be a way to make it work :)

          (Z(:^

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cppdeveloper
            wrote on last edited by
            #5

            Thank you for your replies. There is a very easy way to make it work indeed. Reinstall Qt 4.8. :-)

            I am looking for a developer-friendly way to use the aforementioned "compatibility add-ons".

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cppdeveloper
              wrote on last edited by
              #6

              Finally, I made the switch to QNetworkAccessManager, and QNetworkReply. I was bored to do it, though. :-)

              Now the program compiles both in Qt 4.8.3, and Qt 5.0.1.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                julrich
                wrote on last edited by
                #7

                For the sake of completeness, the steps to use the add-ons are:

                Download the sources for the add-on from "gitorious":https://qt.gitorious.org/qt

                Extract the sources somewhere (e.g. Qt5.x.y/Src/qtmyaddon)

                Open a console in that folder

                Run qmake

                Run make (or nmake or mingw32-make or whatever)

                Run make install (nmake install, mingw32-make install, ...)

                In the .pro file of your project, add "QT += myaddon" (e.g. "QT += http")

                Run qmake on your project

                Compile your project

                Note: It's possible that step 6 requires the environment variable QTDIR to be set to the Qt5.x.y/mymakespec directory but I'm not sure about this.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  diego
                  wrote on last edited by
                  #8

                  Hi, i follow the steps that julrich list and end with: Qt5Ftp.prl, Qt5Ftpd.prl, libQt5Ftpd.a, libQt5Ftp.a and QtFtpDepends

                  added "QT += ftp" in project.pro
                  but i cant find "QtFtp"
                  the only include i find is "QtFtp/QtFtpDepends"

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    julrich
                    wrote on last edited by
                    #9

                    [quote author="diego" date="1374077339"]but i cant find "QtFtp"
                    the only include i find is "QtFtp/QtFtpDepends"[/quote]

                    I think the include should be @#include <QFtp>@

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      koahnig
                      wrote on last edited by
                      #10

                      It is merely a question of how you like to integrate the add-on's code.
                      You can completely keep it completely separate from Qt 5 and compile as a separate dll.
                      Personally, I consider this as a cleaner approach, since you do not mess with the rest of Qt and leave it in its "original" state.
                      You would include the supplied header from where you place it and you have to add the required steps as for every lib of your own.

                      Vote the answer(s) that helped you to solve your issue(s)

                      A 1 Reply Last reply
                      1
                      • D Offline
                        D Offline
                        davidperrenoud
                        wrote on last edited by
                        #11

                        As stated in the readme, if you want "#include <QHttp>" to work you have to generate the headers:
                        @cd qthttp
                        <QTDIR>/bin/syncqt.pl -version 5.2.0@

                        If you have already run qmake, delete the folder and download QHttp again.

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          lvignals
                          wrote on last edited by
                          #12

                          How much different is QNetworkAccessManager from QHttp?

                          I built a little utility for my laptop a long time ago and I am trying to decide between:

                          • a) Migrate to QNetworkAccessManager
                          • b) Apply QHttp add-on (i.e put it on life-support)
                          • c) Trash it :-(

                          It sounds like some here have gone though the process of migrating or installing the add-on, what was your experience / level of effort?

                          Thanks! :-)

                          1 Reply Last reply
                          0
                          • J Offline
                            J Offline
                            jelicicm
                            wrote on last edited by
                            #13

                            Hello All,
                            sorry to wipe the dust off of this thread, but it seemed to me that it was smart to put my question here...

                            I have a Qt5 SW which uses QNetworkAccessManager to download files from FTP servers. However, now I have to alter that software to first read contents of that FTP server (Internet refers to QtFTP add/on).

                            I looked here and found instructions for install of this add on by julrich... Tried them, didn't work.

                            I downloaded QtFTP from Gitorious, and put its src folder here> C:\Qt\Qt5.4.1\src.

                            Opened cmd.exe, navigated to that folder
                            "qmake" ENTER... and 'qmake is not recognized as an internal or external command.. blah blah"

                            I have never before installed a library, and it would mean a lot to me of someone with experience would be kind enough to help.

                            Thanks in advance.

                            K 1 Reply Last reply
                            0
                            • J jelicicm

                              Hello All,
                              sorry to wipe the dust off of this thread, but it seemed to me that it was smart to put my question here...

                              I have a Qt5 SW which uses QNetworkAccessManager to download files from FTP servers. However, now I have to alter that software to first read contents of that FTP server (Internet refers to QtFTP add/on).

                              I looked here and found instructions for install of this add on by julrich... Tried them, didn't work.

                              I downloaded QtFTP from Gitorious, and put its src folder here> C:\Qt\Qt5.4.1\src.

                              Opened cmd.exe, navigated to that folder
                              "qmake" ENTER... and 'qmake is not recognized as an internal or external command.. blah blah"

                              I have never before installed a library, and it would mean a lot to me of someone with experience would be kind enough to help.

                              Thanks in advance.

                              K Offline
                              K Offline
                              koahnig
                              wrote on last edited by
                              #14

                              @jelicicm
                              Hi and welcome to devnet

                              I would question if it is really necessary to go back to the compatibility version. Those have been implemented based on the new network stuff. IMHO they are meant for Qt 4 applications and their easier adaption to Qt5.

                              If you have Qt creator installed it should be a matter of importing the project (e.g. QtFtp) and compilation.

                              Vote the answer(s) that helped you to solve your issue(s)

                              1 Reply Last reply
                              0
                              • J Offline
                                J Offline
                                jelicicm
                                wrote on last edited by jelicicm
                                #15

                                @koahnig
                                Thank you very much for your reply! Not sure how I managed to be stupid like that :)

                                I included two .h and two .cpp files from /src folder in my project, wrote #include lines for two .h files and it compiled nicely!

                                Now, I have to ask someone for an example code of printing out files located on FTP server.

                                So far I have

                                '''QFtp *ftp=new QFtp();
                                QObject::connect(&ftp, SIGNAL(listInfo(const QUrlInfo &)), &ftp, SLOT(printout(const QUrlInfo &)));

                                ftp->connectToHost(address);
                                ftp->login("ars2014","65!tqwGfr0*8");
                                ftp->list();
                                ftp->close();

                                And, in qftp.h and qftp.cpp I added printout>
                                void QFtp::printout(const QUrlInfo &info) {
                                qDebug()<<info.name().toStdString();
                                }

                                If it maters in any way its just a console application.

                                Error I get is> error: no matching function for call to 'QObject::connect(QFtp**, const char*, QFtp**, const char*)'
                                QObject::connect(&ftp, SIGNAL(listInfo(const QUrlInfo &)), &ftp, SLOT(printout(const QUrlInfo &)));

                                Does someone know what is happening?

                                Thanks.

                                EDIT: Figured it out, I have cannot use &ftp when using connect, only just ftp. Duhh

                                1 Reply Last reply
                                0
                                • J Offline
                                  J Offline
                                  jlau
                                  wrote on last edited by
                                  #16

                                  The qftp sources are no longer available at https://qt.gitorious.org/qt/qtftp . Any one who can help me get the source?

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

                                    Hi and welcome to devnet,

                                    Qt's sources official repositories is on code.qt.io. For QFtp it's here

                                    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
                                    • J Offline
                                      J Offline
                                      jlau
                                      wrote on last edited by
                                      #18

                                      thanks a lot!

                                      1 Reply Last reply
                                      0
                                      • K koahnig

                                        It is merely a question of how you like to integrate the add-on's code.
                                        You can completely keep it completely separate from Qt 5 and compile as a separate dll.
                                        Personally, I consider this as a cleaner approach, since you do not mess with the rest of Qt and leave it in its "original" state.
                                        You would include the supplied header from where you place it and you have to add the required steps as for every lib of your own.

                                        A Offline
                                        A Offline
                                        avishkaperera
                                        wrote on last edited by
                                        #19

                                        @koahnig
                                        can you guide me on how to compile the qftp module as a separate library. I tried adding the module to my project. it works on windows but when I try running it on linux it doesn't work. my guess is I have to install it again on linux for it to work.

                                        K 3 Replies Last reply
                                        0
                                        • A avishkaperera

                                          @koahnig
                                          can you guide me on how to compile the qftp module as a separate library. I tried adding the module to my project. it works on windows but when I try running it on linux it doesn't work. my guess is I have to install it again on linux for it to work.

                                          K Offline
                                          K Offline
                                          koahnig
                                          wrote on last edited by
                                          #20

                                          @avishkaperera

                                          You need to donwload the sources from git here as already noted by SGaist.

                                          When you have downloaded the files you have project files for Qt creator to load and create the libraries.

                                          Vote the answer(s) that helped you to solve your issue(s)

                                          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