ich bin mir nicht ganz sicher ob ich es einfach nicht finde oder ob es das nicht gibt. Ich habe einen Dateinamen und möchte da gerne Pfad und File voneinander trennen. Gibt es diese Funltion schon irgendwo in QT oder müßte ich sie selber programmieren? (ich weiß das dies nicht sooo viel Aufwand wäre, aber wenn es das doch schon git ...)
Grüße,
Willi
Zuletzt geändert von Willi2793 am 18. Mai 2010 11:16, insgesamt 1-mal geändert.
QString QFileInfo::baseName () const
Returns the base name of the file without the path.
The base name consists of all characters in the file up to (but not including) the first '.' character.
Example:
QFileInfo fi("/tmp/archive.tar.gz");
QString base = fi.baseName(); // base = "archive"
The base name of a file is computed equally on all platforms, independent of file naming conventions (e.g., ".bashrc" on Unix has an empty base name, and the suffix is "bashrc").
See also fileName(), suffix(), completeSuffix(), and completeBaseName(