Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
Traversing directories
Traversing directories with QDir is really easy. The first thing to do is to have an instance of QDir in the first place. The easiest way to do this is to pass the directory path to the QDir constructor.
Qt handles file paths in a platform-independent way. Even though the regular directory separator on Windows is a backward slash character (\) and on other platforms it is the forward slash (/), Qt internally always uses the forward slash, and paths returned by most Qt methods never contain backward slashes. You can always use forward slashes when passing paths to Qt methods, even on Windows. If you need to convert the Qt's path representation to the native form (for example, for passing it to the standard library or ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access