qdir

    0熱度

    1回答

    我跑的親Windows 7的驗證碼 foreach(QString str, directorie.entryList(QStringList(), QDir::Dirs)) { if(str != "." && str != "..") { QDir path(directorie.path() + "\\" + str + "\\" + from.path()

    0熱度

    1回答

    (使用Qt 4.7)我有一個函數,需要用戶輸入一個目錄名稱,然後在FTP服務器上通過該名稱在目錄中循環訪問文件。 FTP地址是恆定的,所以我有它的硬編碼到目前爲止,我有這樣的: QString dir_name = /*whatever the user inputs*/; QString source = "ftp://username:[email protected]/" + dir_na

    2熱度

    1回答

    我正在使用QDir::rename()重命名臨時文件。 這裏是我的代碼: // change the temporary filename void save::finish() { QString newpath = ui->path->text(); QString newname = ui->filename->text(); newpath.appen

    3熱度

    1回答

    QString FilePath2 = QFileDialog::getOpenFileName(this, tr("Open Directory"), "C:/", tr("Text files (*.txt)")); QDir a = FilePath2; qDebug() << a.absolutePath(); 代碼工作正常。但是absolutePath()仍然返回路徑+文件名而不

    10熱度

    2回答

    setNameFilters不工作,我所期望的,因此,如果任何人都可以,如果我使用它錯誤地解釋,或者這也許是Qt中的一個錯誤: 這裏是我的代碼示例: QDir export_folder("C:\path"); QStringList fileList = export_folder.setNameFilters(QStringList()<<"*.exe"); 處理後fileList包含字

    -1熱度

    2回答

    我注意到QFileDialog實例正在爲給定操作系統返回具有錯誤分隔符的成員函數selectedFile()的絕對路徑。這不是預期的跨平臺語言(python) 我應該怎麼做才能糾正這個問題,以便使用'os.sep'的正確的與操作系統無關的python代碼的其餘部分可以正確?我不想記住我可以在哪裏,不能使用它。

    3熱度

    1回答

    我正在使用Ubuntu 12.04 LTS和10.04 LTS平臺,並且遇到QDir :: mkPath問題。 我想創建一個使用mkPath的路徑,可以說/ john/play/games,然後將文件game.htm複製到/ home/john/play。在我複製文件後,我將文件權限設置爲rwxr - - r - - 。以便第三方應用程序可以讀取文件game.htm。但是目錄/ john,/ jo

    0熱度

    2回答

    我有這樣一個路徑: C:\路徑\爲\我*文件\ ,我想獲得相應的完整路徑(如果存在的話): C:\路徑\到\ my1file \ 我試着用這個Qt代碼,但結果是我不得不在一開始相同的路徑: QStringList filters; filters << "C:/path/to/my*file/"; QDir dir; dir.setNameFilters(filters); QStri

    2熱度

    1回答

    我想要得到的是位於指定的目錄中,但沒有在最後。我這樣做 Qt代碼的擴展名的所有文件: QDir myDir(mConfigDirectory); filters << "*.ini"; myDir.setNameFilters(filters); list = myDir.entryList(); qDebug()<<list; 但我找不到名稱與擴

    0熱度

    1回答

    從遞歸搜索目錄返回正確的值時出現問題。該代碼是下面 #include <QCoreApplication> #include <QDir> #include <QString> #include <QDebug> static QString findDirectoryPathFromId(const QString &startPath, const QString &id) {