Results 1 to 8 of 8

Thread: QFtp sample program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QFtp sample program

    Here's a minimal example listing contents of ftp.trolltech.com root dir:
    Qt Code:
    1. // main.cpp
    2. #include <QCoreApplication>
    3. #include <QDebug>
    4. #include <QFtp>
    5.  
    6. class Ftp : public QFtp
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. Ftp(QObject* parent = 0)
    12. {
    13. connect(this, SIGNAL(listInfo(QUrlInfo)), this, SLOT(doListInfo(QUrlInfo)));
    14. connect(this, SIGNAL(done(bool)), QCoreApplication::instance(), SLOT(quit()));
    15. }
    16.  
    17. protected slots:
    18. void doListInfo(const QUrlInfo& info)
    19. {
    20. qDebug() << info.name();
    21. }
    22. };
    23.  
    24. int main(int argc, char* argv[])
    25. {
    26. QCoreApplication app(argc, argv);
    27.  
    28. Ftp ftp;
    29. ftp.connectToHost("ftp.trolltech.com");
    30. ftp.login();
    31. ftp.list();
    32. ftp.close();
    33.  
    34. return app.exec();
    35. }
    36.  
    37. #include "main.moc"
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. #2
    Join Date
    Apr 2012
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: QFtp sample program

    Hi

    I am trying to use the above mentioned code but am running nto issues. I see the following:

    :-1: error: No rule to make target `debug/main.moc', needed by `debug/Ftp.o'. Stop.

    Any idea how to fix this?


    Thanks in advance.

  3. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3
    Thanked 106 Times in 103 Posts

    Default Re: QFtp sample program

    Run qmake and then build.

    Or move class definition into a header file and drop the #include "main.moc".

Similar Threads

  1. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19

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
  •  
Qt is a trademark of The Qt Company.