QDir::entryList doesn't assign twice



  • I tried to get file list by QDir::entryList, but I found QDir::entryList returns empty list at the second time. Here is example,

    QDir dir1("aaa");
    QDir dir2("bbb");

    QStringList files;

    if (!dir1.exists())
    return;

    files1 = dir1.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);
    .
    .
    .

    if (!dir2.exists())
    return;

    QStringList files2;
    files2 = dir2.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);

    In this case files1 is O.K. but files2 is empty. If I use following way, it works.

    files2 << dir2.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot);

    I just wonder why the second assign doesn't work.


Log in to reply
 

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