QT调试OK,发布无信号

时间:2016-10-12 14:13:29

标签: c++ qt signals release qftp

一开始我的英语是:-D

我有QT 5.6和QT Creator IDE。

如果我在调试模式下编译我的程序,没问题。

如果我在发布模式下编译,我不会从QFTP获得任何信号

    FTPManager::FTPManager(QObject *parent)
    {

       m_pFTP = new QFtp(parent->parent());

       connect(m_pFTP, SIGNAL(commandFinished(int,bool)),this, SLOT(ftpCommandFinished(int,bool)));
       connect(m_pFTP, SIGNAL(stateChanged(int)),this, SLOT(ftpStateChanged(int)));
       connect(m_pFTP, SIGNAL(dataTransferProgress(qint64,qint64)),this, SLOT(updateDataTransferProgress(qint64,qint64)));
       connect(m_pFTP, SIGNAL(readyRead()),this,SLOT(readData()));
       connect(m_pFTP, SIGNAL(listInfo(QUrlInfo)), this, SLOT(GetList(QUrlInfo)));
       connect(m_pFTP, SIGNAL(commandStarted(int)),this,SLOT(ftpCommandStarted(int)));
    }



    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
        ui->setupUi(this);

        m_pRezepturVerwaltung = new RezepturVerwaltung(ui);
        m_pFTPManager = new FTPManager(this);

        connect(m_pFTPManager, SIGNAL(DownloadFinish()), m_pRezepturVerwaltung, SLOT(AktualisiereShowProgparOrdnerstruktur()));
        connect(m_pFTPManager, SIGNAL(OwndataTransferProgress(qint64,qint64)),m_pRezepturVerwaltung, SLOT(updateDataTransferProgress(qint64,qint64)));
        connect(m_pRezepturVerwaltung, SIGNAL(SignalUpload(QString, QString, QString, QString)),
        m_pFTPManager, SLOT(Upload(QString, QString, QString, QString)));
        connect(m_pRezepturVerwaltung, SIGNAL(SignalDownload(QString, QString, QString, QString)),
        m_pFTPManager, SLOT(Download(QString, QString, QString, QString)));
    }

我在课堂上有Q_Object:

    class FTPManager : public QObject
    {
        Q_OBJECT
    public:
       explicit FTPManager(QObject *parent = 0);
       ~FTPManager();
       QFtp * m_pFTP;
    };

我试着清理然后qmake。

我删除了编译目录的洞。

编辑:

如果我想下载任何文件,我会调用void FTPManager :: downloadMehrereDateien()。

    void FTPManager::downloadMehrereDateien()
    {
        //Überprüfen ob es noch Dateien zu abbarbeiten gibt
        if (!m_strukDownloadFile.xAktive)
        {
            if(m_lDownloadqueue.count() > 0)
            {
                m_strukDownloadFile = m_lDownloadqueue.takeAt(0);
                m_strukDownloadFile.xAktive = true;
            }else
            {
                m_pFTP->close();
                return;
            }
        }

        if(!m_struktStatus.Connected)
        {
            connectToFtp(m_strukDownloadFile.sIP);
            m_pFTP->error();
        }else
        {
            if(!m_struktStatus.LoggedIn)
            {
                LoginToFtp();
            }else
            {
                m_pFTP->cd("StorageCard");

                m_pFTP->cd("DATA");

                int fileErweiterung = 1;
                QString sDateiUndSpeicherpfad = "", sDownlodFileName = "";


                sDateiUndSpeicherpfad = m_strukDownloadFile.sSpeicherPfad + m_strukDownloadFile.sFileName + m_strukDownloadFile.sDateiendung;
                sDownlodFileName = m_strukDownloadFile.sFileName + m_strukDownloadFile.sDateiendung;

                actionFile = new QFile(sDateiUndSpeicherpfad);
                while( actionFile->exists() )
                {
                    sDateiUndSpeicherpfad =m_strukDownloadFile.sSpeicherPfad + m_strukDownloadFile.sFileName + QString::number(fileErweiterung) + ".TAB";
                    actionFile->setFileName(sDateiUndSpeicherpfad);
                    fileErweiterung++;
                };


                if (!actionFile->open(QIODevice::WriteOnly))
                {
                    qDebug() << "Datei kann nicht geöffnet werden";
                    delete actionFile;
                    m_strukDownloadFile.xAktive = false; //ToDo: Später mehrere versuche dann erst false
                    downloadMehrereDateien();
                }else
                {
                    m_sAktDownloadDateiName = m_strukDownloadFile.sFileName + m_strukDownloadFile.sDateiendung;
                    m_pFTP->list();
                    m_pFTP->get(sDownlodFileName, actionFile);
                    m_strukDownloadFile.xAktive = false;
                    downloadMehrereDateien();
                }
            }
        }
    }

    void FTPManager::connectToFtp(QString sServerIp)
    {
        m_pFTP->connectToHost(sServerIp, 21);

        qDebug() << "Connecting to FTP server " << sServerIp;
    }

应用程序输出显示:“连接到FTP服务器”172.18.16.121“”

EDIT2:

我创建了一个具有相同问题的新小项目: https://dl.dropboxusercontent.com/u/13704266/qftptest.rar

0 个答案:

没有答案