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. [Solved]problem using Qftp
Forum Update on Monday, May 27th 2025

[Solved]problem using Qftp

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k 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.
  • A Offline
    A Offline
    Aicou
    wrote on 18 Mar 2011, 09:51 last edited by
    #1

    hello, I'm working on an graphical application who use an FTP connection to synchronize data with a Web server.
    I previously develop the "ftp part" without graphical interface and it worked fine, but now the commands are scheduled but never executed. I can't find out why.

    there is the part of the code where I use the Qftp:

    @
    void myFtp::run()
    {
    this->_connectCmd = this->_ftp->connectToHost("ftp.qt.nokia.com");
    qDebug() << this->_connectCmd;
    }
    @

    and i connect the commandFinished and commandStarted to slots who just print with qDebug() the status of the command, but nothing is never printed after the "qDebug() << this->_connectCmd;"

    here is some additional stuff:

    my ftp class:
    @
    class myFtp : public QObject
    {
    Q_OBJECT
    public:

    explicit myFtp(QString host, QString login, QString pass, QString dir, int port, QObject *parent = 0);
    void    run();
    

    signals:

    void    connected(bool statut);
    

    public slots:

    void    cmd_end(int i, bool j);
    void    cmd_start(int i);
    

    private:

    QString _host;
    QString _login;
    QString _pass;
    QString _dir;
    int     _port;
    bool    _connected;
    int     _connectCmd;
    int     _logCmd;
    QFtp*   _ftp;
    

    };
    @

    and where it is used in my app:

    @
    void Widget::doConnect()
    {
    this->lockAll(); // this is locking the interface during the connexion, i try to remove it but no change
    myFtp ftp(this->_ftpServeur, this->_login, this->_pass, this->_ftpDir, this->_ftpPort);
    ftp.run();
    }
    @

    thanks for your help and don't hesitate to give me advice if I you see some ... improbable code style.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxpayne
      wrote on 18 Mar 2011, 10:04 last edited by
      #2

      connectToHost is asynchronous, so you may want to create your ftp object (in doConnect method) on the heap using new...

      http://doc.qt.nokia.com/latest/qftp.html#details

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Aicou
        wrote on 18 Mar 2011, 10:14 last edited by
        #3

        ho that's right thanks. It's working now.

        1 Reply Last reply
        0

        1/3

        18 Mar 2011, 09:51

        • Login

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