I have a folder inside which i have following folder(s)/file(s) (Folder in bold)
1.make_file_example
1.1.main.cpp
1.2.MakeFile
1.3.message.cpp
1.4.message.h2.makeFileExample.txt
3.other_sources.txt
4.QTnotes.txt
[I've copy/pasted the same folder in two different locations] In following images you can clearly see how same folder when placed in different location give different results
the code snippet I've used is as follows:
void MainWindow::on_pushButton_browse_clicked()
{
ui->textBrowser_filename->setLineWrapMode(QTextEdit::NoWrap);
ui->textBrowser_filename->setText("");
QString dir= QFileDialog::getExistingDirectory(this, tr("Open Directory"),
"/home",
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks);
ui->lineEdit_dir->setText(dir);
QDirIterator it(dir, QDir::NoDotAndDotDot | QDir::AllEntries , QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
while(it.hasNext())
{
QString path=it.fileName();
ui->textBrowser_filename->append(path);
it.next();
}
}
Aucun commentaire:
Enregistrer un commentaire