How do I open and read every file in a directory using qt c++ QDir class, skipping special files like symlinks, in alphabetical order, starting from upper letters?
Here is an example of how you can open and read every file in a directory using the Qt C++ QDir class, skipping special files like symlinks, in alphabetical order, starting from upper letters:

#include <QDir>
#include <QFileInfo>
#include <QTextStream>
#include <QDebug>

int main(int argc, char *argv[])
{
    // Set the directory path
    QString directoryPath = ./;

    // Create a QDir object with the given directory path
    QDir directory(directoryPath);

    // Filter the files to only show regular files
    directory.setFilter(QDir::Files | QDir::NoSymLinks);

    // Sort the files in alphabetical order, starting from upper letters
    directory.setSorting(QDir::Name | QDir::Reversed);

    // Get a list of all the files in the directory
    QFileInfoList fileList = directory.entryInfoList();

    // Loop through each file in the list
    for (int i = 0; i < fileList.size(); i++)
    {
        // Get the file info for the current file
        QFileInfo fileInfo = fileList.at(i);

        // Open the file for reading
        QFile file(fileInfo.filePath());
        if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            qDebug() << Failed to open file: << fileInfo.fileName();
            continue;
        }

        // Read the contents of the file
        QTextStream stream(&file);
        QString fileContents = stream.readAll();

        // Close the file
        file.close();

        // Print the contents of the file
        qDebug() << File contents: << fileContents;
    }

    return 0;
}
This code will read the contents of each file in the given directory, filter out any special files like symlinks, sort the remaining files in alphabetical order starting from upper letters, and print the contents of each file to the console.
Can you use a do-while loop instead?
Of course. Here's the same code, but using a do-while instead:

```c++
#include <QDir>
#include <QFileInfo>
#include <QTextStream>
#include <QDebug>

int main(int argc, char *argv[])
{
    // Set the directory path
    QString directoryPath = ./;

    // Create a QDir object with the given directory path
    QDir directory(directoryPath);

    // Filter the files to only show regular files
    directory.setFilter(QDir::Files | QDir::NoSymLinks);

    // Sort the files in alphabetical order, starting from upper letters
    directory.setSorting(QDir::Name | QDir::Reversed);

    // Get a list of all the files in the directory
    QFileInfoList fileList = directory.entryInfoList();

    // Loop through each file in the list
    int i = 0;
    do {
        // Get the file info for the current file
        QFileInfo fileInfo = fileList.at(i);

        // Open the file for reading
        QFile file(fileInfo.filePath());
        if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            qDebug() << Failed to open file: << fileInfo.fileName();
            continue;
        }

        // Read the contents of the file
        QTextStream stream(&file);
        QString fileContents = stream.readAll();

        // Close the file
        file.close();

        // Print the contents of the file
        qDebug() << File contents: << fileContents;
        i++;
    } while (i < fileList.size());

    return 0;
}
```