Exemplo n.º 1
0
void DisplayWidget::searchFile()
{
    QString dirTree = git.getDataTree();
    dirTree = dirTree.simplified();
    QStringList listDir = dirTree.split(" ");
    
    QMap<int, QString> map;
    for (int i = 0, j = 0; i < listDir.size(); i++, j++)
        map.insert(i, listDir.at(j));
        
// The Dialog is limited to listing files and subdirectories of the current directory, 
// but the contents of subdirs can't be viewed.So it will be settled in a good way.       
// Maybe replace QListWidget with QTreeWidget .     
    Directory *dir = new Directory(map, this);
    if (dir->exec()){
        QString fileName;
        fileName = dir->selectedText();
        QFileInfo fi(fileName);
        fileName = fi.absoluteFilePath();
        lineEdit->setText(fileName);
    }
    delete dir;
}