How to show folder with certain file name in it



  • Hello guys,

    I am trying to open a dialog view that shows folders with only a certain filename "abc.txt" inside it. After searching I found that
    QSortFilterProxyModel may be the solution but any body knows how to use it?
    here is my code sofar

    @
    // selecting a new ABC.txt file
    QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(parent);
    filterModel->setSourceModel(stringListModel);

    QString path;
    QFileDialog dialog(this);
    dialog.setOption(QFileDialog::ShowDirsOnly,true);
    dialog.setNameFilter("ABC.TXT");
    dialog.setViewMode(QFileDialog::List);
    dialog.exec();
    //path=dialog.selectedFiles();
    

    @



  • Hi there, the QSortFilterPwoxyModel is AFAIK only used in a View/Model way. The QFileDialog does all the View/Model stuff on the background without the user to handle it. You might want to check the setNameFilters options in the QFileDialog. Never used it before, but it might work. Maybe this will work better for you:
    @
    QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
    "/home",
    QFileDialog::ShowDirsOnly
    | QFileDialog::DontResolveSymlinks);
    @
    You will get the directory only. Then you are able to check if the dir contains your file, if not, give a pop-up that it failed.
    greetz and happy coding!



  • Thank you for your reply, yes but i want to avoid the pop up or to enable only folders that have the abc.txt file inside it.

    Is it possible?


  • Moderators

    The problem with "the only show folders containing file X" is that you need to walk the disk to find all the folders that contain said file which can take a long time. You could try to use the OS file search functionality to speed that up (where available, no Qt integration either), but even then you will need to check all the folders not indexed (if the search even tells you what it is actually indexing) manually. Even if you do this in the background, the user won't be able to select anything before the folder he needs was found.

    In creator we just show a normal file dialog which will only show the files we care about. That works pretty well I think.



  • 1- with my current implementation it does not show only the file ABC.txt in the window, however all files are shown.

    2- May be we can search for 1 level only of subfolders.



  • Hmm, oke, think you have to inherit the qfiledialog and write the code yourself. Never tried to hide the directories myself. The only think I imagine that it will be very slow to start the dialog because you will need a system wide search which directories to include.
    Let me know what you come up with. Always eager to learn.



  • When I change *.txt into abc.txt, files are not selectable

    @
    QString filename = QFileDialog::getOpenFileName(
    this,
    "open db",
    QDir::currentPath(),
    "dB file (*.txt)"
    );
    @



  • for using the QSortFilterProxyModel you need to use Model
    in that case i think its better for you to use QFileSystemModel to provides a data model for the local filesystem.

    create your own class (MyClass) that inherits the QSortFilterProxyModel and implement the function:
    @virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const@
    and check if the folder match to your filter
    something like:
    @
    bool MyClass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    if( sourceModel()->isDir(index) && sourceModel->hasChildren(index))
    {
    QString fullPath = sourceModel()->fileInfo(index).absoluteFilePath();
    QDir dir(fullPath);
    QStringList children = dir.entryList( QDir::Files | QDir::NoSymLinks | Dir::NoDotAndDotDot);
    if( children.contain(QString("abc.txt"))
    return true;
    }
    return false;
    }

    after that you need to set the MyClass as your model and set it to a view like:
    QFileSystemModel *model = new QFileSystemModel;
    model->setRootPath(QDir::currentPath());
    MyClass *myClass = new MyClass;
    myClass->setSourceModel(model);

    QTreeView *tree = new QTreeView();
    tree->setModel(myClass);
    @
    now you have a treeview with filtering as you ask for



  • nice solution, very elegant.



  • I get this error

    qabstractmodel has no member isdir

    any idea?



  • Here is my full code

    header file myclass.h
    @
    #ifndef MYCLASS_H
    #define MYCLASS_H

    #include <QDate>
    #include <QSortFilterProxyModel>

    namespace Ui {
    class myclass;
    }

    class myclass : public QSortFilterProxyModel
    {
    Q_OBJECT

    public:
    myclass(QObject *parent = 0);

    protected:
    virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;

    private slots:
    void on_pushButton_clicked();

    private:
    Ui::myclass *ui;
    };

    #endif // MYCLASS_H

    @

    myclass.cpp
    @
    #include "myclass.h"
    #include <QtGui>
    #include <QFileInfo>
    #include <QDir>
    #include <QString>

    myclass::myclass(QObject *parent)
    : QSortFilterProxyModel(parent)
    {
    }

    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);

     if (sourceModel()->isDir(index) && sourceModel->hasChildren(index))
     {
          QString fullPath =   sourceModel()->fileInfo(index).absoluteFilePath();
         QDir dir(fullPath);
         QStringList children = dir.entryList( QDir::Files | QDir::NoSymLinks | Dir::NoDotAndDotDot);
    
        if( children.contain(QString("abc.txt")))
              {
                 return true;
                }
      }
     return false;
    

    }

    @

    In Class that searches and has browse button
    @
    #include "myclass.h"

    QFileSystemModel *model = new QFileSystemModel;
    model->setRootPath(QDir::currentPath());
    myclass *myClass  = new myclass;
    myClass->setSourceModel(model);
    
     QTreeView *tree = new QTreeView();
     tree->setModel(myClass);
     tree->show();
    

    @



  • yes you need to cast all sourceModel() to the real model like
    ((QFileSystemModel*)sourceModel())->isDir(....)



  • thank you lahianim. now there is only one error left

    here is the new code

    @
    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QFileSystemModel *sourceModel();

    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);

    if ( (sourceModel()->isDir(index) && sourceModel->hasChildren(index)))
    {
    QString fullPath = sourceModel()->fileInfo(index).absoluteFilePath();
    QDir dir(fullPath);
    QStringList children = dir.entryList( QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);

        if( children.contains(QString("abc.txt")))
              {
                 return true;
                }
      }
    
     return false;
    

    }

    @

    Error:

    request for member 'hasChildren' in 'sourceModel' which is of non-class type 'QFileSystemModel * ()()'



  • I made some changes according to this website but I get an error
    http://stackoverflow.com/questions/2101100/qfiledialog-filtering-folders/2126060#2126060
    can any body help?

    My Code
    @ h file

    #ifndef MYCLASS_H
    #define MYCLASS_H

    #include <QDate>
    #include <QSortFilterProxyModel>

    namespace Ui {
    class myclass;
    }

    class myclass : public QSortFilterProxyModel
    {
    Q_OBJECT

    public:
    myclass(QObject *parent = 0);

    protected:
    virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;

    private slots:
    void on_pushButton_clicked();

    private:
    Ui::myclass *ui;
    };

    #endif // MYCLASS_H
    @

    cpp
    @
    #include "myclass.h"
    #include <QtGui>
    #include <QFileInfo>
    #include <QDir>
    #include <QString>
    #include <QStringList>

    myclass::myclass(QObject *parent)
    : QSortFilterProxyModel(parent)
    {
    }

    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {

    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    QFileSystemModel* filemodel = qobject_cast<QFileSystemModel*>(sourceModel());

    if ( (filemodel->isDir(index)) && (filemodel->hasChildren(index)))
    {
    qDebug() << filemodel->fileName(index);
    QString fullPath = filemodel->fileInfo(index).absoluteFilePath();
    QDir dir(fullPath);
    QStringList children = dir.entryList( QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);

        if( children.contains(QString("abc.txt")))
              {
                 return true;
                }
      }
    
     return false;
    

    }

    @

    I call it this way

    @
    QFileDialog dialog;
    myclass* proxyModel = new myclass();
    dialog.setProxyModel(proxyModel);
    dialog.exec();
    @

    Error:

    symbols not found for architect x86_64
    collect 2: Id returned 1 exit status



  • I am building on mac with QT Creater 2.4.1 based on QT 4.7.4



  • Now it compiles well. However, I want to show only files called abc.txt. I still don't know where is the file name in which variables. Any help?

    header
    @
    #ifndef MYCLASS_H
    #define MYCLASS_H
    #include <QSortFilterProxyModel>
    class myclass : public QSortFilterProxyModel
    {
    Q_OBJECT

    public:
    explicit myclass(QObject *parent = 0);

    protected:
    bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
    };

    #endif // MYCLASS_H
    @

    @

    #include "myclass.h"
    #include <QtGui>
    #include <QFileInfo>
    #include <QDir>
    #include <QString>
    #include <Qdebug>

    myclass::myclass(QObject *parent)
    : QSortFilterProxyModel(parent)
    {
    }

    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    QFileSystemModel* filemodel = qobject_cast<QFileSystemModel*>(sourceModel());

     qDebug() << filemodel->fileName(index) << filemodel->isDir(index) << filemodel->hasChildren(index);
    
     if (filemodel->fileName(index).contains("abc.txt", Qt::CaseInsensitive))
     {
         return true;
     }
         else
     {
         return false;
     }
    

    }

    @



  • Hi
    if you still using this:

    bq. QFileDialog dialog;
    myclass* proxyModel = new myclass();
    dialog.setProxyModel(proxyModel);
    dialog.exec();

    you need to set the source model to the proxy model like before:

    bq. QFileSystemModel *model = new QFileSystemModel;
    model->setRootPath(QDir::currentPath());
    MyClass *myClass = new MyClass;
    myClass->setSourceModel(model);
    QTreeView *tree = new QTreeView();
    tree->setModel(myClass);



  • I don't get the file info but the directory structure

    "/"
    "/Volumes/DATA/MAC/login-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/login.app/Contents/MacOS"
    "/Volumes/DATA/MAC/login-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/login.app/Contents"
    "/Volumes/DATA/MAC/login-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/login.app"
    "/Volumes/DATA/MAC/login-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug"
    "/Volumes/DATA/MAC/tt-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug"
    "/Volumes/DATA/MAC"
    "/Volumes/DATA"
    "/Users"
    "/Volumes"
    QFileInfo::absolutePath: Constructed with empty filename
    2012-08-12 12:43:07.026 login[37625:407] Invalid URL passed to an open/save panel: '(null)'. Using 'file://localhost/Volumes/DATA/MAC/tt-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/' instead.
    2012-08-12 12:43:07.786 login[37625:407] Invalid URL passed to an open/save panel: '(null)'. Using 'file://localhost/Volumes/DATA/MAC/tt-build-desktop-Desktop_Qt_4_7_3_for_GCC__Qt_SDK__Debug/' instead.
    "/"

    and when I do qDebug () << info.fileName();
    I get the folders without the path

    @
    void Login::on_loginbrowse_clicked()
    {
    // selecting a new setting.dB file
    //QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(parent);
    //filterModel->setSourceModel(stringListModel);

    QFileSystemModel *model = new QFileSystemModel;
    model->setRootPath(QDir::currentPath());
    
    myclass *myClass  = new myclass (this);
    myClass->setSourceModel(model);
    
    QFileDialog *dialog = new QFileDialog;
    dialog->setDirectory(qApp->applicationDirPath());
    
    dialog->setProxyModel(myClass);
    dialog->exec&#40;&#41;;
    

    }
    @

    myclass
    @

    #include "myclass.h"
    #include <QtGui>
    #include <QFileInfo>
    #include <QDir>
    #include <QString>
    #include <Qdebug>

    myclass::myclass(QObject *parent)
    : QSortFilterProxyModel(parent)
    {
    }

    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    QFileSystemModel* filemodel = qobject_cast<QFileSystemModel*>(sourceModel());
    // QFileSystemModel filemodel = static_cast<QFileSystemModel>(sourceModel());
    filemodel->setRootPath(QDir::currentPath());
    QFileInfo info(filemodel->filePath(index));
    QString filePath = info.absoluteFilePath();
    QString fullPath = filemodel->fileInfo(index).absoluteFilePath();
    qDebug () << filePath;

     if (info.fileName().contains("Setting"))
     {
         return true;
     }
        return false;
    

    }

    @

    Header
    @
    #ifndef MYCLASS_H
    #define MYCLASS_H

    #include <QSortFilterProxyModel>
    class myclass : public QSortFilterProxyModel
    {
    Q_OBJECT

    public:
    explicit myclass(QObject *parent = 0);

    protected:
    bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
    };

    #endif // MYCLASS_H

    @



  • can you send me a working example. Please the full code, i am not accustomed to the terminologies used.



  • the following code works for me. i tested it on win7 but this QT so it need to run on MAC too.

    myfilterproxy.h
    @
    #ifndef MYFILTERPROXY_H
    #define MYFILTERPROXY_H

    #include <QSortFilterProxyModel>

    class MyFilterProxy : public QSortFilterProxyModel
    {
    Q_OBJECT
    public:
    explicit MyFilterProxy(QObject *parent = 0);

    protected:
    bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;

    };

    #endif // MYFILTERPROXY_H
    @

    myfilterproxy.cpp

    @
    #include "myfilterproxy.h"
    #include <QDir>
    #include <QFileSystemModel>
    #include <QStringList>

    MyFilterProxy::MyFilterProxy(QObject *parent) :
    QSortFilterProxyModel(parent)
    {
    }

    bool MyFilterProxy::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {

    QModelIndex index = ((QFileSystemModel*)sourceModel())->index(source_row, 0/*column*/, source_parent);
    if( ((QFileSystemModel*)sourceModel())->isDir(index) && ((QFileSystemModel*)sourceModel())->hasChildren(index))
    {
        QString fullPath =   ((QFileSystemModel*)sourceModel())->fileInfo(index).absoluteFilePath();
        QDir dir(fullPath);
        QStringList children = dir.entryList( QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
        if( children.contains(QString("abc.txt")) )
            return true;
    }
    return false;
    

    }
    @

    main.cpp
    @
    #include <QtGui/QApplication>
    #include <QFileDialog>
    #include "myfilterproxy.h"

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MyFilterProxy myProxy;
    QFileDialog fileDialog;
    //its your call if to use this line (or default or other view mode)
    fileDialog.setViewMode(QFileDialog::Detail);
    fileDialog.setProxyModel(&myProxy);
    fileDialog.exec();
    return a.exec();
    }
    @

    i'll hope it help you.



  • I tested it but it does not function correctly. Lets change the function to make it simple. I want to be able to select abc.txt and unable to select all other files. Currently, I can select all files and folders.



  • sorry but i don't understand what you need to do exactly.
    you asked to show the user only the folder that include abc.txt and that what the code do.
    if you want that the user will show only the abc.txt files you can add a QRegExp to the MyFilterProxy and (i think) to remove the filterAcceptsRow

    or try this:
    @
    QFileDialog fileDialog;
    fileDialog.setFilter("abc.txt");
    fileDialog.exec();
    @

    the dialog will show you the file system and when you'll enter a folder with file name exactlly abc.txt you will see it and have the option to select it (the filter will ignore all other files name)



  • here is my last code.

    1- your code in the main, breaks on mac but the following works. It seems declaration should be only as pointers
    @
    myclass myProxy = new myclass;
    QFileDialog fileDialog = new QFileDialog;
    //fileDialog->setDirectory(qApp->applicationDirPath());
    //its your call if to use this line (or default or other view mode)
    fileDialog->setViewMode(QFileDialog::Detail);
    fileDialog->setProxyModel(myProxy);
    fileDialog->exec();
    @
    2- In myclass, I use the following code
    @ QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    QFileSystemModel
    filemodel = qobject_cast<QFileSystemModel
    >(sourceModel());
    // QFileSystemModel filemodel = static_cast<QFileSystemModel>(sourceModel());
    filemodel->setRootPath(QDir::currentPath());
    QString fullPath = filemodel->fileInfo(index).absoluteFilePath();
    QDir dir(fullPath);
    QStringList children = dir.entryList( QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
    qDebug () << children;
    @
    It prints now the files in the folders

    Now I need to check in the Qstringlist for the file "abc.txt" and return true for this file only otherwise false.

     foreach (QString str,children)
        {
            
        }
    


  • Yes, I changed the target, instead of showing the folder that contains the file. I show the files and make the file "abc.txt" selectable .

    The setfilter does not work properly, it shows me all files are unselectable
    @QFileDialog fileDialog;
    fileDialog.setFilter("abc.txt");
    fileDialog.exec();
    @



  • first about your code bq. foreach (QString str,children) { }
    you can use:
    @if(children.contains("abc.txt")) return true; else false;@

    and about your last message:
    [quote author="SherifOmran" date="1344846279"]Yes, I changed the target, instead of showing the folder that contains the file. I show the files and make the file "abc.txt" selectable .

    [/quote]
    lets say you have 2 files named "abc.txt" at the paths:
    "C:\some_folder\abc.txt" and
    "D:\other_folder\new_folder\abc.txt"

    what you want the user will show in the QFileDialog?
    how the user will navigate to the paths if he will not see the folders (of the file system)

    please explain in more details as you can, what you are asking for and what you want the user will see, and if you have a image or you see your request working some where please refer to it



  • I want the user to see all folders but when he gets inside it, he does not see except only the abc.txt file to select it, all other files are hidden. something like in any open file in a windows program, say winword in the open window one sees *.doc but I can write abc.doc in the window and it will be filtered automatically.



  • hi i used this code: (as before)
    @
    #include <QtGui/QApplication>
    #include <QFileDialog>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QFileDialog fileDialog;
    fileDialog.setViewMode(QFileDialog::Detail);
    fileDialog.setFilter("csb.log");
    fileDialog.exec();
    return a.exec();
    }
    @

    and is work it show me all folder and when i insert to folder if there are files he show me only the
    csb.log if it exist or only folder if not
    i don't have a MAC to test it so i don't know why it's not working to you



  • This code works on MAC only with a *

    @
    fileDialog.setFilter("*.log");
    @

    but once you put a filename, all files are disabled.



  • see this, setfilter controls only the file type
    @
    void QFileDialog::setFilter ( QDir::Filters filters )
    Sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown.

    This function was introduced in Qt 4.4.
    @



  • we are 1 step forward, i use this in the mycalss.cpp
    @
    QStringList files = dir.entryList(QStringList("abc.txt"),
    QDir::Files | QDir::NoSymLinks);

        qDebug () << files << files.contains("abc.txt");
    

    @
    now I get in the debug when I click on browse

    @
    () false
    ("abc.txt") true
    () false
    @

    but it ignores my if condition simply and shows me all the files ...

    any idea? may be i ve a mistake in the call?



  • [quote author="SherifOmran" date="1344933412"]we are 1 step forward, i use this in the mycalss.cpp

    but it ignores my if condition simply and shows me all the files ...
    [/quote]
    which if condition?



  • class

    @

    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {

    QModelIndex index = sourceModel()->index(source_row, 0/*column*/, source_parent);
         QFileSystemModel* filemodel = qobject_cast<QFileSystemModel*>(sourceModel());
        // QFileSystemModel *filemodel = static_cast<QFileSystemModel*>(sourceModel());
        filemodel->setRootPath(QDir::currentPath());
        QString fullPath =   filemodel->fileInfo(index).absoluteFilePath();
        QDir dir(fullPath);
    
        QStringList  files = dir.entryList(QStringList("abc.txt"),
                                     QDir::Files | QDir::NoSymLinks);
    
        qDebug () << files << files.contains("abc.txt");
    

    if (files.contains("abc.txt")) return true; else false;

    }

    @



  • so you need to change the filterAcceptsRow function to be as:
    if the index represent a folder return true
    else if its a file and his name == to "abc.txt" return true
    else return false
    in that case you will get all folder (as empty) and you'll see only the file with name "abc.txt"

    @
    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    QFileSystemModel* filemodel = qobject_cast<QFileSystemModel*>(sourceModel());
    QFileInfo indexInfo = filemodel->fileInfo(index);
    if( indexInfo.isDir())
    return true;
    else if (indexInfo.isFile() && indexInfo.fileName() == QString("abc.txt"))
    return true;
    else return false;
    }
    @



  • It does not work.

    I use this as the calling function, is it correct?
    @
    QFileDialog *fileDialog = new QFileDialog;
    myclass *sourceModel = new myclass;
    QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
    proxyModel->setSourceModel(sourceModel);
    fileDialog->setProxyModel(proxyModel);
    fileDialog->show();
    @



  • please see this link, it seems there is a bug
    https://bugreports.qt-project.org/browse/QTBUG-7739



  • the bug report refer to code like this:
    @
    QFileDialog fileDialog;
    fileDialog.setFilter("abc.txt");
    fileDialog.exec();
    @

    and not for the code using QSortFilterProxyModel.
    about your code:
    [quote author="SherifOmran" date="1344951506"]It does not work.

    I use this as the calling function, is it correct?
    @
    QFileDialog *fileDialog = new QFileDialog;
    myclass *sourceModel = new myclass;
    QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
    proxyModel->setSourceModel(sourceModel);
    fileDialog->setProxyModel(proxyModel);
    fileDialog->show();
    @
    .
    [/quote]

    you use it in the wrong way instead use it as follow

    @
    QFileDialog *fileDialog = new QFileDialog;
    //you implemented MyClass as proxy model so you need to set it in QFileDialog as proxyModel
    myclass *proxyModel = new myclass;
    fileDialog->setProxyModel(proxyModel);
    fileDialog->show();
    @

    and use the filterAcceptRow as before

    [quote author="lahianim" date="1344944559"]so you need to change the filterAcceptsRow function to be as:
    if the index represent a folder return true
    else if its a file and his name == to "abc.txt" return true
    else return false
    in that case you will get all folder (as empty) and you'll see only the file with name "abc.txt"

    @
    bool myclass::filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const
    {
    QModelIndex index = sourceModel()->index(source_row, 0/column/, source_parent);
    QFileSystemModel* filemodel = qobject_cast<QFileSystemModel*>(sourceModel());
    QFileInfo indexInfo = filemodel->fileInfo(index);
    if( indexInfo.isDir())
    return true;
    else if (indexInfo.isFile() && indexInfo.fileName() == QString("abc.txt"))
    return true;
    else return false;
    }
    @[/quote]



  • even this, it does not work my friend on MAC. It seems to be a bug.




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.